David,

the required behaviour for a XSLT processor is to escape all '&' and '<'
characters when outputting HTML (with a few exceptions, see Chapter 16
of the XSLT spec). The seemingly untranslated entity references are
actually translated twice. 

I don't think references like &lt; or &amp; break the resulting HTML;
the browser should understand them. If you still need to get those
characters in the output, try using <xsl:text
disable-output-escaping="yes">. 

To use the text output method, the correct setting for the method
attribute on <xsl:output> is "text", not "txt". The error reported by
Sablotron is incorrect though.

Tom Kaiser


"Schuetz, David" wrote:
> 
> Okay, I tried putting an <xsl:output method="html"/> tag into my stylesheet,
> but it still isn't translating &lt; and &amp;.  Also, if I change the method
> to "txt" I get an error ("conflicting attribute 'method' on xsl:output,
> using last").
> 
> Here're my test files....
> 
> % cat /tmp/t.xsl
> <?xml version="1.0"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0">
> <xsl:output method="html" encoding="utf-8"/>
> 
> <xsl:template match="/text">
>   <HTML>
>   this is a test of &lt;, &gt; and &amp;.
>   </HTML>
> 
> </xsl:template>
> 
> </xsl:stylesheet>
> 
> % cat /tmp/t.xml
> <?xml  version="1.0" encoding="utf-8"?>
> <text>
> this is a test
> </text>
> 
> % sabcmd /tmp/t.xsl /tmp/t.xml
> <HTML>
>   this is a test of &lt;, > and &amp;.
>   </HTML>
> 
> %
> 
> I'm sure I'm missing something simple here, but I'm just not familar enough
> with Sablotron (or, admittedly, XML/XSL) to spot it.
> 
> Thanks again, all!
> 
> david.



Reply via email to