943,584 Members | Top Members by Rank

May 10th, 2006
0

Special characters with XSLT

Expand Post »
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.
Similar Threads
Administrator
Staff Writer
Reputation Points: 1422
Solved Threads: 162
The Queen of DaniWeb
cscgal is offline Offline
13,645 posts
since Feb 2002
May 10th, 2006
0

Re: Special characters with XSLT

In your dtd try this

RSS, Web Services and SOAP Syntax (Toggle Plain Text)
  1. <!ENTITY &nbsp; " ">
Reputation Points: 10
Solved Threads: 1
Newbie Poster
bwhiti is offline Offline
6 posts
since May 2006
May 10th, 2006
0

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.
Administrator
Staff Writer
Reputation Points: 1422
Solved Threads: 162
The Queen of DaniWeb
cscgal is offline Offline
13,645 posts
since Feb 2002
May 10th, 2006
0

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.
Reputation Points: 10
Solved Threads: 1
Newbie Poster
bwhiti is offline Offline
6 posts
since May 2006
May 10th, 2006
0

Re: Special characters with XSLT

sorry a space is
RSS, Web Services and SOAP Syntax (Toggle Plain Text)
  1.  
and a single quote qould be
RSS, Web Services and SOAP Syntax (Toggle Plain Text)
  1. '
Reputation Points: 10
Solved Threads: 1
Newbie Poster
bwhiti is offline Offline
6 posts
since May 2006
May 10th, 2006
0

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]
Administrator
Staff Writer
Reputation Points: 1422
Solved Threads: 162
The Queen of DaniWeb
cscgal is offline Offline
13,645 posts
since Feb 2002
Mar 23rd, 2008
0

Re: Special characters with XSLT

great tip, thx for the help

Click to Expand / Collapse  Quote originally posted by cscgal ...
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]
Reputation Points: 10
Solved Threads: 0
Newbie Poster
aparvaiz is offline Offline
1 posts
since Mar 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in RSS, Web Services and SOAP Forum Timeline: Trouble with SOAP and xslt
Next Thread in RSS, Web Services and SOAP Forum Timeline: Webservices Help





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC