Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Displaying the degree symbol using XSLT

Thread Tools

Displaying the degree symbol using XSLT

Posts: n/a
I am finding that when I use XSLT to display convert XML like this:

<temp units="&#176;C">23</temp>

the resulting HTML displays an extra character in front of the degree
symbol, like this:


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.

Reply With Quote
David Carlisle
Posts: n/a

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
<xslutput encoding="iso-8859-1"/> or
<xslutput 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 xslutput are likely to be ignored)


Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
2 year AAS degree (w/certs) vs. 4 year CIS degree smolderingwick Microsoft Certification 0 02-06-2011 04:44 PM
converting MCSE degree to university degree mcp farahani MCSE 2 11-13-2009 06:53 PM
Temperature degree symbol Ryka Computer Support 29 11-23-2007 08:01 AM
Counting down an integer vector from the highest degree (111) to the lowest degree (000) Matt Chwastek C++ 6 11-20-2006 10:51 PM
Embedding degree symbol etc. in XML extract files T Kennedy XML 4 04-26-2005 05:27 PM