| Subject: [xsl] Yet Another Entity Ref question! From: Marco Guazzone <sguazt@xxxxxxxxxxx> Date: Thu, 19 Dec 2002 20:29:08 +0100 (CET) | 
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
| Current Thread | 
|---|
| 
 | 
| <- Previous | Index | Next -> | 
|---|---|---|
| RE: [xsl] Passing parameters to XSL, NIENKE, Bill P. - AC | Thread | Re: [xsl] Yet Another Entity Ref qu, Mike Brown | 
| RE: [xsl] Passing parameters to XSL, NIENKE, Bill P. - AC | Date | [xsl] German character set problem(, Andreas Schlegel | 
| Month |