RE: [xsl] CDATA again

Subject: RE: [xsl] CDATA again
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 11 Feb 2005 12:05:53 -0000
The purpose of CDATA is to indicate that contained < and > characters are
ordinary characters, not markup.

Therefore, you can't have markup inside a CDATA section.

Or in data model terms: there is no such thing as a CDATA node.

Using Saxon, you can call saxon:serialize to get a serialized representation
of an element as a string, and you can then output this string as the
contents of a text node. If you then serialize the containing document,
specifying cdata-section-elements for the relevant element, you will get the
output you want.

But why do you want it? Why do you want to disguise the XML and pretend that
it isn't XML? Why do you want to make it difficult for the recipient to
process the document? XML is designed to be nested, after all.

Michael Kay 

> -----Original Message-----
> From: Robert Soesemann [mailto:rsoesemann@xxxxxxxxxxx] 
> Sent: 11 February 2005 11:14
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] CDATA again
> I need to produce output where some of the input node are 
> inside a valid
> CDATA comment.
> E.g:
> ...
> 	<targetGroup markup="yes">                    
> 		<![CDATA[		
>                       <ul>
>                         <li>PK Bestandskunden
>                         (Postpaid+Prepaid)</li>
>                         <li>Neukunden</li>
> ...
> What need I put in here to get this?
> 	<xsl:template match="td" mode="markup">
> 		????
> 			<xsl:copy-of select="child::node()"/>
> 		????
> 	</xsl:template>
> I tried without success:
> - <xsl:text><![CDATA[</xsl:text>
> - &lt;![CDATA[
> Robert

Current Thread