DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/)
-   RSS, Web Services and SOAP (http://www.daniweb.com/forums/forum151.html)
-   -   Special characters with XSLT (http://www.daniweb.com/forums/thread45168.html)

cscgal May 10th, 2006 8:34 am
Special characters with XSLT
 
I am using an XSL document to pretty print my RSS feed. However, special characters don't parse - they appear within the feed as   and &

What line(s) do I need to specify in my RSS and XSL XML documents in order to get these to work? It's my understanding that & " < > should work by default but I need to do extra to work to map   to a space.

bwhiti May 10th, 2006 9:21 am
Re: Special characters with XSLT
 
In your dtd try this

<!ENTITY &nbsp; " ">

cscgal May 10th, 2006 9:33 am
Re: Special characters with XSLT
 
I was reading up about that but I haven't tried it yet. What I'm most in need of is getting &amp; to work, but from what I understand, it should by default? I'm using UTF-8 if that matters.

bwhiti May 10th, 2006 9:52 am
Re: Special characters with XSLT
 
Entities such as &amp; and &quote; will need to be specified into the dtd but you could always use the hex value so for a single quote you could use &39; and whitespace you could use   this will always be transformed for you with no problems and saves you declaring the entities in the dtd.

bwhiti May 10th, 2006 9:53 am
Re: Special characters with XSLT
 
sorry a space is
 
and a single quote qould be
'

cscgal May 10th, 2006 11:32 am
Re: Special characters with XSLT
 
Thank you for your help. I did some research and the following worked:

I replaced
[html]<xsl:value-of select="description" />[/html]
with
[html]<xsl:value-of select="description" disable-output-escaping="yes" />[/html]

aparvaiz Mar 23rd, 2008 7:52 am
Re: Special characters with XSLT
 
great tip, thx for the help

Quote:

Originally Posted by cscgal (Post 213828)
Thank you for your help. I did some research and the following worked:

I replaced
[html]<xsl:value-of select="description" />[/html]
with
[html]<xsl:value-of select="description" disable-output-escaping="yes" />[/html]



All times are GMT -4. The time now is 2:00 pm.

Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC