This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Re: Unwanted Output Escaping


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 
this).

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: http://skew.org/xml/
  denver/boulder, colorado, usa   |  resume: http://skew.org/~mike/resume/

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]