Sonic 8.0.1
I have an XML Message Part that I need to delimit with CDATA and wrap in two layers of XML. I have a fairly simple stylesheet that looks like:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ic="http://tempuri.org/IC45101/IC45101">
<xsl:output method="xml" omit-xml-declaration="yes" cdata-section-elements="xx:s"
xmlns:xx="http://tempuri.org/IC45101/IC45101"/>
<xsl:template match="/">
<xsl:element name="UpdateStallReserveInfo" namespace="http://tempuri.org/IC45101/IC45101">
<xsl:element name="s" namespace="http://tempuri.org/IC45101/IC45101">
<xsl:copy-of select=".">
</xsl:copy-of>
</xsl:element>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
The output I get is:
<UpdateStallReserveInfo xmlns="http://tempuri.org/IC45101/IC45101"> And what I need is: <UpdateStallReserveInfo xmlns="http://tempuri.org/IC45101/IC45101"> How can I get the CDATA delimiters?
<s>
... the Message Part ...
</s>
</UpdateStallReserveInfo>
<s>
<![CDATA[... the Message Part ...]]>
</s>
</UpdateStallReserveInfo>
I tried with
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ic="http://tempuri.org/IC45101/IC45101">
And XMl
3
Got this
]]>
3
]]>
This is what you are expecting?
What did you run with?
I ran:
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ic="http://tempuri.org/IC45101/IC45101">
xmlns:xx="http://tempuri.org/IC45101/IC45101"/>
http://tempuri.org/IC45101/IC45101">
http://tempuri.org/IC45101/IC45101">
with:
3
In:
- Sonic Workbench 8.0.1 as a scenario
- XMLSpy 2011
and got the same results:
http://tempuri.org/IC45101/IC45101">
3
No CDATA!
It appears that cdata-section-elements are ignored if they contain valid XML. I can't figure out why that would be the case.
When I ran the sample here (http://code.activestate.com/lists/perl-xml/4444/) it worked OK until I added child XML elements. If I just added a child string it was wrapped in CDATA correctly.
I ran with sonic 7.5.1 using the standard sonic transformation service.
Here's the solution (from Progress support)...
xmlns:xsl=http://www.w3.org/1999/XSL/Transform> xmlns:xx="http://tempuri.org/IC45101/IC45101"/> <![CDATA[ ]]>