XSLT 2.0 implementation

It is now possible to specify an initial template to be invoked when the transformation starts. From the command line this is done using the -it option, followed by the template name. When this option is used, no source file should be provided. In the API, the initial template is set using setInitialTemplate on the Controller class. The transformation is then started using the transform method in the normal way, except that the source argument may be null. (It does not have to be null: if a source is supplied, it will still cause the context node to be initialized, but will no longer cause execution to start by applying templates to this node).

An XPath expression within an attribute value may now contain a comment {avt15}

A newline is now written before a DOCTYPE declaration only if the DOCTYPE declaration is preceded by an XML declaration. This means that the newline is always omitted when serializing as HTML. There have been unconfirmed reports of browsers that require the DOCTYPE declaration to be right at the start of the file. An unintended but hopefully harmless side-effect of this change is that where the result tree is empty, previous releases serialized the result as a file containing only an XML declaration; the current release serializes it as an empty file containing no XML declaration.

The href attribute of xsl:result-document can now be omitted. Generally this is done when writing the principal result tree, if you want to set the validation or type attributes. Don't do this if the stylesheet also writes output nodes before callling xsl:result-document (it's an error to write two result trees to the same URI).

To achieve this, opening of the output file is delayed until the first attempt to write to it. A side-effect of this change is that when the result tree is empty, or when a failure occurs before writing any output, the output file is no longer written.

In xsl:key, the as attribute is no longer available. The data type of the key is now implicit. To implement this, one index is built for each primitive type encountered in the supplied argument of the key() function: for example, if a key is used both as a string and as an integer, in different calls, then both a string and an integer index will be built. NaN is no longer considered to match NaN for indexing purposes.

The select attribute of xsl:message is implemented. {ver18}

The xsl:value-of instruction can now contain a sequence constructor as an alternative to the select attribute. {atrs52}

The xsl:attribute instruction can now take a separator attribute. {atrs51, 52}

When a sequence constructor is used to construct a simple-valued node such as an attribute or comment, any non-text nodes in the sequence are now atomized. Previously (as in XSLT 1.0) they were ignored with a warning message.

The new xsl:document instruction is implemented. This instruction has been added since the 12 Nov 2003 working draft; it creates a document node, and optionally validates it using validation and type attributes. Unlike xsl:result-document, the new document is not serialized. See further details.

This version of Saxon aims to conform to the rules for a basic XSLT processor (that is, a non-schema-aware processor). A future release will provide a schema-aware processor. To align with the two conformance levels, this release does not support the validation or type attributes on instructions that create element, attribute, or document nodes.