[OT] XHTML -> XHTML: How can entities preserved?

Harvey Thomas hst at empolis.co.uk
Wed Oct 9 05:39:35 EDT 2002


F. GEIGER wrote

> I do process XHTML files with a Python app, that calls a couple of
> processing objects.
> 
> One of them is a class called Shaper. The Shaper takes an 
> XHTML file as
> input, processes all H1, H2, etc. elements and outputs it 
> again into an
> XHTML file. It does so by calling an XSLT processor.
> 
> The problem here is, that entities are converted, e.g. 
> ' ' becomes ' '.
> This is not what I want. I want all entities being preserved for the
> client's browser.
> 
> As my app runs on a W2k box, I use the MS XSL processor. In 
> their help they
> show a method to preserve entities: cdata-section-elements. 
> Actually all
> data defined by cdata-section-elements are put into CDATA 
> sections. But this
> is not for HTML output: "HTML does not recognize CDATA 
> sections. Do not use
> this option when generating HTML."
> 
> I guess this not an MS XSL issue but a general XML/XSL issue, right?
> 
> Any idea?
> 
> Many thanks and best regards
> Franz GEIGER
> 

This is an XML issue.
<rant>
The creators of XML decided in their wisdom that amongst the facilities of SGML they would drop was SDATA entities. This causes the type of problem you have when you don't want entities resolved to something other than themselves.
</rant>
  is not really an entity, it is a character reference
I suspect that in you DTD you have
<!ENTITY nbsp " ">

Try replacing this and similar declarations in the DTD with
<!ENTITY nbsp "&nbsp;">

Harvey

_____________________________________________________________________
This message has been checked for all known viruses by the MessageLabs Virus Scanning Service.




More information about the Python-list mailing list