Changes in XSLT 2.0


The syntax of patterns is probably the area of the specification that has changed least between XSLT 1.0 and XSLT 2.0. However, because many capabilities of patterns are picked up implicitly by virtue of the way they are defined in terms of expressions, they benefit automatically from many of the new features in XPath 2.0.

The most notable facility this introduces is the ability to match nodes according to their schema-defined type. For example, you can match all date-valued attributes with the pattern «match="attribute(*, xs:date)" » , and you can match all elements in the substitution group of the event element with the pattern «match="schema-element(event)" » .

There are also some changes in the semantics of patterns, designed to cope with the complications introduced by parentless element and attribute nodes.

In XSLT 1.0 there were three restrictions on the content of a predicate used in a pattern. All three restrictions have been removed in XSLT 2.0.

  • When a pattern was used in the match attribute of <xsl:template> or <xsl:key> , the predicate was not allowed to contain any references to variables . This was to prevent circular definitions. XSLT 2.0 allows variable references, provided that they do not introduce a circular definition.

  • For the same reasons, when a pattern was used in the match attribute of <xsl:template> or <xsl:key> , XSLT 1.0 did not allow the predicate to use the key() function. Again, this rule has been replaced with a more permissive rule that says you can use the key() function provided it doesn't introduce a circularity.

  • In XSLT 1.0, patterns were not allowed to use the current() function (described on page 526 in Chapter 7) within a predicate. XSLT 2.0 allows this, and defines that within a pattern, current() refers to the node that is being tested against the pattern.




XSLT 2.0 Programmer's Reference
NetBeansв„ў IDE Field Guide: Developing Desktop, Web, Enterprise, and Mobile Applications (2nd Edition)
ISBN: 764569090
EAN: 2147483647
Year: 2003
Pages: 324

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net