preserve cdata section

I need to modify lots of existing xml documents (add new tags, delete other
tags, rename some existing tags).  Originally, I decided to use XSL because
it would save me lots of programming time since all I have to do is create
an an XSLT Document with all my changes and apply it to the list of xml
documents.

However, when I discovered that CDATA sections are not preserved, I had to
give up on using XSL altogether and code everything by hand using DOM.  I
cannot predict where a user may decide to use a CDATA section and when they
won't.  It all depends on what they are trying to do.

Couldn't you add the ability for an XSL Processor to preserve cdata
sections?

I tried disable-output-escaping, but that doesn't work for CDATA sections.

I tried cdata-section-elements, but that assumes you know in advance which
tags need to have CDATA sections.

Here are some suggestions:

1. The XSL Processor knows when it encounters an CDATA section in the input
XML.  So at that point, why can't the processor check some new attribute on
the xsl:output tag like preserve-cdata-section-elements.

2. Add a new attribute to the text() element called disable-cdata-escaping.

3. Add a new function cdata() and when disable-output-escaping is applied
in it, it will disable escaping so the CDATA section is preserved.

Without this functionality, I cannot see how anybody can ever choose to use
XSL to modify an an existing XML document.

thanks

allan

Received on Friday, 26 December 2003 09:53:43 UTC