Re: [xsl] Passing through character entities intact

Subject: Re: [xsl] Passing through character entities intact
From: "Thomas B. Passin" <tpassin@xxxxxxxxxxxx>
Date: Wed, 10 Oct 2001 18:20:14 -0400
[McCollum , Angus]

> I would like pass the entity through so I can use a non-encodable
> character(mdash) in the final output. What happens in Xalan, is that when
it
> finds a '&' character code it substitues the '&amp;' reference. This does
> not work for non-standard, but common references such as mdash. As a
result
> setting the output encoding to ISO_8859-1, which is the most compatable
for
> the web, will cause an XSLT processor to throw and error or input a
> character like '?' instead of the entity reference.
>
Hmm, if it's non-encodable then how can it be encoded in the output?
Conversely, if it is encodable, the processor should encode it, otherwise it
should output a character reference.  Have you tried another processor to
see whether it handles it more to your liking?  They don't all do the same
thing.

Sometimes you actually get the right thing but it looks different depending
on your editor or viewer and the encoding in use.  If you look at the result
with a hex editor, the character reference is really there.  I just tried
this out, transforming an XML document with a &#160; in it, using utf-8 and
iso-8859-1.  Depending on the encoding and the processor, it displayed
differently in XML Cooktop on Windows 2000 (variously as a space or an A
with an hat over it), but the hex viewer showed that &#160; was actually in
all these versions.

So you may really be getting the result you want but not realize it.

Cheers,

Tom P



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


Current Thread