xsl-list
[Top] [All Lists]

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

2006-03-21 16:29:48
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(_at_)cisco(_dot_)com  

-----Original Message-----
From: Alexander Johannesen 
[mailto:alexander(_dot_)johannesen(_at_)gmail(_dot_)com] 
Sent: Tuesday, March 21, 2006 3:15 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Re: Un-cdata-section-elements

On 3/22/06, yguaba(_at_)yahoo(_dot_)com(_dot_)br 
<yguaba(_at_)yahoo(_dot_)com(_dot_)br> 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/ 
__________________________________________________

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>