XSLT 2.0 implementation
Static type checking is now implemented for non-tunnel parameters on xsl:call-template
in the same way as for function
calls: that is, the supplied value is compared against the required type, conversion code is generated if necessary, and errors are
reported if the static type of the supplied value is incompatible with the required type. Tunnel parameters and parameters for
xsl:apply-templates
are checked dynamically as before. One effect of this change is that declaring the required type
of parameters on named templates now gives a performance benefit as well as improving debugging and robustness.
In <xsl:number level="any">
, the rules have been changed for the case where the node being numbered
matches the pattern given in the from
attribute: such a node is now numbered 1, whereas previously it was
numbered according to its distance from the previous node that matched the from
pattern, if any. This implements
the change defined in W3C bug 5849.
For the three serialization parameters doctype-system
, doctype-public
, and saxon:next-in-chain
,
supplying "" (a zero-length string) as the value of the parameter is taken as setting the parameter to "absent". This is equivalent
to omitting the parameter, except that it overrides any setting that would otherwise be used. For example, this allows a value set
in <xsl:output>
to be overridden in an importing stylesheet, in an <xsl:result-document>
instruction, in the JAXP setOutputProperties()
method, or from the command line (where the syntax is simply
!doctype-system=
). (Note that this takes a slight liberty with the W3C and JAXP specifications.)
The doc-available()
function, when it returns false, now ensures that the document remains unavailable
for the rest of the transformation: previously, if called repeatedly it would check repeatedly, and therefore could
return different results on different calls. Also, once doc-available()
has returned false, subsequent
calls on doc()
or document()
are now guaranteed to fail. A call on doc-available()
that returns false does not prevent the document being created using xsl:result-document
, but any such
document will not be available during the same transformation.
The new function element-with-id()
, introduced in the errata for Functions and Operators, is available.
It behaves the same as the id()
function, except in the case of ID-valued elements, where it returns the
parent of the element having the is-ID
property, rather than the element itself.
For <xsl:number>
, numbering sequences have been added for format tokens x2460 (circled digits),
x2474 (parenthesized digits), and x2488 (digit followed by full stop). In each case the numbering sequence only handles
numbers in the range 1-20; numbers outside this range are formatted using the format token "1" (that is, as conventional decimal
numbers).
The option input-type-annotations="strip"
is now honoured for a document supplied in the form of a pre-built
tree, by creating a view of the tree in which all nodes appear as untyped. Previously it was honoured only when the tree
was built by the XSLT processor.
The TimedTraceListener
, used for timer profiling, is now capable of writing the profile output to a destination other than
System.err
. This option cannot however be enabled from the command line, only from the Java API.
A stylesheet that does not use an xsl:import-schema
declaration is now (by default) compiled with
schema-awareness disabled. This means that it will not be able to handle schema-typed input documents, or to
validate temporary trees created within the stylesheet, though it can still validate the final output tree. This
is for performance reasons: generating code to handle typed input data when it will not be encountered
adds to the execution cost. It is possible to override this setting from the s9api API on Java or from the Saxon.Api
on .NET. From the command line, schema-awareness is set automatically if the -sa option or any other option
implying schema-awareness is used (for example -val:strict). From JAXP, schema-awareness is set automatically
if the schema-aware TransformerFactory is used.
The amount of compile-time checking when schema-awareness is used has been further increased. In particular, if the expected type of a constructed element is known, Saxon now attempts to check (a) that the sequence constructor delivering the content of the element is capable of delivering a sequence of elements that matches the content model (previously it only checked that each child element could legitimately belong to the content model), and (b) that the sequence constructor is capable of creating each mandatory attribute required by the complex type of the element.
In the interests of performance, the decision whether to treat an ambiguous template rule match as a fatal error, a warning, or as fully recoverable, is now made at stylesheet compile time rather than at run-time.
The extension attribute saxon:allow-all-built-in-types
is no longer recognized.