XML technologies / XSLT / Introduction to XSLT 2.0 / XSLT and XPath – round two / Conditions with XSLT and XPath
(Excerpt from "XSLT 2.0 & XPath 2.0" by Frank Bongers, Chapter 2.)
Now that a sequence’s composition can be filtered selectively, we still need to vary the processing of its items within a template rule according to specific criteria. Programming languages provide familiar IF-THEN-ELSE choices. Comparable structures in XSLT stylesheets let the content of the XML document control processing, for example through particular values, the presence of child elements or attributes, or other conditions.
A test is always performed using an XPath expression that produces a Boolean value, as with the predicates just discussed. This test determines how the decision block is processed. XSLT has two basic forms: the simple xsl:if and the more complex xsl:choose.
Copyright © Galileo Press, Bonn 2008
You may print the online version for your private use.
Otherwise, this chapter from "XSLT 2.0 & XPath 2.0 ― Das umfassende Handbuch" is subject to the same terms as the printed edition: the work and all its parts are protected by copyright. All rights are reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
Galileo Press, Rheinwerkallee 4, 53227 Bonn