xsl:otherwise

Used within an xsl:choose element to indicate the default action to be taken if none of the other choices matches. In XSLT 4.0, it may also appear within xsl:switch.

Content: sequence-constructor
Permitted parent elements: xsl:choose

Attributes

select?

expression

New in XSLT 4.0. Provides an alternative way of supplying the return value; if present, the contained sequence constructor must be empty.

Saxon availability

Available in XSLT 1.0 and later versions. Available in all Saxon editions. Available for all platforms.

Notes on the Saxon implementation

The select attribute is available from Saxon 13 in XSLT 4.0; it is available in Saxon 10 to 12 provided that syntax extensions are enabled.

Details

The new select attribute is available in XSLT 4.0. If the then attribute is present, the xsl:if instruction must be empty (have no children). Either attribute can be used independently; there is no requirement for both to be present.

Note that forwards-compatibility mode in previous versions of XSLT does not handle the select attribute particularly well. If an XSLT 3.0 processor encounters an xsl:otherwise instruction with a select attribute, and the instruction has an effective version of 4.0, the select attribute will simply be ignored, which will generally give incorrect results.

Links to W3C specifications

XSLT 3.0 Specification

XSLT 4.0 Specification

See also

xsl:choose

xsl:switch

xsl:when