I have an XSLT that creates some CDATA within a node.
XML:
<test><inner>stuff</inner></test>
XSLT:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
version="2.0">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="test">
<wrapper>
<xsl:text disable-output-escaping="yes"><![CDATA[</xsl:text>
<xsl:copy-of select="*"/>
<xsl:text disable-output-escaping="yes">]]></xsl:text>
</wrapper>
</xsl:template>
</xsl:stylesheet>
This transform, executed via Saxon, returns:
<wrapper><![CDATA[<inner>stuff</inner>]]></wrapper>
I am aware that I am wrapping XML in CDATA and that this is kind of ridiculous. But this is what is expected by an API that I am working with, so I have no choice but to follow this pattern.
Now I am trying to include this transform as part of a larger XProc pipeline:
<p:pipeline xmlns:p="http://www.w3.org/ns/xproc" version="1.0" >
<p:xslt>
<p:input port="stylesheet">
<p:document href="test.xsl" />
</p:input>
</p:xslt>
Which returns (using the latest version of Calabash):
<wrapper><![CDATA[<inner>stuff</inner>]]></wrapper>
It seems that XProc doesn't honor the disable-output-escaping attribute.
I went on to try a few XProc functions including p:unescape-markup and various combinations of p:string-replace, but I couldn't find a solution that didn't adversely impact the rest of my output.
Any ideas what I might try next?