1. How to use xsl:fallback


How to use xsl:fallback

Sebastian Rahtz

An example from Sebastian.

the saxon, xalan and lotusxsl XSLT processors also support a similar extension, and Oracle will do any day now.(5/00) you just have to write your XSLT code a little more defensively using fallback. here is an example from my TEI XSLT stylesheets

1  <xt:document method="html" href="{concat($ident,'.html')}">
2  <xsl:call-template name="docOut"/>
3  <xsl:fallback>
4    <saxon:output  method="html" file="{concat($ident,'.html')}">
5    <xsl:call-template name="docOut"/>
6      <xsl:fallback>
7         <xalan:write file="{concat($ident,'.html')}">
8             <xsl:call-template name="docOut"/>
9           <xsl:fallback>
10             <xsl:call-template name="docOut"/>
1 tries for an xt extension. If it is undefined
4 kicks in and tries a saxon extension. If it fails...
7 kicks in. If it fails 10 kicks in.

xsl:fallback children are activated if the *parent element* cannot work It could equally be rewritten as a choose structure using "element-available"