# XSLT Changes

XSLT: Sorting and Collations

The default collation for `xsl:sort` has changed. If no `collation`, `lang`, or `case-order` attribute is present on the `xsl:sort` element, the default collation is determined in the same way as the default collation for operators such as `le` and functions such as `min` and `max`: that is, it is taken from the nearest enclosing `[xsl:]default-collation` attribute if there is one, or failing that, the Unicode codepoint collation is used.

This change is motivated primarily by performance considerations. Previously Saxon used the linguistic collation for the current Java locale. Sort-intensive stylesheets can run at five times the speed when using the codepoint collation.

The change also has usability benefits in that it brings the default collation for `xsl:sort` into line with the defaults for all other functions and operators, and with the `order by` construct in XQuery.

For English-speaking users, the most noticeable effect will be that upper-case now precedes lower-case, for example, "ZEBRA" sorts before "aardvark".

Note that according to the XSLT 2.0 specification, the default collation used by `xsl:sort` is implementation-defined.

If linguistic collation is required, this can be achieved by specifying `lang="en"` (or another language) on the `xsl:sort` element. To pick up the collation for the current Java locale, whatever it might be, specify `collation="http://saxon.sf.net/collation"` with no query parameters. It is possible to specify a default collation for a stylesheet module using the `default-collation` attribute on the `xsl:stylesheet` element, but note that this will affect other operations besides sorting.

From this release, the `saxon:collation` declaration is deprecated, and the `default` attribute of this declaration is ignored.

XSLT: Validation of Namespace URIs

XSLT error codes XTDE0835 and XTDE0865 are now detected and reported. This means that it is an error to supply a value for the `namespace` attribute of `xsl:element` or `xsl:attribute` that is not a valid URI. Note that this represents a backwards incompatibility from previous Saxon releases and from the XSLT 1.0 specification, which explicitly stated that supplying an invalid URI was not an error.

Similarly the `xsl:namespace` instruction now raises error `XDTE0905` if the constructed namespace node has a string value that is not a valid URI.

Next