net.sf.saxon.functions

Class Translate

public class Translate extends SystemFunction

Implement the XPath translate() function
Method Summary
ItemevaluateItem(XPathContext context)
Evaluate the function
IntToIntMapgetStaticMap()
Get the translation map built at compile time if there is one
static CharSequencetranslate(StringValue sv0, StringValue sv1, StringValue sv2)
Perform the translate function
static CharSequencetranslateUsingMap(CharSequence in, IntToIntMap map)
Implement the translate() function using an index built at compile time
ExpressiontypeCheck(ExpressionVisitor visitor, ItemType contextItemType)

Method Detail

evaluateItem

public Item evaluateItem(XPathContext context)
Evaluate the function

getStaticMap

public IntToIntMap getStaticMap()
Get the translation map built at compile time if there is one

translate

public static CharSequence translate(StringValue sv0, StringValue sv1, StringValue sv2)
Perform the translate function

translateUsingMap

public static CharSequence translateUsingMap(CharSequence in, IntToIntMap map)
Implement the translate() function using an index built at compile time

Parameters: in the string to be translated map index built at compile time, mapping input characters to output characters. The map returns -1 for a character that is to be deleted from the input string, Integer.MAX_VALUE for a character that is to remain intact

Returns: the translated character string

typeCheck

public Expression typeCheck(ExpressionVisitor visitor, ItemType contextItemType)