Easy Tutorial
❮ Func Key Func Systemproperty ❯

XSLT <xsl:choose> Element



Definition and Usage

The <xsl:choose> element works in conjunction with <xsl:when> and <xsl:otherwise> to express multiple conditional tests.

If no <xsl:when> is true, the content of <xsl:otherwise> is processed.

If no <xsl:when> is true and the <xsl:otherwise> element is not present, no content is created.

Tip: For simple conditional tests, use the <xsl:if> element instead.


Syntax

Attributes

None


Examples

The following code adds a pink background color to the artist column if the price of the CD is above 10.

Example

Declare a variable named "color". Assign the value of this variable to the color attribute of the current element. If the current element does not have a color attribute, the value of "color" is "green":


❮ Func Key Func Systemproperty ❯