his article demonstrates many of the new features of XPath 2.0 and XSLT
2.0. Three interesting new features in XPath 2.0 and XSLT 2.0 are the
'item' data type, the 'to' operator, and the concept of sequences. Here
we build a sample application that uses these features to generate a
sophisticated HTML view of an XML document, and with the new features
in XSLT 2.0, create shorter stylesheets that are easier to maintain.
Along the way, we spend a bit of time on data typing in XSLT 2.0 and
learn to use the new 'xsl:function' element. In this sample application,
we take an unwieldy stylesheet and refactor it into a much smaller and
more maintainable piece of code. One of the major new concepts in XPath
2.0 and XSLT 2.0 is that everything is a sequence. In XPath 1.0 and XSLT
1.0, you typically worked with trees of nodes. The parsed XML document
was a tree that contained the document node and its descendants. Using
that tree of nodes, you could find the node for the root element, along
with all of the root element's descendants, attributes, and siblings.
Any comments or processing instructions outside the root element of the
XML file are considered siblings of the root element. When you work with
an XML document in XPath 2.0 and XSLT 2.0, you use the sequence in the
same way as the tree structure in XPath 1.0 and XSLT 1.0. The sequence
contains a single item (the document node), and you use it the same way
you always have. However, you can create sequences of atomic values.
In sample application for this article, you manage the data for a 16-team
single-elimination tournament. For Further Information CLICK HERE
1 comment:
Well written article.
Post a Comment