[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] output a literal CDATA section


Subject: RE: [xsl] output a literal CDATA section
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Thu, 21 Jul 2005 15:55:53 -0400

Georges,

What you've said below suggests to me that I was correct in guessing that you could use verbatim tag-writing to get the "inner" XML (not to be parsed) inside your "outer" XML (the Docbook, which must work as Docbook). On the other hand, if you're already doing it cleanly with a post-process to escape those tag structures you don't want parsed (by wrapping them in CDATA section delimiters) -- that should be okay too. As long as you're happy with the soundness of the post-process.

As Mike indicated, I think, the trickiness here stems from the fact that XSLT works on node structures, not on tags, and relies on a serializer to turn the result tree into tagged text (i.e. XML as we know it). This means there's an "all or nothing" aspect to it. Once one internalizes how tagging that's wrapped as CDATA in an XML file isn't actually tagging at all -- it's just data, which just happens to have "tags" in it -- it becomes clearer why one can't generate it by the usual means (building a tree and then letting the serializer write it out). Hence special approaches such as verbatim tag-writing techniques, or supplementary non-XML-aware approaches that work directly on the tags-in-text rather than on the tree that an XSLT processor would build.

Cheers,
Wendell

At 11:58 AM 7/21/2005, you wrote:
we need a documentation (I got the developers to accept DocBook as format) of an import/export interface in xml, where data is mapped in java objects. The import interface is in draft state, so there will be changes in future to the structure, as well as to the example values contained in the tags.

I use a demo import file (consisting in more than 200 object mappings) to generate a rough frame in DocBook containing all basic data structures and thus freeing me of annoying mass work (gain without pain :-)). Once I have a reasonable framework, I'll start editing the DocBook document, any further changes/extensions to the import structure will be documented manually (I will not repeat the transformation, the goal is to just reach a good starting point). To introduce CDATA sections, I decided to perform some search/replace actions in a (one time) post-process.

If I would use a GUI editor that hides the escaped characters, I wouldn't be bothered by them, but I'm hacking xml in ASCII mode, so CDATA sections are definitely more fun.



====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================


Current Thread
Keywords