Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 25
  1. #1
    Regular Coder
    Join Date
    Nov 2002
    Posts
    672
    Thanks
    1
    Thanked 1 Time in 1 Post

    choose which dtd?

    I just learned the html dtd (from a template because no one will remember such a thing) but I want to know what the xhtml one is. Also, what is the strict, transitional, and all that? Does it apply to how strict the errors jump on you? I'm strict on it enough as it is, so I see no errors jumping up either way...except that the validator.w3.org wants a dtd. So which do I choose (I don't use frames, and cgi) and what is a page with a working example? I've never seen an xhtml page on the net.

  • #2
    Master Coder
    Join Date
    Feb 2003
    Location
    UmeŚ, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    Hmm, what DTD to chose is depending on what features you want. As with html, if you want iframes, use loose. Use loose if you want to use name attribute on anything other than form elements.

    <?xml version="1.0" encoding="utf-8"?>
    <!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" xml:lang="en-gb">

    That's the strict doctype. You might be more interested in transitional or frameset.

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">



    Well, what to think of:
    - Never forget to close an empty tag. <br> --> <br />
    - Never shorten anything: <script defer> --> <script defer="defer">
    - Never use & in a xhtml document unless it's the beginning of an entity. This includes attribute values such as href on a tags, and embedded information such as scripts or stylesheets. You can only use them in nonparsed sections, iow in CDATA blocks or comments.
    - Because of this, it might be a good idea to always use external stylesheets and scripts instead of embedded.
    - Use <?xml-stylesheet?> instead of <link> tag for including stylesheets. Or, do a combination. An <?xml-stylesheet?> can point to any element that has an id attribute using the normal #id syntax.
    - Remember that parsers are allowed to discard comments without even sending them to eventual content parsers. This means if you use embedded stylesheets or scripts, you shouldn't wrap them in comments.

    - Most XML parsers doesn't support script tags. Not even that many of those with knowledge of the xhtml namespace does. Mozilla and probably Safari/Konqueror are the only ones I know of. This is because there's no standard way of including a script to be parsed in the xml standards. Possible ways in the future are to use either PIs, event/action/behavior connected stylesheets, or xlink/hlink.

    - Don't rely on state-of-the-art features specs. Xinclude, Xpointer, Xlink are relatively new, and only the oldest xml standards are present and relatively bugfree across many implementations. (XML, XSLT and not much else.)
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #3
    Regular Coder
    Join Date
    Nov 2002
    Posts
    672
    Thanks
    1
    Thanked 1 Time in 1 Post
    I've been really good about the tag stuff. Although this is the first time I've seen the stylesheet expressed not as LINK. I've gotten in the habbit of lowercase tags. So is strict the best one if I want to learn the language to its fullest? Sort of like an advanced challlenging difficulty level?

  • #4
    Master Coder
    Join Date
    Feb 2003
    Location
    UmeŚ, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    Well, it's really unpermissive, so you're forced to do right, from the start. That's a good way to learn how to do it right. It still can't check that you use the tags for their real purpose, though.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #5
    Regular Coder
    Join Date
    Jun 2002
    Location
    Iowa / Notre Dame
    Posts
    538
    Thanks
    0
    Thanked 0 Times in 0 Posts
    <?xml version="1.0" encoding="utf-8"?>

    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-gb">
    What exactly do those two lines mean. I have used them in the past because I was once told to do so...are they just turning my page into an xml document?
    My Site {Mike's Adventures}

    Yikes, forums are almost too much fun.

  • #6
    Master Coder
    Join Date
    Feb 2003
    Location
    UmeŚ, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    <?xml version="1.0" encoding="utf-8"?>

    This line - called the XML declaration, tells the XML parser what version of XML is used, what encoding is used, whether a DTD will be present or not, (standalone attribute, not present here since it defaults to false).

    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-gb">

    This line tells the xml parser what default namespace is to be used (xhtml1, in case), and what human language the document is written in.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #7
    Senior Coder
    Join Date
    Jul 2002
    Posts
    1,628
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I would stay away from using the XML declaration for now in an HTML document, its not really needed as 1.0 is the only version(right?) and the encoding can be specified in a meta element.
    Not to mention it makes IE "quirky".

    Moderator: General web building

    Get out from under them, resist and multiply.
    Get out from under precipice and see the sky.

  • #8
    Master Coder
    Join Date
    Feb 2003
    Location
    UmeŚ, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    I see no reason to let ie hinder me - I'm considering dropping support for that browser until it's on par with a minimum of op6 for CSS, moz for DOM and XML, and iCab for HTML.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #9
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Originally posted by liorean
    I see no reason to let ie hinder me - I'm considering dropping support for that browser until it's on par with a minimum of op6 for CSS, moz for DOM and XML, and iCab for HTML.
    You don't have a living to make then?

    I don't think dropping support for IE is practical, however desirable. I also exclude the xml declaration from XHTML pages because of the quirks thing.

    Having said that, IE5 is always in quirks mode, and since IE5 is a bigger audience than IE6, therefore needs to be separately tested to look okay, maybe it doesn't matter - ie, if your layout is acceptible in quirks mode as well, may as well use the XML declaration.
    Last edited by brothercake; 04-24-2003 at 02:41 PM.
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

  • #10
    Master Coder
    Join Date
    Feb 2003
    Location
    UmeŚ, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    Originally posted by brothercake
    You don't have a living to make then?
    Not on web design...

    I don't think dropping support for IE is practical, however desirable. I also exclude the xml declaration from XHTML pages because of the quirks thing.
    Well, there's a difference if you make websites that aren't singularly targeted at web designers, as most of my pages are. (It's been years since I did something for other audiences.) First of all, Mozilla is by far the most common client on my page. Second, my pages doesn't have to look the same as long as they are functional - I have no pressure on me to make things look nice, even though I try to make it so in moz at least.

    Having said that, IE5 is always in quirks mode, and since IE5 is a bigger audience than IE6, therefore needs to be separately tested to look okay, maybe it doesn't matter - ie, if your layout is acceptible in quirks mode as well, may as well use the XML declaration.
    What? IE5 bigger audience? Have a look at <http://www.google.com/press/zeitgeist.html> in the "Web Browsers Used To Access Google" box. I'd say google is a fair representation of the web surfing poulation as a whole, and IE6 outgrew lower versions halfway into 2002.

    The good thing about the xml declaration is that you can then hand all versions of iew pretty much the same stylesheets, and you don't have to fork your scripts for three alternatives when determining position, you can let it stay at two forks.


    On the other hand, I think the xml declaration shouldn't be sent unless the document is an XML document - the SGML (text/html) version should be sent without it. And, guess what? MSXML doesn't have any knowledge of the xhtml namespace, so then you'd have to add behaviors or transform the document into SGML for it to be treaded as html. (Meaning default html rendering, default html behaviors etc.)
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #11
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That's a very fair point - if your primary audience is mozilla then definitely play to mozilla. I find myself playing to mozilla anyway, but I still have to make things as good in IE, or at least, appear as good so that people who use IE won't notice what they're missing

    Seems my knowledge of browser stats is a bit out of date ... thanks.

    That's interesting what you say about only sending the XML instruction if the document is really XML - makes a lot of sense. Something like this then:
    PHP Code:
    <?php
    if (stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml")) {
        
    header("Content-type: application/xhtml+xml");
        echo (
    "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n");
        }
    else { 
    header("Content-type: text/html"); }
    ?>
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

  • #12
    Regular Coder
    Join Date
    Nov 2002
    Posts
    672
    Thanks
    1
    Thanked 1 Time in 1 Post
    What is Quirks Mode?

  • #13
    Master Coder
    Join Date
    Feb 2003
    Location
    UmeŚ, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    Have a look at <http://css-discuss.incutio.com/?page=RenderingMode>. Different browsers have different quirks mode and strict modes.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #14
    Moderator
    Join Date
    May 2002
    Location
    Hayward, CA
    Posts
    1,453
    Thanks
    1
    Thanked 21 Times in 19 Posts
    Originally posted by cg9com
    I would stay away from using the XML declaration for now in an HTML document, its not really needed as 1.0 is the only version(right?)
    Actually, the W3C is working on XML 1.1, so starting to include that declaration for XML documents should be a good idea.
    "The first step to confirming there is a bug in someone else's work is confirming there are no bugs in your own."
    June 30, 2001
    author, Verbosio prototype XML Editor
    author, JavaScript Developer's Dictionary
    https://alexvincent.us/blog

  • #15
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Originally posted by Alex Vincent
    Actually, the W3C is working on XML 1.1, so starting to include that declaration for XML documents should be a good idea.
    Would you agree with the notion that since XHTML served as text/html isn't really XML, then it shouldn't have the XML processing instruction?
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

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