RE: [xsl] Re: Un-cdata-section-elements

Subject: RE: [xsl] Re: Un-cdata-section-elements
From: "Nathan Young -X \(natyoung - Artizen at Cisco\)" <natyoung@xxxxxxxxx>
Date: Tue, 21 Mar 2006 15:29:30 -0800
This document:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
      <html xmlns="http://www.w3.org/1999/xhtml"; lang="en"
xml:lang="en">
        <head>

          <title>Title</title>
<script type="text/javascript">alert("hey");</script>
        </head>

        <body>
         <p> thing</p>
        </body>

      </html>

Validates here:

http://validator.w3.org/

and so does this one:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
      <html xmlns="http://www.w3.org/1999/xhtml"; lang="en"
xml:lang="en">
        <head>

          <title>Title</title>
<script type="text/javascript"><![CDATA[alert("hey");]]>
</script>
        </head>

        <body>
         <p> thing</p>
        </body>

      </html>





It looks like you could in fact omit the cdata tags.  As I understand,
cdata tags are syntactic sugar that get you around having to escape all
less than and greater than signs to entities, but from a validation
perspective (or document tree model perspective) are transparent.

---->N



.:||:._.:||:._.:||:._.:||:._.:||:._.:||:._.:||:._.:||:._.:||:._.:||:._.:
||:.

Nathan Young
CDC Site Design & Development->Interface Development Team
A: ncy1717
E: natyoung@xxxxxxxxx

> -----Original Message-----
> From: Alexander Johannesen [mailto:alexander.johannesen@xxxxxxxxx]
> Sent: Tuesday, March 21, 2006 3:15 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re: [xsl] Re: Un-cdata-section-elements
>
> On 3/22/06, yguaba@xxxxxxxxxxxx <yguaba@xxxxxxxxxxxx> wrote:
> > I'm not sure I understand your problem.
>
> I need ;
>
> <script type="javascript">
>  // <![CDATA[          <----------- It's this first '//' what
> I'm after
>  javascript here ...
>  // ]]>
> </script>
>
> > If this is the case, there's nothing to be escaped: you
> just take the
> > contents of the CDATA section and output it as plain text
> between two
> > SCRIPT tags.
>
> No, that's not good enough; the output I want to be valid XHTML 1.0
> Strict, and as such it needs to live in a CDATA section, but
> best-practice also wants single-line comments to preced the CDATA
> element, as demonstrated above.
>
>
> Alex
> --
> "Ultimately, all things are known because you want to believe
> you know."
>                                                          -
> Frank Herbert
> __ http://shelter.nu/
> __________________________________________________

Current Thread