Re: [xsl] char entities problems with Xalan J

Subject: Re: [xsl] char entities problems with Xalan J
From: "Thomas B. Passin" <tpassin@xxxxxxxxxxxx>
Date: Mon, 4 Mar 2002 12:55:21 -0500
[Robert Sösemann]
> I am doing XSL transformation on an valid XML doc, where all the german
> umlauts are correctly translated to things like &uuml; and so on.
> But after the transformation all this is gone. This means instead of the
> escape characters I have the real umlauts. which we be regarded as an
error
> in IE for example.

They are not gone.  The original entities have correctly been replaced with
the characters they represent.  That is correct behavior, not an error.  And
it's not an error in IE, either.  What most likely has happened is that the
output of the transformation is either 1) missing an encoding declaration,
or 2) in an encoding that the browser does not know about.

In case 1, an xml file is supposed to be in UTF-8 (unless it has a UTF-16
byte order mark, in which case it is supposed to be in UTF-16).  But the
browser would probably think that the encoding is Latin-1 or iso-8859-1.
The characters would display incorrectly.

In case 2), the browser will try to use its regular encoding, which probably
is not utf-8 or whatever your stylesheet is producing.

Just make sure that you include the right encoding for the browser (probably
iso-8859-1) in an xsl:output intruction, and you should get what you want.

This is a FAQ, and there are lots of answers about encoding in the archives
and FAQ sites.

Cheers,

Tom P




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread