xsl:template
xsl:import
ELEMENT: xsl:fallback
<xsl:fallback>
</xsl:fallback>
The
xsl:fallback
element is designed to provide fallback code that can be run as an alternative when an XSLT processor fails to support an element.
Normally, when an XSLT element is not recognized by the XSLT processor an error occurs. The concept behind the
xsl:fallback
element is to provide a mechanism that will allow a procedure to keep running whenever an XSLT element is encountered that is not supported by an XSLT processor. For example, view these
Microsoft proprietary elements.
Undoubtedly, as XSLT becomes more mainstream, additional proprietary elements will become more common. A similar problem may also arise as newer and newer versions of XSLT become available and various elements are added or removed from the standard.
In the future, it may become commonplace to use the
xsl:fallback
element as a means of insuring portability between different browsers and XSLT processors.
This element has no attributes.
This is not a self-closing element. The separate closing element is mandatory.
We use the
DevGuru Staff List XML file
for our example with the following header:
<?xml-stylesheet type="text/xsl" href="xslt_example_fallback.xsl"?>
and we name it: xslt_example_fallback.xml
We try to use the
xsl:list-name
element in XML version 5.0.
Code for xslt_example_fallback.xsl:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="5.0">
<xsl:template match="/">
<html>
<body>
<xsl:list-name>
<
xsl:fallback
>
<xsl:for-each select="devguru_staff/programmer">
NAME: <xsl:value-of select="name" />
<br />
</xsl:for-each>
<
/xsl:fallback
>
</xsl:list-name>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Output:
Click to view output in separate window
- requires Internet Explorer
Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information