XSLT <xsl:text> 요소

정의 및 사용법

<xsl:text> 요소는 출력에 텍스트를 쓰기 위해 사용되며, 스타일 시트를 통해 텍스트 노드를 생성합니다.

ヒント:이 요소는 텍스트, 엔티티 참조, 및 #PCDATA를 포함할 수 있습니다.

문법

<xsl:text disable-output-escaping="yes|no">
  <!-- Content:#PCDATA -->
</xsl:text>

속성

속성 설명
disable-output-escaping
  • yes
  • no

선택 사항입니다. 기본 값은 "no"입니다.

值为 "yes" 일 경우, <xsl:text> 요소를 인스턴스화하여 생성된 텍스트 노드는 출력 시 어떠한 탈출 처리도 하지 않습니다.

예를 들어 설정이 "yes"로 되어 있다면 "<"는 변환되지 않습니다。

设置为 "no" 으로 설정되면 "<"로 출력됩니다。

Netscape 6는 이 속성을 지원하지 않습니다.

실例

예제 1

각 CD의 title을 표시합니다. 마지막이나 마지막 두 번째 CD가 아니라면 각 cd-title 사이에 ", "를 삽입합니다. 마지막 CD라면 title 뒤에 "!"를 추가합니다. 마지막 두 번째 CD라면 title 뒤에 ", and "를 추가합니다:

<?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="/">
  <html>
  <body>
    <h2>My CD Collection</h2>
    <p>Titles:
    <xsl:for-each select="catalog/cd">
      <xsl:value-of select="title"/>
      <xsl:if test="position() < last()-1">
        <xsl:text>, </xsl:text>
      </xsl:if>
      <xsl:if test="position()=last()-1">
        <xsl:text>, and </xsl:text>
      </xsl:if>
      <xsl:if test="position()=last()">
        <xsl:text>!</xsl:text>
      </xsl:if>
    </xsl:for-each>
    </p>
  </body>
  </html>
</xsl:template>
</xsl:stylesheet>