[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Preserve CDATA for all elements

Subject: Re: Preserve CDATA for all elements
From: "Jagdishwar (Jagsmiles)" <jagsmiles@xxxxxxxxx>
Date: Sun, 14 May 2006 20:16:59 +0200
javascript extract cdata
On 5/14/06, Michael Kay <mike@xxxxxxxxxxxx> wrote:
Sorry, can't be done. The XSLT processor doesn't get to see where the CDATA
sections were in the source document.

Remember that CDATA sections are just a keyboard shortcut. The following
are
all exactly equivalent, and your XSLT processor will see the same input
whichever form you use:

<e>">"</e>
<e>&quot;&gt;&quot;</e>
<e><![CDATA[">"]]></e>

As a matter of interest, *why* do you want to preserve the CDATA sections
in
the input document?
Because my client application, which actually uses the transformed xml
is designed such that It just strips of the string "<![CDATA[" and
"]]>" and prints the actually value to the user.
So now if it gets transformed to strings like &quot;&gt;&quot;, i just
wondered if it prints the string "&quot;&gt;&quot;" to the user, which
the user would not expect.
I am working on an existing application, where all the data is present
in xml format, and the client side is on intenet explorer(and
javascript). They have not used any xml parser in javascript to get
the values of xml elements. Instead they have written custom
routines(involves lot of string handling in javascript) to extract the
values of xml elements. So i am trying to make most of the
transformation with preserving the content,layout, structure of the
source xml into transformed xml.

If it's really important, you could put the XML through a Perl program or
similar that converts the CDATA section to an XML element as a
pre-processing phase and then does the reverse as a post-process.
This is defenetly a possible solution.
Or else I would have to look into the client application, to check how
i can remove the issues like this.

Michael Kay
http://www.saxonica.com/

Thank you all. Kind Regards, Jagdishwar, Jagsmiles AT gmail DOT com

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.