Read XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition Online
Authors: Michael Kay
Usage
If your stylesheet only uses features from XSLT 1.0, it is probably best to specify
version=“1.0”
on the
If the stylesheet uses 2.0 features, you should specify
version=“2.0”
on the
version=“1.0”
at the start of the principal stylesheet module is supposed to give you a warning about possible incompatibilities and then process the stylesheet as if it were a 2.0 stylesheet, but with backward-compatibility mode switched on. (This doesn't guarantee 100% compatibility, but it's pretty close.)
If your stylesheet says
version=“1.0”
this won't stop you from using XSLT 2.0 features; an XSLT 2.0 processor isn't expected to look at every construct you use and decide whether it would have been allowed in XSLT 1.0. But for certain specific features, it causes XSLT 2.0 and XPath 2.0 to behave differently. The main examples of this is the “first item” rule mentioned earlier, where XSLT 1.0 takes the first item of a sequence and ignores the rest. This is most commonly encountered with the
10 div 0
gives you Infinity in backward-compatibility mode, but throws an error in 2.0 mode.
XSLT 2.0 allows you to put the
version
attribute on any element in the stylesheet, and at first sight a nice idea would be to flag any template rule that uses XSLT 2.0 features by labeling it with the attribute
version=“2.0”
. Unfortunately, however, XSLT 1.0 doesn't allow the
version
attribute to appear on the
version=“2.0”
at the