|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: How to deal with special characters in XSL?
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








