XPath/XQuery Functions: Numeric
Altova's numeric extension functions can be used in XPath and XQuery expressions and provide additional functionality for the processing of data.
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. •In order to distinguish Altova extension functions from functions in the standard library, Altova extension functions are named in this documentation with a suffix of [altova:]. For example: add-years-to-date [altova:]. •When using Altova extension functions in your XPath/XQuery expressions, however, you must use the function without any prefix or suffix, just as you would use any standard XPath/XQuery function. Use an Altova extension like this: add-years-to-date(xs:date("2014-01-15"), 10).
|
Auto-numbering functions
generate-auto-number(ID as xs:string, StartsWith as xs:double, Increment as xs:double, ResetOnChange as xs:string) as xs:integer XP1 XP2 XQ1 XP3.1 XQ3.1 Generates a number each time the function is called. The first number, which is generated the first time the function is called, is specified by the StartsWith argument. Each subsequent call to the function generates a new number, this number being incremented over the previously generated number by the value specified in the Increment argument. In effect, the generate-auto-number function creates a counter having a name specified by the ID argument, with this counter being incremented each time the function is called. If the value of the ResetOnChange argument changes from that of the previous function call, then the value of the number to be generated is reset to the StartsWith value. Auto-numbering can also be reset by using the reset-auto-number function.
|
reset-auto-number(ID as xs:string) XP1 XP2 XQ1 XP3.1 XQ3.1 This function resets the number of the auto-numbering counter named in the ID argument. The number is reset to the number specified by the StartsWith argument of the generate-auto-number function that created the counter named in the ID argument.
|
[ Top ]
Numeric functions
hex-string-to-integer(HexString as xs:string) as xs:integer XP3.1 XQ3.1 Takes a string argument that is the Base-16 equivalent of an integer in the decimal system (Base-10), and returns the decimal integer.
|
integer-to-hex-string(Integer as xs:integer) as xs:string XP3.1 XQ3.1 Takes an integer argument and returns its Base-16 equivalent as a string.
|
[ Top ]
Number-formatting functions
mt-format-number(Number as xs:numeric, PictureString as xs:string) as xs:string XP3.1 XQ3.1 Takes a number as the first argument, formats it according to the second (PictureString) argument, and returns the formatted number as a string. This is useful for formatting difficult-to-read numbers into a format that is more reader-friendly. The picture string can also contain characters, such as currency symbols, and so can also be used to insert characters in the formatted output. If you wish to insert a zero at a digit position when no digit exists in the input number at that position, then use a zero in that digit position of the picture string (see examples below). If you do not wish to force a zero (or other character), use the hash symbol (#).
Digits before the decimal separator are never foreshortened. The decimal part of a number (to the right of the decimal separator) as well as the units digit (first digit to the left of the decimal separator) are rounded off if the picture string of the decimal part is shorter than the number of decimal places in the input number.
Note: The grouping separator and decimal separator in the formatted output on the mobile device will be those of the language being used on the mobile device.
|
[ Top ]