# XSLT changes

The `xsl:sequence` instruction can no longer contain a sequence constructor. Specifically, it must have no content other than (optionally) one or more `xsl:fallback` instructions. This is a change agreed by the Working Group since the November 2003 drafts were published.

The `xsl:perform-sort` instruction can now contain a sequence constructor as an alternative to a `select` attribute.

The `xsl:sort` element can now contain a sequence constructor as an alternative to a `select` attribute.

A check has been added that within `xsl:for-each` and `xsl:for-each-group`, any `xsl:sort` elements appear before any other instructions. This enforces a rule in XSLT 1.0 and XSLT 2.0 that was previously not enforced.

The `xsl:key` element may now have a content constructor to evaluate the key value, in place of the `use` attribute.

The `[xsl:]inherit-namespaces` attribute is implemented on `xsl:element`, `xsl:copy`, and literal result elements. By default, the namespace nodes on a constructed element are inherited by its children. Setting this attribute to "no" prevents this. The difference will not usually be noticeable unless the result document is serialized with `version="1.1" undeclare-namespaces="yes"`.

The `xsl:result-document` instruction may now take serialization attributes such as `method`, `indent`, or `saxon:indent-spaces`. These attributes may be AVTs, so the values can be decided at run-time. Any values specified on the `xsl:result-document` instruction override the values specified on the `xsl:output` declaration.

Zero-length text nodes can now be constructed. They disappear when added as a child node of an element, but can exist so long as they are parentless. This means, for example, that a function whose body evaluates three `xsl:value-of` instructions will always return a sequence of three text nodes, regardless of the actual values.

A dynamic error that occurs while evaluating a predicate in a match pattern is now treated as a recoverable error. By default, a warning is output, and execution continues as if the predicate returned false. (Previous releases of Saxon recovered silently from this error without reporting it; previous versions of the XSLT specification treated the error as fatal. The product is now aligned with the specification.)

When `xsl:call-template` specifies a parameter using `xsl:with-param` for which there is no corresponding parameter declared in the called template, no error is reported if the call-template instruction is in backwards compatible mode, that is if the `version` attribute is equal to "1.0".

A document node can now be copied using `xsl:copy` or `xsl:copy-of`. If the destination is a tree, copying the document node has the same effect as copying its children. But it the destination is a sequence, the document node itself is copied.

Next