Re: [xslt] Use character entities to represent non-ASCII characters



Hi Nick,

 

You are right. I didn’t notice that our output element specified HTML as the output method but UTF-8 as the encoding.. Changing the encoding to HTML fixes the problem.

 

So libxslt is doing exactly what it is supposed to do.

 

Now I have to figure out why JAXP is ignoring the encoding spec. Perhaps the app is somehow overriding the encoding specified in the stylesheet.

 

Is there a was with libxslt to override the output encoding specified by the stylesheet?

 

Regards,

 

Paul

 

From: Nick Wellnhofer <wellnhofer aevum de>
Sent: Monday, August 22, 2022 11:32 AM
To: Paul Kinnucan <paulk mathworks com>; The Gnome XSLT library mailing-list <xslt gnome org>
Subject: Re: [xslt] Use character entities to represent non-ASCII characters

 

On 22/08/2022 16:46, Paul Kinnucan wrote:
> Specifying HTML as the output type does not cause libxslt to generate ASCII with character entities for non-ASCII characters.

It works for me:

$ cat t.xsl
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="HTML"/>
<xsl:template match="/">
<p>£</p>
</xsl:template>
</xsl:stylesheet>
$ xsltproc t.xsl t.xsl
<p>&pound;</p>

Note that the output *encoding* must be set to "HTML".

Nick



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]