xsl-list
[Top] [All Lists]

Re: change stylesheet encoding

2004-05-14 15:00:16

I was wondering what is the best way to change the encoding in the
processing statement for an XSL stylesheet.

It's just an XML file so any xml encoding method should work, 
I tend to use xsl for that, if you want the stylesheet to be written in
latin 1 transform it with

<xsl:styleseet...

<xsl:output encoding="iso-8859-1"/>

<xsl:template match="/">
<xsl:copy-of select="."/>
</xsl:template>
</xsl:stylesheet>


I am concerned about users with xml documents with other encodings
trying to use the stylesheet.

Huh??? The encoding used in the stylesheet is totally irrelevant to all
processing. Except if you choose to write yue your stylesheet in an
encoding that an XML parser does not know, there will be no processing
at all. Every parser will accept utf8 (or ascii pretending to be utf8)
but if you make it latin1 then any system may reject it.

I originally wrote the stylesheet for UTF-8.
You are wording that as if you mean you wrote it for utf8 documents, but
xslt can't even see the original document encoding the encodings used in
the stylesheet and in the documents are all resolved before xslt starts.

There are some UTF-8 NCRs in it
(&amp;#xA;, &amp;#x20;), but that is about it.

NCRs have nothing to do with utf8, thge numbers are unicode code points
and you'd use the same numbers whatever encoding the file was in.


Is there a good way to check the character set in a stylesheet in
order to change it to another encoding?
The stylesheet above will change the encoding without knowing the
original encoding.

Specifically, I would like to change UTF-8 to ISO-8859-1.
The only effect this can have on the xslt stylesheet is to potentially
reduce the number of systems on which it runs. 

David

-- 
The LaTeX Companion
  http://www.awprofessional.com/bookstore/product.asp?isbn=0201362996
  http://www.amazon.co.uk/exec/obidos/tg/detail/-/0201362996/202-7257897-0619804


________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________


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