XML Tutorial/XSLT stylesheet/character map
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>