![]() |
Displaying the degree symbol using XSLT
I am finding that when I use XSLT to display convert XML like this:
<temp units="°C">23</temp> the resulting HTML displays an extra character in front of the degree symbol, like this: 23°C This happens whether I use PHP or ASP so it seems to be parser-independent. The XSL fragment would be something like: <xsl:value-of select="@units"/> Can anyone explain what's going on? I'm trying to develop XML files containing weather info, and example XSLT to format and display them, and this is a bit of a speedbump. The XML displays as expected in IE 6, ie like this: <temp units="°C">23</temp> Thanks for any help. Dingbat |
Re: Displaying the degree symbol using XSLT
That's the UTF8 encoding. So you either need to make sure that you are serving the file with the http headers declaring utf8 (and make sure that your browser understands that encoding) or perhaps you want to output in latin1 or ascii in which case adding <xsl:output encoding="iso-8859-1"/> or <xsl:output encoding="US-ASCII"/> probably works (it depends how you are calling xslt, if the final serialisation is being done by some other application than the xslt engine, encoding hints on xsl:output are likely to be ignored) David |
| All times are GMT. The time now is 02:41 PM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.