Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

XSLT Element

XSLT xsl:otherwise Element


XSLT Element Reference Manual Complete XSLT Element Reference Manual


Definition and Usage

xsl:otherwise The element specifies xsl:choose the default action of the element. When no xsl:when conditions apply, this action occurs.


Syntax

xsl:otherwise

property

None

Example 1

The code below adds a pink background color to the artist column when the price of a cd is greater than 10; otherwise it simply outputs the artist's name:

xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

My CD Collection

xsl:choose

xsl:otherwise

Title Artist

View the XML file、 View the XSL file、 View the result。

Example 2

Declares a variable named "color". Its value is assigned to the color attribute of the current element. If the current element has no color attribute, the value of "color" will be "green":

xsl:choose

xsl:otherwisegreen


XSLT Element Reference Manual Complete XSLT Element Reference Manual