XPath/XQuery Functions: String
Altova's string extension functions can be used in XPath and XQuery expressions and provide additional functionality for the processing of data. The functions in this section can be used with Altova's XPath 3.0 and XQuery 3.0 engines. They are available in XPath/XQuery contexts.
Note about naming of functions and language applicability
Altova extension functions can be used in XPath/XQuery expressions. They provide additional functionality to the functionality that is available in the standard library of XPath, XQuery, and XSLT functions. Altova extension functions are in the Altova extension functions namespace, https://www.altova.com/xslt-extensions, and are indicated in this section with the prefix altova:, which is assumed to be bound to this namespace. Note that, in future versions of your product, support for a function might be discontinued or the behavior of individual functions might change. Consult the documentation of future releases for information about support for Altova extension functions in that release.
|
altova:camel-case(InputString as xs:string) as xs:string XP3.1 XQ3.1 Returns the input string InputString in CamelCase. The string is analyzed using the regular expression '\s' (which is a shortcut for the whitespace character). The first non-whitespace character after a whitespace or sequence of consecutive whitespaces is capitalized. The first character in the output string is capitalized.
altova:camel-case(InputString as xs:string, SplitChars as xs:string, IsRegex as xs:boolean) as xs:string XP3.1 XQ3.1 Converts the input string InputString to camel case by using SplitChars to determine the character/s that trigger the next capitalization. SplitChars is used as a regular expression when IsRegex = true(), or as plain characters when IsRegex = false(). The first character in the output string is capitalized.
|
altova:char(Position as xs:integer) as xs:string XP3.1 XQ3.1 Returns a string containing the character at the position specified by the Position argument, in the string obtained by converting the value of the context item to xs:string. The result string will be empty if no character exists at the index submitted by the Position argument.
altova:char(InputString as xs:string, Position as xs:integer) as xs:string XP3.1 XQ3.1 Returns a string containing the character at the position specified by the Position argument, in the string submitted as the InputString argument. The result string will be empty if no character exists at the index submitted by the Position argument.
|
altova:create-hash-from-string(InputString as xs:string) as xs:string XP2 XQ1 XP3.1 XQ3.1 altova:create-hash-from-string(InputString as xs:string, HashAlgo as xs:string) as xs:string XP2 XQ1 XP3.1 XQ3.1 Generates a hash string from InputString by using the hashing algorithm specified by the HashAlgo argument. The following hashing algorithms may be specified (in upper or lower case): MD5, SHA-1, SHA-224, SHA-256, SHA-384, SHA-512. If the second argument is not specified (see the first signature above), then the SHA-256 hashing algorithm is used.
|
altova:first-chars(X-Number as xs:integer) as xs:string XP3.1 XQ3.1 Returns a string containing the first X-Number of characters of the string obtained by converting the value of the context item to xs:string.
altova:first-chars(InputString as xs:string, X-Number as xs:integer) as xs:string XP3.1 XQ3.1 Returns a string containing the first X-Number of characters of the string submitted as the InputString argument.
|
altova:format-string(InputString as xs:string, FormatSequence as item()*) as xs:string XP3.1 XQ3.1 The input string (first argument) contains positional parameters (%1, %2, etc). Each parameter is replaced by the string item that is located at the corresponding position in the format sequence (submitted as the second argument). So the first item in the format sequence replaces the positional parameter %1, the second item replaces %2, and so on. The function returns this formatted string that contains the replacements. If no string exists for a positional parameter, then the positional parameter itself is returned. This happens when the index of a positional parameter is greater than the number of items in the format sequence.
|
altova:last-chars(X-Number as xs:integer) as xs:string XP3.1 XQ3.1 Returns a string containing the last X-Number of characters of the string obtained by converting the value of the context item to xs:string.
altova:last-chars(InputString as xs:string, X-Number as xs:integer) as xs:string XP3.1 XQ3.1 Returns a string containing the last X-Number of characters of the string submitted as the InputString argument.
|
altova:pad-string-left(StringToPad as xs:string, StringLength as xs:integer, PadCharacter as xs:string) as xs:string XP3.1 XQ3.1 The PadCharacter argument is a single character. It is padded to the left of the string to increase the number of characters in StringToPad so that this number equals the integer value of the StringLength argument. The StringLength argument can have any integer value (positive or negative), but padding will occur only if the value of StringLength is greater than the number of characters in StringToPad. If StringToPad. has more characters than the value of StringLength, then StringToPad is left unchanged.
|
altova:pad-string-right(StringToPad as xs:string, StringLength as xs:integer, PadCharacter as xs:string) as xs:string XP3.1 XQ3.1 The PadCharacter argument is a single character. It is padded to the right of the string to increase the number of characters in StringToPad so that this number equals the integer value of the StringLength argument. The StringLength argument can have any integer value (positive or negative), but padding will occur only if the value of StringLength is greater than the number of characters in StringToPad. If StringToPad has more characters than the value of StringLength, then StringToPad is left unchanged.
|
altova:repeat-string(InputString as xs:string, Repeats as xs:integer) as xs:string XP2 XQ1 XP3.1 XQ3.1 Generates a string that is composed of the first InputString argument repeated Repeats number of times.
|
altova:substring-after-last(MainString as xs:string, CheckString as xs:string) as xs:string XP3.1 XQ3.1 If CheckString is found in MainString, then the substring that occurs after CheckString in MainString is returned. If CheckString is not found in MainString, then the empty string is returned. If CheckString is an empty string, then MainString is returned in its entirety. If there is more than one occurrence of CheckString in MainString, then the substring after the last occurrence of CheckString is returned.
|
altova:substring-before-last(MainString as xs:string, CheckString as xs:string) as xs:string XP3.1 XQ3.1 If CheckString is found in MainString, then the substring that occurs before CheckString in MainString is returned. If CheckString is not found in MainString, or if CheckString is an empty string, then the empty string is returned. If there is more than one occurrence of CheckString in MainString, then the substring before the last occurrence of CheckString is returned.
|
altova:substring-pos(StringToCheck as xs:string, StringToFind as xs:string) as xs:integer XP3.1 XQ3.1 Returns the character position of the first occurrence of StringToFind in the string StringToCheck. The character position is returned as an integer. The first character of StringToCheck has the position 1. If StringToFind does not occur within StringToCheck, the integer 0 is returned. To check for the second or a later occurrence of StringToCheck, use the next signature of this function.
altova:substring-pos(StringToCheck as xs:string, StringToFind as xs:string, Integer as xs:integer) as xs:integer XP3.1 XQ3.1 Returns the character position of StringToFind in the string, StringToCheck. The search for StringToFind starts from the character position given by the Integer argument; the character substring before this position is not searched. The returned integer, however, is the position of the found string within the entire string, StringToCheck. This signature is useful for finding the second or a later position of a string that occurs multiple times with the StringToCheck. If StringToFind does not occur within StringToCheck, the integer 0 is returned.
|
altova:trim-string(InputString as xs:string) as xs:string XP3.1 XQ3.1 This function takes an xs:string argument, removes any leading and trailing whitespace, and returns a "trimmed" xs:string.
|
altova:trim-string-left(InputString as xs:string) as xs:string XP3.1 XQ3.1 This function takes an xs:string argument, removes any leading whitespace, and returns a left-trimmed xs:string.
|
altova:trim-string-right(InputString as xs:string) as xs:string XP3.1 XQ3.1 This function takes an xs:string argument, removes any trailing whitespace, and returns a right-trimmed xs:string.
|