Special characters with XSLT

Please support our RSS, Web Services and SOAP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved

Join Date: Feb 2002
Posts: 12,057
Reputation: cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light 
Solved Threads: 128
Administrator
Staff Writer
cscgal's Avatar
cscgal cscgal is offline Offline
The Queen of DaniWeb

Special characters with XSLT

 
0
  #1
May 10th, 2006
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.
Dani the Computer Science Gal
Follow my Twitter feed! twitter.com/DaniWeb
And if you're interested in Internet marketing there is twitter.com/DaniWebAds
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 6
Reputation: bwhiti is an unknown quantity at this point 
Solved Threads: 1
bwhiti bwhiti is offline Offline
Newbie Poster

Re: Special characters with XSLT

 
0
  #2
May 10th, 2006
In your dtd try this

RSS, Web Services and SOAP Syntax (Toggle Plain Text)
  1. <!ENTITY &nbsp; " ">
Reply With Quote Quick reply to this message  
Join Date: Feb 2002
Posts: 12,057
Reputation: cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light 
Solved Threads: 128
Administrator
Staff Writer
cscgal's Avatar
cscgal cscgal is offline Offline
The Queen of DaniWeb

Re: Special characters with XSLT

 
0
  #3
May 10th, 2006
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.
Dani the Computer Science Gal
Follow my Twitter feed! twitter.com/DaniWeb
And if you're interested in Internet marketing there is twitter.com/DaniWebAds
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 6
Reputation: bwhiti is an unknown quantity at this point 
Solved Threads: 1
bwhiti bwhiti is offline Offline
Newbie Poster

Re: Special characters with XSLT

 
0
  #4
May 10th, 2006
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.
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 6
Reputation: bwhiti is an unknown quantity at this point 
Solved Threads: 1
bwhiti bwhiti is offline Offline
Newbie Poster

Re: Special characters with XSLT

 
0
  #5
May 10th, 2006
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. '
Reply With Quote Quick reply to this message  
Join Date: Feb 2002
Posts: 12,057
Reputation: cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light 
Solved Threads: 128
Administrator
Staff Writer
cscgal's Avatar
cscgal cscgal is offline Offline
The Queen of DaniWeb

Re: Special characters with XSLT

 
0
  #6
May 10th, 2006
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]
Dani the Computer Science Gal
Follow my Twitter feed! twitter.com/DaniWeb
And if you're interested in Internet marketing there is twitter.com/DaniWebAds
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 1
Reputation: aparvaiz is an unknown quantity at this point 
Solved Threads: 0
aparvaiz aparvaiz is offline Offline
Newbie Poster

Re: Special characters with XSLT

 
0
  #7
Mar 23rd, 2008
great tip, thx for the help

Originally Posted by cscgal View Post
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]
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the RSS, Web Services and SOAP Forum


Views: 10480 | Replies: 6
Thread Tools Search this Thread



Tag cloud for RSS, Web Services and SOAP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC