Re: [xsl] Treat CDATA section content as node

Subject: Re: [xsl] Treat CDATA section content as node
From: Dave Pawson <davep@xxxxxxxxxxxxx>
Date: Thu, 25 Feb 2010 08:05:21 +0000
On 25/02/10 05:15, Karl Stubsjoen wrote:
Is it possible to treat the content in a CDATA section as a node or
set of nodes?  The xml I am working with puts HTML markup in a CDATA
section.  Of course, these items are intended to simply copy as-is,
but I wish to translate the html into something else.

So you might have:

<xyz><![CDATA[<p>a paragraph</p><p>a paragraph</p><p>a paragraph</p>]]></xyz>

Maybe I want to tranlsate the<p>  tags into<div>  tags.  Any way to
set up a match on this, maybe use of node-set() function?

Looking for XSL 1.0 solution.


Might be better to change the schema to include the (X)HTML snippet?

if you mean html, then parsing the CDATA content (I think Saxon allows
that via an extension) might produce an error due to <img> without
a closing tag.


Dave Pawson

Current Thread