RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


Peek Into the Future of XSLT 2.0

XSLT 2.0 provides powerful new features that XSLT 1.0 was missing. Although XSLT 2.0 is still under development, Mike Kay's Saxon 7 implementation lets you experiment with the new capabilities now.


xtensible Stylesheet Transformations, or XSLT, has received decidedly mixed reviews from developers. Although XSLT has many evangelists it has its detractors as well. Because of some concepts, such as static variables. XSLT's learning curve can also be a bit steep, particularly for some of the more complex transformations.

Many of the problems stem from a fundamental lack of understanding about how the language works. Primarily through Mulberry's XSL-List, the XSLT developer community has gone to great lengths to educate developers on how to use XSLT.

XSLT is beginning to take root into a large base across the enterprise. So what happens? Just as developers begin to get comfortable with XSLT, XSLT 2.0 and XPath 2.0 begin to creep up on them from around the corner.

And it's fair to say that XSLT 2.0 is not your mother's XSLT. In fact, XSLT 2.0, XPath 2.0, and XQuery are now so interconnected that if you master one, you can easily master them all. So when you're done with this article, make a note to yourself to study XPath 2.0 when it receives formal recommendation status as a standard from the W3C.

This article will introduce you to some of the most interesting core concepts of XSLT 2.0 and its companion, XPath 2.0. While it doesn't cover all the changes to these languages, it will introduce you to the most interesting new features. The brief example at the end of this article may help to tie some of this information together. To run the examples, you'll need to download the sample code. You should also read the sidebar How to Get XSLT 2.0 for more information on how to get the latest version.

To run the samples, unzip the archive, making sure everything is in the same directory. Then launch Saxon.html from your browser. You'll see four frames (see Figure 1). The top frame contains text boxes so you can specify the files you wish to transform. Type the name of the source XML file in the first text box, the name of the XSLT file in the second text box, and click the Transform button. The three lower frames then display the source document, the XSLT, and the transformation, respectively, displayed either as HTML source or as it should appear in your browser, depending on which radio button you choose when you click Transform. If you don't see the text boxes, drag the lower edge of the top frame down with your mouse until they appear.

Figure 1: When you browse to the file Saxon.html, your browser should look something like this. You may need to adjust the height of the top frame to see the text fields.

Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date