• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 716
  • Last Modified:

xsl:output xml containing &#160

I have a sample xml below with  

  <p>this is a test</p>
  <p>this is &#160;&#160;&#160;&#160; a test</p>

If the xsl:output method="html", then &#160 is converted correctly to &nbsp; and the html output is displayed ccorrectly.

However, I need to have an xhtml output so it is xsl:output method="xml".  The reason I need to do this is because I need to render to a new xml file and then this xml file is applied to another xsl to get the final html output.

My issue is when I apply the above sample xml using method="xml", the &#160; is converted to a space character (a blanks space).  Thus, when this new xml is applied to the xsl with html output, I get invalid character (the invalid Â)
I guess in oder to resolve this, is there anyway when I have xml output, it doesnt convert &#160; but pass-thru directly to the xml output (&#160;) then this will be converted correctly to &nbsp when applied again with html output.
If my 1st xml output converts the &#160, then I will end up with invalid character Â.

Thanks to everyone for helping out.
1 Solution
I have never had this problem, but there are few suggestion you can with :
1. instead of &#160; use your own tag say :
<SPACE/> , in the first processing use xsl:copy-of for this element, and only in the next xml convert this to &nbsp; or whatever you need it to be.

2. Try to put it inside CDATA

Whose transformer are you using? How did you determine that the XML output converted the character? You could try setting the output method to xhtml and the encoding to utf-8, since the mS parser does not recognize that.

Featured Post

Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now