XSLT <xsl:텍스트>
❮ 완전한 XSLT 요소 참조
정의 및 사용
<xsl:text> 요소는 리터럴 텍스트를 출력에 쓰는 데 사용됩니다.
팁: 이 요소에는 리터럴 텍스트, 엔터티 참조 및 #PCDATA가 포함될 수 있습니다.
통사론
<xsl:text
disable-output-escaping="yes|no">
<!-- Content:#PCDATA -->
</xsl:text>
속성
Attribute | Value | Description |
---|---|---|
disable-output-escaping | yes no |
Optional. "yes" indicates that special characters (like
"<") should be output as is. "no" indicates that special characters (like
"<") should be output as "<". Default is "no". This attribute is not supported by Netscape 6 |
실시예 1
각 CD의 제목을 표시합니다. 마지막 CD가 아니거나 마지막 CD가 아닌 경우 각 CD 제목 사이에 ","를 삽입합니다. 마지막 CD인 경우 "!"가 추가됩니다. 제목 뒤에. 마지막이 아닌 하나인 경우 제목 뒤에 ","를 추가합니다.
<?xml version="1.0" encoding="UTF-8"?>
<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>
❮ 완전한 XSLT 요소 참조