This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: How to read the encoding of an XML document
At 05:41 PM 10/24/2001 -0400, Wendell Piez wrote:
>> <?xml version="1.0" encoding="ISO-8859-1"?>
>>What XSL do I use to read the value of the encoding attribute?
>
>You can't. It's not an attribute. (And it's not in a processing
>instruction. It's in the XML declaration, which is formally not part of
>the document, but only helps the parser know what to expect.)
Well, that would explain my failure to extract the data. :-)
>Why do you want to know the encoding? Someone might have another approach
>to the problem.
I am getting XML documents from multiple European countries. I am
expecting that some or all of them will use different encoding sets,
depending upon their language. I would like to use XSL to transform the
documents, both to XML and HTML.
In XML, I was planning to have the same encoding set that was found in the
original document.
In HTML, I was planning to use the same encoding set in the META tag, so
the browser knows how to display it.
< HEAD >
< META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" >
< /HEAD >
--James Garriss
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list