W3C home > Mailing lists > Public > www-svg@w3.org > November 2002

Re: Problem with CDATA

From: Kevin Lindsey <kevin@kevlindev.com>
Date: Wed, 27 Nov 2002 10:16:42 -0600
Message-ID: <004e01c29630$608e2480$5300a8c0@monkey>
To: "Hyunju Shim" <hshim@cise.ufl.edu>, <www-svg@w3.org>

Hyunju,

> I hardcoded following code:
>
> <script type="text/ecmascript"><[CDATA[
>     AA
> ]]> </script>
>
> What I got into the result SVG file is like this:
>
> <script type="text/ecmascript">
>   AA
> </script>
>
> It seems <[CDATA[  ]]> is not copied into destination documents.
> But the result SVG file will have a bug without <[CDATA[  ]]> inside of
script node.
> How can I put the "<[CDATA[  ]]>" into the result file?

As I understand, the XSL-T processor will escape the contents of the CDATA
section in your stylesheet, so you won't have any problems with the
resulting script; however, you'll end up with things like this:

    if ( x < 10 ) { ... }

looking like this:

    if ( x &lt; 10) { ... }

which may be a little difficult to read.

If you want your script elsment's text to be wrapped within a CDATA section,
you can use the cdata-section-elements on an output element.  Something
like:

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

Kevin
KevLinDev - http://www.kevlindev.com
Received on Saturday, 30 November 2002 21:27:37 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:23 GMT