CDATA sections

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

CDATA sections

idwright
Hi,

What I'm trying to do is to post an atom:entry with text in the
atom:content element so in order to do this what I need to be able to do
is to surround the contents of the atom:content with CDATA (for the case
when it's XML).
(Yes I know this isn't a great thing to try and do but I'm working with
a third party API here and the text content could be anything)

I can get <atom:content>some text <i>child</i></atom:content> fairly
easily but I need to get to <atom:content><![CDATA[ some text
<i>child</i>]]></atom:content>

I thought I'd cracked it with an XSL:
<xsl:template match="atom:content">
<xsl:element name="content" namespace="http://www.w3.org/2005/Atom">
<xsl:apply-templates select="@*"/>
<xsl:text disable-output-escaping="yes">&lt;![CDATA[</xsl:text>
<xsl:apply-templates select="node()"/>
<xsl:text disable-output-escaping="yes">]]&gt;</xsl:text>
</xsl:element>
</xsl:template>

however when this is part of an xpl the CDATA becomes:
<?javax.xml.transform.disable-output-escaping?>&lt;![CDATA[<?javax.xml.transform.enable-output-escaping?>

Obviously using xforms:setvalue ... value="concat('<![CDATA[',
$content,']]>')" doesn't work

For a fuller description (and example code) of what I'm attempting see
here http://aelfric.co.uk/random/2011/12/orb-cas-alf-2/

(This approach doesn't have the extended character problem described in
my earlier post)

Any clues gratefully received.

Thanks,
Ian


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws