xsl:fallback
Provides fallback behavior when the surrounding instruction is not recognized by the processor.
<xsl:some-future-instruction>
<xsl:fallback>
<xsl:message>not supported</xsl:message>
</xsl:fallback>
</xsl:some-future-instruction>If a stylesheet is processed by an XSLT processor that doesn’t know about a given instruction, that instruction’s body is normally an error. By placing an xsl:fallback child inside, the stylesheet can supply a workaround that runs when the parent is unknown. If the parent is recognized, xsl:fallback is ignored.
This makes stylesheets forward-compatible: an XSLT 4.0 instruction can be used together with an xsl:fallback containing an XSLT 3.0 alternative.
Attributes
None.
Example
Polyfilling a hypothetical instruction:
<xsl:future-format value="$x">
<xsl:fallback>
<xsl:value-of select="format-number($x, '#,##0.00')"/>
</xsl:fallback>
</xsl:future-format>