Extension functions

This section describes extension functions built in to the Saxon product. For information on writing your own extension functions, see Writing extension functions (Java) or Writing extension functions (.NET)

A Saxon extension function is invoked using a name such as saxon:localname().

The saxon prefix (or whatever prefix you choose to use) must be associated with the Saxon namespace URI

For example, to invoke the saxon:evaluate() function in XSLT, write:

<xsl:variable name="expression"
      select="concat('child::', $param, '[', $index, ']')"/>
<xsl:copy-of select="saxon:evaluate($expression)"

The equivalent in XQuery is:

declare namespace saxon="";
declare variable $param as xs:string external;
declare variable $index as xs:integer external;
declare variable $expression :=
      concat('child::', $param, '[', $index, ']');

The extension functions supplied with the Saxon product are as follows:

The Java source code of these functions (which in most cases is extremely simple), can be used as an example for writing other user extension functions. It is found in class net.sf.saxon.functions.Extensions. Source code is available in the download of Saxon-B from SourceForge