This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: How to deal with special characters in XSL?
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: Re: [xsl] How to deal with special characters in XSL?
- From: "Thomas B. Passin" <tpassin at mitretek dot org>
- Date: Wed, 17 Oct 2001 17:19:09 -0400
- Reply-To: xsl-list at lists dot mulberrytech dot com
I decided to try it out myself. See the xslt file at the end of this post.
It produces a
table cell with some text and two non-breaking spaces. Output encoding is
utf-8 (iso-8859-1 seems to produce the expected results). This is on
Windows2000, in a command line session. I did a copy-and-paste from the
command line results.
Three processors, xt, 4xslt and saxon, actually output the characters
" ". Two others, sablotron v 0.7 and msxsl (using msxml3) output
strange looking characters that, in examining the hex, turned out to be hex
C2 A0. Now A0 is hex for 160. I assume that C2 A0 is correct for UTF-8?
Anyone know for sure?
The C2 A0 do not display as a nonbreaking space in IE5.5 on my system. I
assume that's because it doesn't know that the file is in utf-8.
If I use iso-8859-1 encoding, the output from those two processors is A0, as
expected. The upshot is that if you output in utf-8, the browser may not
know that, and so display the character incorrectly. I'm not sure how to
inform the browser about the encoding.
Cheers,
Tom P
4xslt output
<html>
<body>
<table>
<tr>
<td>Here are two non-breaking spaces == ==
</td>
</tr>
</table>
</body>
</html>
saxon output
<html>
<body>
<table>
<tr>
<td>Here are two non-breaking spaces == ==
</td>
</tr>
</table>
</body>
</html>
msxsl output
<html><body>
<table><tr>
<td>Here are two non-breaking spaces ==-á-á==
</td>
</tr></table>
</body></html>
Sablotron 0.7 output:
<html>
<body>
<table>
<tr>
<td>Here are two non-breaking spaces ==-á-á==
</td>
</tr>
</table>
</body>
</html>
==============================================
Stylesheet:
<?xml version="1.0" encoding='utf-8'?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method='html' encoding='utf-8'/>
<xsl:template match="/">
<html><body>
<table><tr>
<td>Here are two non-breaking spaces ==  ==
</td>
</tr></table>
</body></html>
</xsl:template>
</xsl:stylesheet>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list