Extensibility mechanisms

The abstract class ExtensionFunctionDefinition, which is extended to implement user-defined integrated extension functions, now has a method asFunction() which returns the extension function as a function item (which can in turn be wrapped in an XdmFunctionItem). This allows extension functions written in Java to be used from Java as well as from XPath. For example, it allows a parameter to a query or stylesheet to be defined with type function(*), and for a Java-written extension function to be supplied as the value of this parameter.

When converting the result of a Java extension function to an XDM type, the s9api classes XdmValue and its subclasses (XdmNode, XdmAtomicValue, etc) are now recognized. This means that where explicit conversions are required, for example to a map or an array, the conversion methods on these classes can be used; for example, XdmMap.makeMap(), XdmArray.makeArray().

In Saxon 9.7, a java.util.Map passed as a stylesheet parameter was implicitly converted to an XDM map in Saxon-PE and Saxon-EE, but in Saxon-HE it was supplied as a wrapped external object. Saxon 9.8 retains the Saxon-HE behaviour in all editions. To provide an XDM map, convert it explicitly using XdmMap.makeMap() .