XML Tutorial/XSLT stylesheet/character map — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Текущая версия на 11:27, 26 мая 2010
character-map
<source lang="xml">
File: Transform.xslt <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" use-character-maps="sample"/> <xsl:character-map name="sample" use-character-maps="circles"> <xsl:output-character character=" " string=" "/> </xsl:character-map> <xsl:character-map name="circles"> <xsl:output-character character="➀" string="<img src="images/circle1.gif" width="28" height="28"/>"/> <xsl:output-character character="➁" string="<img src="images/circle2.gif" width="28" height="28"/>"/> </xsl:character-map> <xsl:template match="char-test"> <html> <head> <title>title</title> </head> <body> <xsl:apply-templates select="*"/> </body> </html> </xsl:template> <xsl:template match="tabs">
<xsl:value-of select="."/>
</xsl:template> <xsl:template match="special-char">
<xsl:text>Here"s a special character: </xsl:text> <xsl:value-of select="."/>
</xsl:template>
</xsl:stylesheet></source>