RE: [xsl] A sequence of more than one item is not allowed as the [nth] argument of [function]

Subject: RE: [xsl] A sequence of more than one item is not allowed as the [nth] argument of [function]
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Sun, 6 Mar 2005 23:39:57 -0000
> I shall put my question more simply as ..
> If <xsl:stylesheet version="1.0" is specified , and if
> the stylesheet uses some XSLT 2.0/XPath 2.0 constructs
> , then should the new constructs work - if I am using
> a XSLT 2.0 processor? (as shown in example above)..

Yes. We decided that it was unreasonable to expect an XSLT processor to know
the version of the language at which each feature was introduced, so that a
feature introduced in version N of the specification would be rejected if
the stylesheet specified version N-1. With only two versions this might just
be manageable, but it's not reasonable when the number of versions grows.
It's particularly difficult for an XSLT 2.0 processor to enforce 1.0
restrictions when these are semantic rather than syntactic, for example the
restrictions on the ways in which result tree fragments can be used, because
this requires extra information (outside the scope of the 2.0 data model) to
be maintained.

So specifying version="1.0" in a stylesheet does not prevent 2.0 constructs
being used; all it does is to switch on "backwards compatibility mode",
which affects the results of a certain number of XPath and XSLT constructs
when evaluated under a 2.0 processor.

It's possible that some products might include an XSLT 1.0 processor and an
XSLT 2.0 processor bundled in the same software package, and use the version
attribute to decide which processor to invoke. (The two "processors" could
also, of course, share the same source code.) In that case, specifying
version="1.0" would invoke a 1.0 processor and then, of course, 2.0
constructs would be rejected. Saxon doesn't work that way, however.

Michael Kay

Current Thread