XSLT <xsl:otherwise>
Element
Definition and Usage
The <xsl:otherwise>
element specifies the default action for the <xsl:choose>
element. This action occurs when no <xsl:when>
condition is applied.
Syntax
Attributes
None
Example 1
The following code will add a pink background color to the artist column if the price of the cd is higher than 10, otherwise, it will simply output the artist's name:
View XML File, View XSL File, View Result.
Example 2
Declare a variable named "color". Assign its value to the color attribute of the current element. If the current element does not have a color attribute, the value of "color" will be "green":