Multiple choices

When one option is to be selected from a number of possible options, the If element can be used repeatedly. But, the fact that each If element is independent of the others can be inconvenient in some circumstances. It is not possible to prevent more than one of the tests from succeeding (if this is desired), and it is not possible to take specific action if none is triggered. Both of these constraints could be overcome if a set of tests could be treated as a group.

The Choose element encloses a number of alternative fragments of the template that should apply under different circumstances. Each alternative is defined using the When element, which works in exactly the same way as the If element described previously. The condition ...

Get XSL companion, The 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.