S9API interface
A new constructor has been added to create an XdmValue
given an XdmSequenceIterator
.
The constructors for the Serializer
class
have been deprecated. A Serializer
object
should always be created using one of the newSerializer
methods on the Processor
class.
The ItemTypeFactory
has a new method
to create an XDM map, given a Java map as input.
The XQueryCompiler
has a new pair of
methods to set and get an option that requests streaming; the XQueryEvaluator
has a new method to request
streamed evaluation.
The method XQueryEvaluator.iterator()
is now defined to return an XdmSequenceIterator
(a subclass of
java.lang.Iterator
), and this iterator offers a close()
method.
The close()
method should be called if the calling application does not read the
iterator to completion. This is important when the query uses streaming, as calling
close()
has the effect of terminating other threads that might otherwise be
left in suspended animation until the Java VM closes down.
To support the extensive changes in XSLT 3.0 concerning the ways in which stylesheets can be
invoked, a variant of the XsltTransformer
class called Xslt30Transformer
has been introduced. This can be instantiated using
XsltExecutable.load30()
. The new class (and the old class, which is retained
for compatibility) work equally well whether the stylesheet is an XSLT 2.0 or XSLT 3.0
stylesheet. The changes in the new Xslt30Transformer
include:
-
The global context item (used to set the focus for evaluation of global variables and parameters) is now quite separate from the initial transformation input. The initial transformation input (previously called the principal source document) can now be any sequence of items (nodes, atomic values, or even functions); this sequence is used when a transformation is started using the
applyTemplates()
method. -
There are essentially three invocation methods:
applyTemplates()
,callTemplate()
, andcallFunction()
. The first invokes the stylesheet in the traditional XSLT 1.0 way, by applying templates to the supplied input in a specified mode, except that the input can now be any sequence of items. The second adds the ability to define a named template as the entry point, a capability that was introduced in XSLT 2.0. The third option, new in 3.0, is to invoke the stylesheet by calling a stylesheet function with parameters. -
As well as setting values for global stylesheet parameters, it is now possible to set values for the parameters (tunnel and non-tunnel parameters) of the initial template (whether invoked using
applyTemplates()
orcallTemplate()
) and of course for the parameters of a stylesheet function. -
Previously the results of invoking a stylesheet were always wrapped in a document node, which could either be returned as a tree in memory or serialized as lexical XML (or HTML, etc). There is now the alternative of returning raw (unwrapped) results; for example a stylesheet invocation can return a sequence of integers or a single boolean. This is true whichever of the three invocation mechanisms is used.
Values supplied to global stylesheet parameters and to the parameters of an initial template or function are converted to the required type using the function conversion rules.
The corresponding method on XQueryEvaluator
has also been changed to use the function conversion rules.