[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Removing namespaces without escaping CDATA???
David Carlisle wrote:
You can 'annotate' the result tree in XSLT 2.0, though possibly not as conveniently as Mukul Gandhi requests. The attribute 'cdata-section-elements' is an AVT in the xsl:result-document element and it must result in one or more qnames. But this requires redesigning your stylesheets in such a way that you use xsl:result-document, instead of xsl:output (but that should not be too hard if it is 'global'). This: <xsl:variable name="my-cdata" select="'as-cdata'" /> <xsl:result-document cdata-section-elements="{$my-cdata}" href="analyze.xml"> <as-cdata> <xsl:text>Has some text</xsl:text> <not-cdata /> </as-cdata> <as-cdata>Less then is: <, ampersand is: &</as-cdata> </xsl:result-document> results in the following output (Saxon 8.9): <as-cdata><![CDATA[Has some text]]><not-cdata/> </as-cdata> <as-cdata><![CDATA[Less then is: <, ampersand is: &]]></as-cdata> You have all freedom, the only drawback compared to your d-o-e-like approach is that you will have to determine the contents of the AVT beforehand, instead of per element. But as Michael and David already pointed out, would you really want to do this? Cheers, -- Abel PS: it is probably better to declare $my-cdata as 'xs:Qname' or 'xs:Qname*'.
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|