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

Re: Processing XML with multiple nested CDATA sections

Subject: Re: Processing XML with multiple nested CDATA sections
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 01 Mar 2013 00:04:56 +0000
Re:  Processing XML with multiple nested CDATA sections
On 28/02/2013 23:47, dvint@xxxxxxxxx wrote:
  Some of
these CDATA sections have CDATA sections in them.

You can't nest CDATA sections.


<![CDATA[a <![CDATA[b ]]> c ]]>

is a fatal syntax error as the CDATA section ends at the first ]]>
so the second ]]> is a syntax error. The second <![CDATA[ doesn't start a CDATA section at all as it is equivalent to &lt;![CDATA[.


In your example the inner "]]>" is changed to ]] > to avoid this.

The input is a mess and this isn't guaranteed to work but on the posted example



<xsl:template match="hibernate-generic">
<xsl:value-of disable-output-escaping="yes" select="replace(object/property[@name='body'],'(&lt;!\[CDATA\[)|(\]\] *>)','')"/>
</xsl:template>


produces


<p>Creating Inted.</p><p>You can also ptions.</p> <h1>Generating</h1><p><ac:link><ri:page ri:content-title="Types of Widgets" /><ac:plain-text-link-body>Infographic widgets </ac:plain-text-link-body></ac:link> are ways.</p>


David


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.