paddycobbett
asked on
How do i handle &nsbp; in stylesheet?
I have a stylesheet which accepts xml (which happens to be html) from some process. The problem is that the process is generating &nsbp; which causes the xsl parser to crash.
From looking on the web i see that &nsbp is not allowed, a suggestion was to put the following ENTITY declaration in the header:
<!ENTITY nbsp CDATA " " >
<?xml version="1.0" encoding="Windows-1252" ?>
xsl code...
.. but i now get an xslt compile error. As i understand it the above declaration should replace all occurrances of to   which xsl DOES handle. I suspect that the post i found on the web missed something from the above declaration. Can anyone correct the above or suggest another way for my xslt to handle
Thanks in advance :)
From looking on the web i see that &nsbp is not allowed, a suggestion was to put the following ENTITY declaration in the header:
<!ENTITY nbsp CDATA " " >
<?xml version="1.0" encoding="Windows-1252" ?>
xsl code...
.. but i now get an xslt compile error. As i understand it the above declaration should replace all occurrances of to   which xsl DOES handle. I suspect that the post i found on the web missed something from the above declaration. Can anyone correct the above or suggest another way for my xslt to handle
Thanks in advance :)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
> As i understand it the above declaration should replace all occurrances of to   which xsl DOES handle
also make sure thatthe original XML has this declaration
because the XSLT only needs this doctype declaration if you use the in the stylesheet
the parser internally transforms the to a legal entity, before the xslt processor gets it
also make sure thatthe original XML has this declaration
because the XSLT only needs this doctype declaration if you use the in the stylesheet
the parser internally transforms the to a legal entity, before the xslt processor gets it
ASKER
The suggestion by R7AF was a last resort, i had considered filtering that value from the process. If i can handle it in the stylesheet then that would be ideal. Gertone, you gave me a corrected version, but still results in the same error :S
ASKER
So the xml coming in should also have:
<?xml version="1.0" encoding="Windows-1252" ?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp CDATA " " >
]>
?
<?xml version="1.0" encoding="Windows-1252" ?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp CDATA " " >
]>
?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks, having investigated the code base i'm working on it turned out to be more straight forward then i anticipated to insert code to strip off the &nsbp;
Thanks for both suggestions which i'm sure are valid. I've allocated more points to R7AF since it is the suggestion which suited me best in this case.
Thanks for both suggestions which i'm sure are valid. I've allocated more points to R7AF since it is the suggestion which suited me best in this case.
it should be like this
<?xml version="1.0" encoding="Windows-1252" ?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp CDATA " " >
]>
<xsl:stylesheet ...