Re: [xsl] Need to wrap XML in <![CDATA[...]]> tags

Subject: Re: [xsl] Need to wrap XML in <![CDATA[...]]> tags
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 4 Aug 2003 17:58:28 +0100

  End result:

   <title>Resultant text from a value-of</title>
   <body>Resultant text from a value-of</body>

OK then my first answer holds.
The above is exactly the same as

   &lt;title>Resultant text from a value-of&lt;/title>
   &lt;body>Resultant text from a value-of&lt;/body>

Just linearised differently, just as <a="b"/> is the same as <a = 'b' />
AN XSLT (or any XML) system would see these as the same input,
and in XSLT you use identical code to produce either of them (and the
system will do it one way or the other, just as you can't directy
control whether the system uses " or ' around attribute values.

When using XSLT it's best not to think of the serialisation at all
until the final stage when you can drop serialisation hints to

So you want to convert elements such as html into strings with their
linearisation. there are loads of stylesheets to do this in the faq or
archives of this list, and elswehere but they all basically look like
the code I posted before

<xsl:element match="*">
&lt;<xsl:value-of select="name()"/>&gt;
&lt;/<xsl:value-of select="name()"/>&gt;

So once you've converted all your input tree to a single string, you
want to _ask_ the XSLt system to output that using CDATA rather than lots
of &lt; so you do that by

<xsl:output cdata-section-elements="CONTENT"/>


This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:

 XSL-List info and archive:

Current Thread