Chapter 5. Making Choices and Sorting Data

Chapter 5. Making Choices and Sorting Data

graphics/chic01.gif

This chapter is all about making choices, sorting, and handling the data in XML documents in various ways. Here, youll see the <xsl:if> , <xsl:choose> , <xsl:when> , <xsl: otherwise > , <xsl:for-each> , and <xsl: sort > elements. You can use these elements to handle your data, making choices on how transformations should proceed depending on the value of that data.

However, these elements dont offer anything like the precision that a programming language does. For that reason, I also introduce XSLT extensions in this chapter, including the XSLT 1.1 working draft <xsl:script> element. This element was intended to make it easy to use Java or JavaScript with an XSLT processor. (Its not necessary to understand Java or JavaScript to read this book, but if you know these languages, its good to know that some XSLT processors offer you the chance to use them while transforming XML.) Something like this element will surely appear in XSLT 2.0. With extensions, you can extend the XSLT specification by adding new elements and functions of your own or some vendors design to XSLT.

Youll also see how to number elements in documents in this chapter, what to do if your XSLT processor doesnt support a particular extension, and more. I begin with the most frequently used of the elements youll see in this chapter <xsl:if> .



Inside XSLT
Inside Xslt
ISBN: B0031W8M4K
EAN: N/A
Year: 2005
Pages: 196

Similar book on Amazon

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