XSLT <xsl: fallback> Element
Definicja i Wykorzystanie
<Xsl: fallback> określa kod alternatywny, gdy procesor XSL nie obsługuje elementów XSL, jest uruchomiony.
gramatyka
<xsl:fallback>
<!-- Content: template -->
</xsl:fallback>
<!-- Content: template -->
</xsl:fallback>
nieruchomość
nie
Przykład 1
W tym przypadku miało to wykorzystać fikcyjną <xsl: pętli> pętle przez każdy element "title" elementu. Jeśli procesor XSL nie obsługuje tego elementu (nie obsługuje), a następnie użyć <: xsl: for-each> elementem w zamian:
<?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>
<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>
Kompletna instrukcja XSLT element odniesienia