Altova Extension Functions
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).
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 |
Usage of Altova extension functions
In order to use Altova extension functions, you must declare the Altova extension functions namespace (first highlight in code listing below) and then use the extension functions so that they are resolved as belonging to this namespace (see second highlight). The example below uses the Altova extension function named age.
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fn="http://www.w3.org/2005/xpath-functions"
xmlns:altova="http://www.altova.com/xslt-extensions">
<xsl:output method="text" encoding="ISO-8859-1"/>
<xsl:template match="Persons">
<xsl:for-each select="Person">
<xsl:value-of select="concat(Name, ': ')"/>
<xsl:value-of select="altova:age(xs:date(BirthDate))"/>
<xsl:value-of select="' years
'"/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
XPath/XQuery functions
XPath/XQuery functions can be used both in XPath expressions as well as in XQuery expressions: