org.ucl.xpath.function
Class FnTranslate

java.lang.Object
  extended byorg.ucl.xpath.function.Function
      extended byorg.ucl.xpath.function.FnTranslate

public class FnTranslate
extends Function

Translation function.

Usage: fn:translate($arg as xs:string?, $mapString as xs:string, $transString as xs:string) as xs:string

This class returns the value of $arg modified so that every character in the value of $arg that occurs at some position N in the value of $mapString has been replaced by the character that occurs at position N in the value of $transString.

If the value of $arg is the empty sequence, the zero-length string is returned.

Every character in the value of $arg that does not appear in the value of $mapString is unchanged.

Every character in the value of $arg that appears at some position M in the value of $mapString, where the value of $transString is less than M characters in length, is omitted from the returned value. If $mapString is the zero-length string $arg is returned.

If a character occurs more than once in $mapString, then the first occurrence determines the replacement character. If $transString is longer than $mapString, the excess characters are ignored.


Field Summary
 
Fields inherited from class org.ucl.xpath.function.Function
_arity, _fl, _name
 
Constructor Summary
FnTranslate()
          Constructor for FnTranslate.
 
Method Summary
 ResultSequence evaluate(java.util.Collection args)
          Evaluate the arguments.
static java.util.Collection expected_args()
          Calculate the expected arguments.
static ResultSequence translate(java.util.Collection args)
          Translate arguments.
 
Methods inherited from class org.ucl.xpath.function.Function
arity, convert_argument, convert_arguments, dynamic_context, name, set_function_library, signature, signature, signature, static_context
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FnTranslate

public FnTranslate()
Constructor for FnTranslate.

Method Detail

evaluate

public ResultSequence evaluate(java.util.Collection args)
                        throws DynamicError
Evaluate the arguments.

Specified by:
evaluate in class Function
Parameters:
args - are evaluated.
Returns:
The evaluation of the arguments being translated.
Throws:
DynamicError - Dynamic error.

translate

public static ResultSequence translate(java.util.Collection args)
                                throws DynamicError
Translate arguments.

Parameters:
args - are translated.
Returns:
The result of translating the arguments.
Throws:
DynamicError - Dynamic error.

expected_args

public static java.util.Collection expected_args()
Calculate the expected arguments.

Returns:
The expected arguments.