XSLT <xsl:fallback>要素
完全な XSLT 要素リファレンス
定義と使い方
<xsl:fallback> 要素は、XSL プロセッサが XSL 要素をサポートしていない場合に実行される代替コードを指定します。
構文
<xsl:fallback>
<!-- Content: template -->
</xsl:fallback>
<!-- Content: template -->
</xsl:fallback>
属性
无
例 1
この例は本来、架空の <xsl:loop> 要素を使用して各「title」要素をループするためのものです。XSL プロセッサがその要素をサポートしない場合(実際にはサポートされません)、その代わりに <:xsl:for-each> 要素が使用されます。
<?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>
完全な XSLT 要素リファレンス その他の拡張機能