|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Yet Another Entity Ref question!
Hi,
I'd like to produce an entity reference, say "©", from XML to HTML
through XSLT; here below I have summarized the problem with an example:
XML
<?xml version="1.0"?>
<doc>
<label>Foobar<entity>copy</entity></label>
</doc>
XSL:
<?xml version="1.0"?>
<xsl:stylesheet
version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" media-type="text/html" encoding="ISO-8859-1"/>
<xsl:template match="doc">
<xsl:apply-templates select="label" /> <!-- ok! -->
<xsl:variable name="label">
<xsl:apply-templates select="label" />
</xsl:variable>
<xsl:value-of select="$label" /> <!-- not ok -->
<xsl:value-of disable-output-escaping="yes" select="$label" /> <!-- ok
-->
</xsl:template>
<xsl:template match="entity">
<xsl:text
disable-output-escaping="yes"><![CDATA[&]]></xsl:text><xsl:value-of
select="." /><xsl:text>;</xsl:text>
</xsl:template>
</xsl:stylesheet>
So, if I use $label I have to disable escaping to get what I want.
I try to look for this problem on FAQ but I didn't find any interesting
solution.
Has anyone a better solution?
Thanks in advance!
--------------------------------
Marco Guazzone
Software Engineer
Kerbero S.r.L. - Gruppo TC
Viale Forlanini, 36
Garbagnate M.se (MI)
20024 - Italy
mail: marco.guazzone@xxxxxxxxxxx
www: http://www.kerbero.com
Tel. +39 02 99514.247
Fax. +39 02 99514.399
--------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








