XSLT <xsl:fallback> 요소

정의와 사용법

<xsl:fallback> 요소는 XSL 처리기가 XSL 요소를 지원하지 않을 때 대체 코드를 실행하도록 정의합니다.

문법

<xsl:fallback>
<!-- Content: template -->
</xsl:fallback>

속성

None

예시

예제 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>