Fallback Processing
The final part of XSLT’s extension mechanism uses the
<xsl:fallback>
element. This element is processed whenever an XSLT processor
doesn’t support the surrounding element. For example, the <xsl:result-document>
element is new in XSLT 2.0. We can put an <xsl:fallback> element inside <xsl:result-document>. If we pass the
stylesheet to an XSLT 1.0 processor, it won’t support the <xsl:result-document> element. The
XSLT 1.0 processor will look inside the <xsl:result-document> for an <xsl:fallback> element; if it finds
one, it will process the contents of <xsl:fallback>. As we’ll see a little
later in this chapter, <xsl:fallback> can itself contain
an <xsl:fallback> element. The <xsl:fallback> element gives the XSLT processor a
chance to respond gracefully when it can’t perform the requested
task.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access