RE: Special characters turn out as garbage in xslt->html conversi on

Subject: RE: Special characters turn out as garbage in xslt->html conversi on
From: Kay Michael <Michael.Kay@xxxxxxx>
Date: Fri, 8 Sep 2000 11:56:23 +0100
> That is, the second loop gives this (for an A with
> acute accent): 
> 
>       <a name="&Aacute;">&Aacute;</a>
> 
> just like it should. If however the html-attribute is "href" 
> the output is
> like this in html:
> 
>       <a href="#%C3%81">&Aacute;</a>
> 
> I have absolutely no idea why this happens and haven't been 
> able to find any clues.

The clue is the paragraph in XSLT section 16.2 that says: "The html output
method should output non-ASCII characters in URI attribute values using the
method recommended in section B.2.1 of the HTML 4.0 Recommendation".
Technically, non-ASCII characters in URIs are illegal.

The "garbage" is actually the hex representation of the UTF-8 encoding of
the relevant characters.

Don't worry about the HTML, so long as it works in your browser!

I think the <a name=""> attribute should also be escaped this way even
though its value is not a URI, this is a minor omission from the XSLT spec.


Mike Kay


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


Current Thread