XSLT <xsl:fallback> Element

Definition and Usage

The <xsl:fallback> element specifies the alternate code to be executed when the XSL processor does not support the XSL element.

Syntax

<xsl:fallback>
<!-- Content: template -->
</xsl:fallback>

Attribute

None

Instance

Example 1

This example was supposed to use a fictional <xsl:loop> element to iterate over each "title" element. If the XSL processor does not support the element (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>