Re: Re: [xsl] Unwanted Output Escaping

Subject: Re: Re: [xsl] Unwanted Output Escaping
From: Mike Brown <mike@xxxxxxxx>
Date: Thu, 23 May 2002 09:32:43 -0600 (MDT)
gary cor wrote:
> Sadly this is not a solution to our problem, the mark-up in the CDATA block 
> is most likely invalid mark-up that we don't control, hence we need to leave 
> it "as-is" through into our final output.

Just to drive the point home, whoever made the decision to use a CDATA section
in this way was misinformed about what a CDATA section actually is. It is just
a convenience for the document author. It does not mark a span of text with a
"Dear Application, please preserve me" flag. It merely says "Dear XML Parser,
if you see something in here that looks like markup, it's not really markup.
Please report it to the Application as ordinary character data, as if '<' and
'&' had been written as '&lt;' and '&amp;', for example."

If you want to treat markup like your <p>Hello</p> as markup -- like if you
want it to be treated as an element 'p' containing character data 'Hello', and
you want it serialized as that markup should be -- then you should make sure 
it's embedded in your XML as actual XML. 

Your only other option is to leave all of it as character data, copy it with 
<xsl:value-of select="." disable-output-escaping="yes"/>, and hope that your 
XSLT processor supports d-o-e (it isn't required to) and that you're not 
outputting malformed data (more of a concern when the rest of the output uses 
the xml method), and that you're always going to be using this stylesheet as 
the last step before serialization (you may one day change your mind about 

The point is, as Mike Kay mentioned, a poor design decision was made.
Lose the CDATA sections if you can.

   - Mike
  mike j. brown                   |  xml/xslt:
  denver/boulder, colorado, usa   |  resume:

 XSL-List info and archive:

Current Thread