XSLT 2.0 implementation

Implemented the new xsl:perform-sort instruction. The select attribute is currently mandatory, it is not possible to use it with a contained sequence constructor {sortNNN}

Internally, the code for handling sorting has been unified between xsl:for-each, xsl:apply-templates, and xsl:perform-sort.

The xsl:sort-key declaration and the sort() function are withdrawn.

The instructions xsl:attribute, xsl:comment, xsl:processing-instruction, and xsl:namespace now allow a select attribute; if this attribute is present the content of the instruction must be empty. The value of the select expression may be a sequence; all of the items in the sequence are included in the result, by converting them to strings and separating them with a single space. {arts50, posn80, node51-54}

An xsl:analyze-string element is now required to have at least one xsl:matching-substring or xsl:non-matching-substring child.

Tunnel parameters have been implemented. {var20-22, 905err, 906err}

The xsl:with-param element now accepts an as attribute.

Patterns of the form *:local-name are now accepted {match51}

No code was being generated to perform run-time type checking or conversion of template parameters (bug 818677). This has been corrected. {var16, var904err}

It is now a compile-time error if a parameter is supplied in xsl:call-template that doesn't match any parameter declared in the template being called, or if it has the wrong type when compared with the declared type of the parameter, or if the called template has a required parameter that isn't supplied in the call.

On the command line, it is now possible to specify a parameter in the form +param=filename. The filename will be parsed as an XML document, and the document node will be passed to the stylesheet as the value of the stylesheet parameter param. If the filename is a directory, then all the files contained immediately within the directory will be parsed and the result will be passed as a sequence of document nodes.

Parameters supplied on the command line are now treated as untyped atomic values rather than strings, which means they can be supplied where the expected type is (say) integer or date; the string supplied as the value of the parameter will automatically be converted to the required type.

Tracing (with the -T option) has been improved. Some instructions such as xsl:analyze-string were not being traced. The trace output now includes the names and values of variables (the value is truncated to the first four items in a sequence, and the first 20 characters of each item; nodes are shown by their generate-id() value). More information is available to user-written trace listeners, in particular, the Controller is now available (as a property of the InstructionInfo object). The InstructionInfo interface now has a general-purpose getProperty() method, allowing additional information to be made available without changing the interface for existing TraceListeners.

The rule is now enforced that the namespace URI of a function name, variable name, mode name (etc.) cannot be a reserved namespace URI (such as the XML namespace, the XSLT namespace, or the XML Schema namespace).

In xsl:number, the format tokens one, first, and 1st are no longer available; they have been replaced by the format tokens W, w, and Ww (for upper case, lower case, and title case words), together with the optional attribute ordinal="yes". These sequences are currently implemented for English and partially (see below) for German. {numb14, 24, 25}

The functions format-date(), format-time(), and format-dateTime() have been updated to match the latest specs. Specifically, they now take either two or five arguments (though Saxon currently ignores the last two); names of months or days of the week are requested using presentation modifiers N (upper-case), n (lower-case) and Nn (title case), and all other modifiers are interpreted in the same way as xsl:number. {date067, date068, date073}

I have extended the support for localizing xsl:number and format-date in German. It's mainly a proof of concept, to show that it's possible. The code is in module net.sf.saxon.number.Numberer_de, and similar modules can be written for other languages: just change the last two letters of the class name to the language code used. If you do write implementations for other languages, I will be happy to include them in future Saxon distributions. {numb28, numb29}

The attribute disable-output-escaping is no longer supported on xsl:attribute. In theory, you should be able to use character maps instead.

Casting a string to an xs:QName is now supported: but only in XSLT (not in XPath or XQuery), and only when an explicit cast or constructor function is invoked (not, for example, when passing an untyped atomic value to a function that expects an xs:QName).

Literal result elements now compile internally into xsl:element and xsl:attribute instructions. This results in changes to trace output: each attribute is now traced as a separate instruction.