[xsl] [CDATA section] To preserve boundaries after XSL transformation

Subject: [xsl] [CDATA section] To preserve boundaries after XSL transformation
From: Chizzolini Stefano <chist@xxxxxx>
Date: Thu, 14 Oct 2004 16:39:29 +0200
Hi all

I'm trying to transform an XML node (see APPENDIX) preserving any CDATA
section may be encountered.
I don't want to output *all* the elements marked with the same
expanded-name, wrapping them inside CDATA sections as performed by the
xsl:output.cdata-section-elements attribute behavior ([1], chapter 16,
16.1): I just want that *any* input element with a preexisting CDATA section
is put out unchanged, that is with its damn CDATA section boundaries!

Any suggestion?

Thanks

Stefano

REFERENCES
[1] XSL Transformations (XSLT) Version 1.0,
http://www.w3.org/TR/1999/REC-xslt-19991116

APPENDIX
CDATA attempt

I've tried to transform the following "fields" element node via MSXML 4.0
(note the CDATA section inside the field element):

<documents xmlns="http://www.aaa.it/cns/xdmModel";>
[...]
<page template="OFF001.pdf">
<fields>
<field name="OF1001"><![CDATA[UNITA' OPERATIVA DI BRESCIA]]></field>
[...]
</fields>
</page>
[...]
</documents>

using this XSLT:

<xsl:template match="xdm:fields">
<form src="{../@template}">
<xsl:apply-templates/>
</form>
</xsl:template>
[...]
<xsl:template match="xdm:field[@name='OF1001']">
<label x="52" y="0" width="11">
<xsl:value-of select="."/>
</label>
</xsl:template>

but (obviously) the result has lost my precious CDATA boundaries...

<form src="OFF001.pdf">
<text x="52" y="0" width="11">UNITA' OPERATIVA DI BRESCIA</text>
[...]
</form>

Current Thread