XPath/XQuery Functions: Numeric

www.altova.com Expand/Collapse All Print this Topic Previous Page Up One Level Next page

Home >  Appendices > XSLT and XPath/XQuery Functions > Altova Extension Functions >

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. 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, http://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.

 

XPath functions (used in XPath expressions in XSLT):

XP1 XP2 XP3.1

XSLT functions (used in XPath expressions in XSLT):

Xslt1 XSLT2 XSLT3

XQuery functions (used in XQuery expressions in XQuery):

XQ1 XQ3.1

 

 

Auto-numbering functions

Click to expand/collapsegenerate-auto-number [altova:]

altova: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 altova: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 altova:reset-auto-number function.

altova:generate-auto-number("ChapterNumber", 1, 1, "SomeString") will return one number each time the function is called, starting with 1, and incrementing by 1 with each call to the function. As long as the fourth argument remains "SomeString" in each subsequent call, the incrementing will continue. When the value of the fourth argument changes, the counter (called ChapterNumber) will reset to 1. The value of ChapterNumber can also be  reset by a call to the altova:reset-auto-number function, like this: altova:reset-auto-number("ChapterNumber").

 

 

Click to expand/collapsereset-auto-number [altova:]

altova: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 altova:generate-auto-number function that created the counter named in the ID argument.

altova:reset-auto-number("ChapterNumber") resets the number of the auto-numbering counter named ChapterNumber that was created by the altova:generate-auto-number function. The number is reset to the value of the StartsWith argument of the altova:generate-auto-number function that created ChapterNumber.

 

 

[ Top ]

 

Numeric functions

Click to expand/collapsehex-string-to-integer [altova:]

altova: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.

altova:hex-string-to-integer('1') returns 1
altova:hex-string-to-integer('9') returns 9
altova:hex-string-to-integer('A') returns 10
altova:hex-string-to-integer('B') returns 11
altova:hex-string-to-integer('F') returns 15
altova:hex-string-to-integer('G') returns an error
altova:hex-string-to-integer('10') returns 16
altova:hex-string-to-integer('01') returns 1
altova:hex-string-to-integer('20') returns 32
altova:hex-string-to-integer('21') returns 33
altova:hex-string-to-integer('5A') returns 90  
altova:hex-string-to-integer('USA') returns an error

 

 

Click to expand/collapseinteger-to-hex-string [altova:]

altova: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.

altova:integer-to-hex-string(1) returns '1'
altova:integer-to-hex-string(9) returns '9'
altova:integer-to-hex-string(10) returns 'A'
altova:integer-to-hex-string(11) returns 'B'
altova:integer-to-hex-string(15) returns 'F'
altova:integer-to-hex-string(16) returns '10'
altova:integer-to-hex-string(32) returns '20'
altova:integer-to-hex-string(33) returns '21'
altova:integer-to-hex-string(90) returns '5A'  

 

 

[ Top ]

 

Number-formatting functions

Click to expand/collapsegenerate-auto-number [altova:]

altova: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 altova: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 altova:reset-auto-number function.

altova:generate-auto-number("ChapterNumber", 1, 1, "SomeString") will return one number each time the function is called, starting with 1, and incrementing by 1 with each call to the function. As long as the fourth argument remains "SomeString" in each subsequent call, the incrementing will continue. When the value of the fourth argument changes, the counter (called ChapterNumber) will reset to 1. The value of ChapterNumber can also be  reset by a call to the altova:reset-auto-number function, like this: altova:reset-auto-number("ChapterNumber").

 

 

[ Top ]

 


© 2019 Altova GmbH