This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Dealing With Unwanted Characters
- To: Bryan Tulloch <b dot tulloch at solicitec dot com>
- Subject: Re: [xsl] Dealing With Unwanted Characters
- From: Jeni Tennison <mail at jenitennison dot com>
- Date: Wed, 25 Jul 2001 09:59:20 +0100
- CC: "'xsl-list at lists dot mulberrytech dot com'" <xsl-list at lists dot mulberrytech dot com>
- Organization: Jeni Tennison Consulting Ltd
- References: <8A7515596578D511BCDD00B0D0D0F46A0CFE3C@EXCHANGE>
- Reply-To: xsl-list at lists dot mulberrytech dot com
Hi Bryan,
> I am handling an XML file that has a number of '£' characters within
> the text nodes. These are causing difficulties when I try to display
> the output in IE 5 - a message appears telling me that these
> characters are invalid. Anything I can do in my xsl to overcome
> this, or do I need to do something (if so, what?) to my xml (apart
> from removing the '£' from the source xml, which I have no power to
> do)?
The reason that IE is objecting is because the character encoding
that's been used to save the document is not the same as the character
encoding declared (or left undeclared) for the document. Given that it
contains '£' signs, most likely you have an XML declaration like:
<?xml version="1.0"?>
which indicates that the file is saved in UTF-8, whereas it's actually
been saved in ISO-8859-1. You need to either change the XML
declaration to:
<?xml version="1.0" encoding="ISO-8859-1"?>
or go through the document and change all the '£' characters into the
character reference £.
If you cannot change the source document at all, then you're pretty
much stuck. XSLT can only work with well-formed XML documents, and a
document that contains '£' characters without the proper encoding is
not a well-formed XML document.
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list