954,180 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

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.

cscgal
The Queen of DaniWeb
Administrator
19,421 posts since Feb 2002
Reputation Points: 1,474
Solved Threads: 229
 

In your dtd try this

<!ENTITY &nbsp; " ">
bwhiti
Newbie Poster
6 posts since May 2006
Reputation Points: 10
Solved Threads: 1
 

I was reading up about that but I haven't tried it yet. What I'm most in need of is getting & to work, but from what I understand, it should by default? I'm using UTF-8 if that matters.

cscgal
The Queen of DaniWeb
Administrator
19,421 posts since Feb 2002
Reputation Points: 1,474
Solved Threads: 229
 

Entities such as & 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
Newbie Poster
6 posts since May 2006
Reputation Points: 10
Solved Threads: 1
 

sorry a space is

&#160;

and a single quote qould be

&#39;
bwhiti
Newbie Poster
6 posts since May 2006
Reputation Points: 10
Solved Threads: 1
 

Thank you for your help. I did some research and the following worked:

I replaced
[html][/html]
with
[html][/html]

cscgal
The Queen of DaniWeb
Administrator
19,421 posts since Feb 2002
Reputation Points: 1,474
Solved Threads: 229
 

great tip, thx for the help

Thank you for your help. I did some research and the following worked: I replaced [html][/html] with [html][/html]
aparvaiz
Newbie Poster
1 post since Mar 2008
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You