XML & XSL - xsl:when
Multiple conditional testing in conjunction with the xsl:otherwise
and xsl:choose.
Syntax
<xsl:when expr="script-expression" language="language-name" test="pattern">
Attributes
- expr - script expression which evaluates to a Boolean. If the expression returns TRUE, and the test pattern succeeds, the contents of xsl:when are placed in the output. If one of these tests fails, the next xsl:when or xsl:otherwise in the xsl:choose block is tested.
- language - the scripting language used for the expression in the expr attribute. If left unspecified, the current scripting language is used, as specified by a language attribute on an ancestor. JScript is the default.
- test - XSL parse pattern.
Parent Elements
Child Elements
Purpose
One of the alternatives to be chosen by the xsl:choose.
The alternative is xsl:otherwise element.
Use the xsl:if for simple conditional testing.
Global Population Extraction Example
Click here to view an example.