O'Reilly logo

Sams Teach Yourself XML in 10 Minutes by Andrew H. Watt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Conditional Processing and Sorting Data

As you saw in Chapter 11, “XSLT—Transforming XML Structure,” an XML document may not be in the precise form that you want to work with. In addition to providing tools to copy or to create new elements and attributes, XSLT provides tools to process data according to criteria that you set. Among the important functionality that XSLT provides is the capability to process elements (or not) based on criteria that you define or to sort data according to criteria that you specify.

Many programming languages have if ... then ... else statements or similar constructs. In XSLT, you can use the xsl:if element for similar purposes. For more complicated choices, conventional programming languages have a switch/case ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required