Saxon extensions to the W3C XSLT/XQuery specifications

Two new extension functions have been introduced: saxon:base64Binary-to-string() and saxon:hexBinary-to-string(). These represent the inverse of the two functions saxon:string-to-base64Binary and saxon:string-to-hexBinary() introduced in Saxon 8.4: they allow a base64Binary or hexBinary value to be treated as a representation of the octet sequence that results from encoding a string using a specified encoding. They were introduced because they were found useful in handling LDIF (LDAP interchange format) files.

The extension function saxon:try (which is available in Saxon-SA only) has been enhanced to make error information available. This is achieved by turning it into a higher order function. If the second argument is supplied as a reference to a function, the nominated function is called when an error occurs, and receives as an argument an element giving information about the error that occurred, including the error code, error message, and the location of the error in the source stylesheet or query. For more details see saxon:try().

A pair of extension functions has been added allowing an XSLT transformation to be invoked from another transformation or from a query. This now allows XSLT code to be invoked from XQuery code for the first time. The function saxon:compile-stylesheet() takes as input a document node at the root of a document containing a stylesheet (which may either be read from a source file using the doc() function, or constructed programmatically); this function returns a representation of the compiled stylesheet. The second extension function, saxon:transform, takes as input a compiled stylesheet and a node that acts as the initial context node of the transformation, and it returns the principal result document of the transformation. For further details see saxon:compile-stylesheet() and saxon:transform().