www.webdeveloper.com
Results 1 to 5 of 5

Thread: XHTML 1.0 Strict Content Data

  1. #1
    Join Date
    Nov 2002
    Location
    Singapore
    Posts
    44

    XHTML 1.0 Strict Content Data

    Hi all. I'm rather interested to "upgrade" my HTML from XHTML 1.0 Transitional to Strict.

    I have several problems. First, I heard that internal JavaScript code and CSS code have to be commented out. I tried using a convertor before and the new XHTML code (Transitional) uses this:

    <style type="text/css">
    /*<![CDATA[*/

    css code here....

    /*]]>*/
    </style>

    However from what I read in HTML Goodies, I suppose it is no longer like this?

    I tried something like that but it doesn't work:

    <style type="text/css">
    <![CDATA[

    css code...
    </style>

    Another question, about comments. Since <!-- COMMENT --> Cannot be used in XHTML Strict, what should I use? I tried

    <![CDATA[ COMMENT ]]>

    but it's an error and the comment is displayed on the page.
    ]]>

  2. #2
    Join Date
    Nov 2002
    Location
    XYZZY - UK
    Posts
    1,760
    Normally using <!-- Some Comment --> will work although it is best to use external files.

    You cannot have JavaScript that uses certain characters like the double dash delimiter -- within the script itself if it is contained within an XHTML page, or it thinks it is a comment, try this:

    Code:
    <script type="text/javascript">
            //<![CDATA[
    <!-- Begin JavaScript
    
    // End Hiding -->
            //]]>
    </script>

  3. #3
    Join Date
    Nov 2002
    Location
    Singapore
    Posts
    44
    Um... comments and external files??

  4. #4
    Join Date
    Nov 2002
    Location
    XYZZY - UK
    Posts
    1,760
    An example of an external JavaScript link:

    <script type="text/Javascript" src="somescript.js"></script>

    An example of an external CSS link:

    <link rel="stylesheet" href="somefile.css" type="text/css" />

    An example of an internal JavaScript

    <script type="text/javascript">
    //<![CDATA[
    document.write('<p>Hello<\/p>');
    //]]>
    </script>

    Alternatively you could have this:

    <script type="text/javascript">
    <!--
    document.write('<p>Hello<\/p>');
    // -->
    </script>

    Or combine the two as I originally wrote, basically <!-- Some JavaScript Code //--> is the old method.

  5. #5
    Join Date
    Nov 2002
    Location
    Singapore
    Posts
    44
    Ok I get it. So do we have to comment out internal CSS code using this as well?

    PS. My question was on writing comments. I thought <!-- COMMENTS --> isn't allowed in XHTML strict?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles