xsl-list
[Top] [All Lists]

Re: [xsl] XSLT 2.0: Character Output Issue

2007-07-18 09:21:38
Sam Byland wrote:

Our original XSLT has the following meta element output:

<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

So changing that to

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

fixes the problem with regards to the display when opened within MS Word.

You should not put such a meta element in your stylesheet, use xsl:output with method html and the intended output encoding and the XSLT processor will place the proper meta element in the HTML result when serializing the result tree.
--

Martin Honnen

Agreed (in general anyway). Notice I didn't put such an element into my simplified example. In the real stylesheet set I have to put it there or it doesn't end up in the output. I never got around to trying to figure out why this was the case since adding the meta element to the stylesheet fixed the problem. Note that my actual stylesheet is quite large (both in number of xsl files being imported/included and lines of code), using many modes etc. In this case, we have:

<xsl:result-document href="{$OutputFileName}" format="WordHTML">
   <xsl:apply-templates select="$ProcedureNodes" mode="Output">
       ...
   </xsl:apply-templates>
</xsl:result-document>

where the "Output" mode stylesheet code resides in another file where, after setting up several variables etc., it has:

<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word">
   <head>
<meta http-equiv='Content-Type' content="text/html; charset=windows-1252"/>
       <meta name='ProgId' content='Word.Document'/>
       <meta name='Generator' content="Microsoft Word 9"/>
       <meta name='Originator' content="Microsoft Word 9"/>
       ...and so on....

If I remove that first meta line, it doesn't appear in the output...

...sam


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>