XSLT <xsl:text>
❮ Kompletní reference prvků XSLT
Definice a použití
Element <xsl:text> se používá k zápisu doslovného textu na výstup.
Tip: Tento prvek může obsahovat doslovný text, odkazy na entity a #PCDATA.
Syntax
<xsl:text
disable-output-escaping="yes|no">
<!-- Content:#PCDATA -->
</xsl:text>
Atributy
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 |
Příklad 1
Zobrazuje název každého CD. Vloží "," mezi každý titul CD, pokud to není poslední CD - nebo předposlední. Pokud je to poslední CD, přidá se "!" za titulem. Pokud je to předposlední, přidejte za nadpis „, a „:
<?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>
❮ Kompletní reference prvků XSLT