XSLT <xsl:fallback>Element
Complete XSLT Element Reference
Definition and Usage
The <xsl:fallback> element specifies the alternate code to run when the XSL processor does not support an XSL element.
Syntax
<xsl:fallback>
<!-- Content: template -->
</xsl:fallback>
<!-- Content: template -->
</xsl:fallback>
Attributes
None
Example 1
This example was originally intended to use a fictional <xsl:loop> element to loop through each "title" element. If the XSL processor does not support this element (and it indeed does not), it will use the <:xsl:for-each> element instead:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="catalog/cd">
<xsl:loop select="title">
<xsl:fallback>
<xsl:for-each select="title">
<xsl:value-of select="."/>
</xsl:for-each>
</xsl:fallback>
</xsl:loop>
</xsl:template>
</xsl:stylesheet>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="catalog/cd">
<xsl:loop select="title">
<xsl:fallback>
<xsl:for-each select="title">
<xsl:value-of select="."/>
</xsl:for-each>
</xsl:fallback>
</xsl:loop>
</xsl:template>
</xsl:stylesheet>
Complete XSLT Element Reference Other Extensions