xsl-list
[Top] [All Lists]

Re: [xsl] Processing XML with multiple nested CDATA sections

2013-02-28 18:05:17
On 28/02/2013 23:47, dvint(_at_)dvint(_dot_)com 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



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--