Conditionals

Now that we've begun to take control of the flow of our document by using looping, it's time to take even tighter control by adapting to the data itself.

We can output different data and differently formatted data based on the data itself. In this case, we're going to use the webvendor attribute of the vendor elements, displaying all information for vendors with a webvendor attribute of full, displaying only some information for those with a webvendor attribute of partial, and not displaying at all those with a webvendor attribute of no.

This last is easy. In Listing 2.28, we'll instruct the processor not to output any text unless the webvendor attribute is something other than “no.”

Listing 2.28. catalog.xsl: A Simple Conditional ...

Get XML and Java™ from scratch now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.