Re: Problem with CDATA

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 UTC