<html>
<head>
<title>&lt;xsl:fallback&gt;</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div id="Description">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="NAME">&lt;xsl:fallback&gt;</td>
<td valign="top" class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td valign="top" colspan="2" class="description">
Defines a template that should be used when an extension element can't be found. </td></tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Category</td>
</tr>
<tr>
<td colspan="2" class="description">
<p>Instruction</p>
</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Required Attributes</td>
</tr>
<tr>
<td colspan="2" class="description">
<p>None.</p>

</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Optional Attributes</td>
</tr>
<tr>
<td colspan="2" class="description">
<p>None.</p>
</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Content</td>
</tr>
<tr>
<td colspan="2" class="description">
<p>An XSLT template.</p>
</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Appears in</td>
</tr>
<tr>
<td colspan="2" class="description">
<p>
<span class="LITERAL">&lt;xsl:fallback&gt;</span> appears inside a template.</p>
</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Defined in</td>
</tr>
<tr>
<td colspan="2" class="description">
<p>XSLT section 15, Fallback.</p>
</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Example</td>
</tr>
<tr>
<td colspan="2" class="description">
<p>Here is a stylesheet that uses <span class="LITERAL">&lt;xsl:fallback&gt;</span> to terminate the transformation if an extension element can't be found:</p>
<span class="PROGRAMLISTING"><pre>
&lt;?xml version="1.0"?&gt;
&lt;xsl:stylesheet version="1.0" 
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:db="xalan://DatabaseExtension"
  extension-element-prefixes="db"&gt;

  &lt;xsl:output method="html"/&gt;

  &lt;xsl:template match="/"&gt;
    &lt;html&gt;
      &lt;head&gt;
        &lt;title&gt;&lt;xsl:value-of select="report/title"/&gt;&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
        &lt;h1&gt;&lt;xsl:value-of select="report/title"/&gt;&lt;/h1&gt;
        &lt;xsl:for-each select="report/section"&gt;
          &lt;h2&gt;&lt;xsl:value-of select="title"/&gt;&lt;/h2&gt;
          &lt;xsl:for-each select="dbaccess"&gt;
            &lt;db:accessDatabase&gt;
              &lt;xsl:fallback&gt;
                &lt;xsl:message terminate="yes"&gt;
                  Database library not available!
                &lt;/xsl:message&gt;
              &lt;/xsl:fallback&gt; 
            &lt;/db:accessDatabase&gt;
          &lt;/xsl:for-each&gt;
        &lt;/xsl:for-each&gt;
      &lt;/body&gt;
    &lt;/html&gt;
  &lt;/xsl:template&gt;

&lt;/xsl:stylesheet&gt;</pre></span>
<!--<?troff .Nd 10?>-->
<p>When we use this stylesheet to transform a document, the <span class="LITERAL">&lt;xsl:fallback&gt;</span> element is processed if the extension element can't be found:</p>
<span class="PROGRAMLISTING"><pre>

Database library not available!

Processing terminated using xsl:message</pre></span>
<p>In this case, the extension element is the Java class <span class="LITERAL">DatabaseExtension</span>. If, for whatever reason, that class can't be loaded, the <span class="LITERAL">&lt;xsl:fallback&gt;</span> element is processed. Note that the <span class="LITERAL">&lt;xsl:fallback&gt;</span> element is processed only when the extension element can't be found; if the code that implements that extension element is found, but fails, it must be handled some other way. Also be aware that the exact format of the message and the gracefulness of stylesheet termination will vary from one XSLT processor to the next. </p>
</td>
</tr>
</table>
</div>
</body>
</html>