Separate compilation of XQuery modules is available (under Saxon-EE only). An overloaded method
compileLibrary() is available
XQueryCompiler class to compile a library module; any subsequent compilation using the same
import this module (using
import module specifying only a module URI - any location hint will be ignored), and the global functions
and variables declared in the library module will be imported without incurring the cost of recompiling them.
XPathCompiler has a new option to permit undeclared variables in XPath expressions. This allows an expression to be
compiled without pre-declaring the variables that it references. It is possible to discover what variables are used in the expression (so that
they can be initialized) by means of new methods provided on the
XdmValue has a new method
append() allowing a new
to be constructed by concatenating two existing instances of
XdmDestination have a new method
(and a corresponding accessor
getTreeModel()) to indicate that what tree model should be used for
the constructed tree. This allows selection of a linked tree in the case where XQuery Update access is required,
or of the new condensed tiny tree. These methods are defined in terms of a new
TreeModel class which in principle
defines an extensibility point where new user-defined tree models can be supported.
XdmNode has a new method
getColumnNumber() allowing the column number in the original
lexical XML to be obtained, in cases where line numbers have been preserved.
Processor object is now accessible to the code of extension functions by calling
context.getConfiguration().getProcessor(), assuming that the method in question has a first argument of type
net.sf.saxon.expr.XPathContext. This is useful when the extension function wants to create new
nodes or invoke Saxon operations such as XSLT or XQuery processing.
A new mechanism is provided in the s9api
for declaring so-called integrated extension functions. Unlike traditional extension functions invoked
as Java methods through reflexion, an integrated extension function is implemented as a pair of classes: a class that extends the
net.sf.saxon.functions.ExtensionFunctionDefinition, which defines static properties of the extension function,
and a second class which extends
net.sf.saxon.functions.ExtensionFunctionCall, and represents a specific call on the extension
function, and provides a
call() method to evaluate its result.
Many Saxon extension functions have been re-implemented using this mechanism; examples are
XsltTransformer class now has methods to get and set an
ErrorListener for dynamic errors.