Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   XML (http://www.velocityreviews.com/forums/f32-xml.html)
-   -   Displaying the degree symbol using XSLT (http://www.velocityreviews.com/forums/t169241-displaying-the-degree-symbol-using-xslt.html)

Dingbat 04-29-2005 01:48 PM

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

David Carlisle 04-29-2005 02:04 PM

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.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57