www.webdeveloper.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 24

Thread: XHTML or HTML

  1. #1
    Join Date
    Jan 2005
    Location
    Nottingham NH
    Posts
    399

    XHTML or HTML

    Hoping to get some insights here:

    First some background. For several days I have been doing some study on XHTML versus HTML. I have been writing all of my mark-up with fully-valid XHTML lately, either Transitional or Strict. It's pretty easy to do and not very far removed from HTML 4.01. I am, however, learning several things which may indicate that this is not a good move, even though W3C promotes XHTML 1.0 as the preferred minimum standard to employ currently.

    Why it's supposedly not a good idea. It is my understanding that very few sites employing XHTML (including the vast majority of those "really good" XHTML-Guru sites you know of and love so much) are doing it properly. The developers are sending their pages to the browser as text/html. As such the browser is reading the page as HTML, not as an XML application as it's supposed to. Therefore the browser must go through the trouble of negating all of the extra mark-up (i.e. closing slashes />). If, however, you do send the document to the browser as a true XML application instead of text/html, then the browser doesn't like it. It'll make Moz-FF go into quirks mode instead of standards compliance mode. With MSIE it is my understanding it won't even work as XML is yet to be supported and thus won't even present you with the page render. For MSIE you're supposed to create a mirrored HTML page to satisfy that browser.

    Three levels of failure. It is my understanding that a number far fewer than 1% of XHTML sites are failing in one of these three categories.
    1) The page isn't valid. This is weak. If it's not going to be valid and maintain it as such, it is considered an bad thing, much worse can using very old HTML.
    2) The developer makes one or two pages comply, but through laziness fails to make the rest of the site comply. This is said to be a bad thing to do as well.
    3) The XML MIME-type isn't added to the .htaccess file thus making the whole thing a wash. If the MIME type isn't setup to be supported by the server, it will never be available to a capable browser regardless of how it's dished out.

    My take on this. To be frank I'm confused as to what to do. Lots of mixed signals. I think I want to (and have been) making fully-valid XHTML sites, strict by preference, but I'm torn as it seems the best site to make is one written to the HTML 4.01 Strict standard. At this point I don't know what to do. Jump on the XHTML bandwagon and don't look back and do what W3C wants me to do, or to do what's probably best at this time by sticking to HTML. I'm gaining all sorts of benefits using page divisions instead of rigid, must-be-rendered structures like tables, and I'm totally sold on CSS. And PHP makes me happy. But the XHTML thing is less clear to me and I really want to make the best sites humanly possible.

    Any feedback is appreciated.

  2. #2
    Join Date
    Jul 2003
    Location
    New York City
    Posts
    2,771

    1) Mozilla Firefox is one of the few browsers that properly handles XHTML as an application of XML, and does not enter quirks mode when the page is passed as such.
    2) Technically, according to the W3C, and XHTML page may be passed as text/html, if one follows the
    HTML Compatability Guidelines. However, one looses the benefits of XHTML this way.
    3) This issue has been debated many a time, with some good points made.
    • http://www.webdeveloper.com/forum/showthread.php?s=&threadid=43269&perpage=40&highlight=xhtml%20html&pagenumber=2
    • http://www.webdeveloper.com/forum/showthread.php?s=&threadid=53794&highlight=XHTML+HTML

    And Others, just do a search.

  3. #3
    Join Date
    Jan 2005
    Location
    Nottingham NH
    Posts
    399
    Thank you. I have searched a lot. I 've gotten lots of opinions as well. I'm just looking for more. I do believe I am leaning towards the use of XHTML Strict as my default mark-up language, and still sending it to the browser as text/html (for the time being). From what I can tell, the "hazards of doing this" as I've seen it written are not so critical so as to justify not using the newest standard, if it's validated and done right of course.

    Do you agree?

  4. #4
    Join Date
    Jul 2003
    Location
    New York City
    Posts
    2,771
    Originally posted by &gb;
    Thank you. I have searched a lot. I 've gotten lots of opinions as well. I'm just looking for more. I do believe I am leaning towards the use of XHTML Strict as my default mark-up language, and still sending it to the browser as text/html (for the time being). From what I can tell, the "hazards of doing this" as I've seen it written are not so critical so as to justify not using the newest standard, if it's validated and done right of course.

    Do you agree?
    Not particularly. My thinking is, why use XHTML 1.0 Strict if there are no benefits in it. Once you pass it as text/html you lose the main benefit of XHTML 1.0 - the ability to treat it as XML and combine it with other markup languages. Now, XHTML 2.0 is a different story. Truth be told, I'm rather excited about it as it will actually change our current vocabulary of elements and bring more to the table then HTML. But that has to be passed as application/xhtml+xml And at this time, with Internet Explorer dominating the market, that's not practical at all. Then you're getting into content negotiation, which is adding more work to the server. So ask yourself "What benefits are there in doing this?" If you just want to be up on the latest specs, that's stupid. You have to keep it into what is practicle. Often the newest and latest isn't the most practicle. Many open-source softwares have a choice "Latest Version" and "Last Stable Version". Now, if you just like new things and it's personal, you may go with Latest version. But if you are being professional, looking to make money off of it, or any such, you're goign to go with "Last Stable Version" The same here applies to the markup languages.

    Hey, I'd love to be able to use all the great features of CSS 2.1 There's some rather neat stuff in there. But it's just not practicle most times because there isn't support for it.

  5. #5
    Join Date
    Jan 2005
    Location
    Nottingham NH
    Posts
    399
    That's cool. I appreciate the second response. Just today I've read 25 or so valid arguments, yours certainly included (and well presented too). It's all good food for thought. For me, I'm really torn, wavering back and forth.

    Any other opinions about this?
    (I figured this would be a more active topic here.)

  6. #6
    Join Date
    Jun 2004
    Location
    England
    Posts
    2,972
    Firstly: xhtml 1.0 should have a text/html MIME type, it's xhtml 1.1 and above that have a MIME type of text/xml + xhtml.

    I use xhtml 1.0, it's no different from html 4.01 but I figure that when there is more support for the text/xml + xhtml MIME type then I'll be ready to jump strait into it.
    Disclaimer. (1) Whilst I will help you sometimes, if I feel like it, and my advice in relation to your actual question will be of good quality: my posts are to be taken with a pinch of salt. I will be sarcastic, deploy irony and include obscure cultural references for my own amusement without warning.
    (2) You will gain nothing from complaining, and if you try to argue with me then you will not win. No matter how noble your battle seems, I am still better than you, don't be an hero.

  7. #7
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    Some interesting reading: http://annevankesteren.nl/search?q=xhtml

  8. #8
    Join Date
    Dec 2002
    Location
    Manchester, UK
    Posts
    6,275
    Every fight is a food fight when you’re a cannibal.

  9. #9
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,270
    A few select points.

    * "Jump on the XHTML bandwagon and don't look back and do what W3C wants me to do". Where is it written that the W3C wants you to use XHTML to publish you documents on the web?

    * Though it causes me great pain to admit it, MSIE handles XHTML perfectly - and far better than FF or Opera. The problem is that MSIE ignores MIME types and instead pays attention to the file name extension. Save some XHTML with an "xml" extension and try it out. You'll note, however, that MSIE displays the document tree. This is what is supposed to happen with XHTML. XHTML is not HTML. You need a second file, lets call it "test.xsl":

    <?xml version="1.0" encoding="utf-8"?>
    <xsl:stylesheet
    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:output
    doctype-public="-//W3C//DTD HTML 4.01//EN"
    doctype-system="http://www.w3.org/TR/html4/strict.dtd"
    encoding="iso-8859-1"
    indent="yes"
    method="html"
    version="4.01"/>

    <xsl:template match="*|@*" >
    <xsl:copy>
    <xsl:apply-templates select="@*"/>
    <xsl:apply-templates/>
    </xsl:copy>
    </xsl:template>
    </xsl:stylesheet>


    And then the prolog of the first file needs to contain:

    <?xml version="1.0" encoding="UTF-8"?>
    <?xml-stylesheet type="text/xsl" href="test.xsl"?>


    You'll note that to get the page to display, we need to use XSLT to have the browser transform the XHTML into HTML.
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

  10. #10
    Join Date
    Jan 2005
    Location
    Nottingham NH
    Posts
    399
    Thanks guys. Good links, one is new to me.
    I'll play with that coding, to check it out. Thanks.

    The reason I say it's what the W3C wants is due to two things:
    1) This is what many people have been telling me during my quest.
    2) I have seen it written at W3C in so many words but in seraching I'm unable to provide a specific link.


    I did find this interesting this W3C page. Just for releated info.

  11. #11
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,270
    Originally posted by &gb;
    I have seen it written at W3C in so many words but in seraching I'm unable to provide a specific link.
    In the same way many people swear

    * That there was one tree in the center of the garden of Eden when there were two;
    * That Noah took two of everykind on the Ark when he took seveon of some kinds and two of others;
    * That the Bible supports "traditional marriage between one man and one woman" when it does not.

    One has to be really careful about what one has actually read and about what "everybody knows is true."
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

  12. #12
    Join Date
    Jan 2005
    Location
    Nottingham NH
    Posts
    399
    Wow, that was pretty sarcastic. Please realize I made this post because I don't know all the answers, but unlike many, I choose to learn. Cut me a little slack, okay? Your reply didn't relly lend to much to this topic.

    I posted this elsewhere. I got some pretty good replies on the Accessify Forums. One of the members there did provide these two specific links which sort of support for Pro-use argument.

    http://w3c.org/International/tutoria...c/#assumptions
    http://w3c.org/International/tutoria...enc/#mimetypes

  13. #13
    Join Date
    Jul 2003
    Location
    New York City
    Posts
    2,771

    Lack of support and having to modify what you use for different browsers is reason enough for me. What is wrong with HTML 4.01 Strict? Nothing. What does XHTML bring if you're not using other XML languages? Nothing. I no longer see a reason to be using XHTML over HTML for now.

  14. #14
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,270
    Originally posted by &gb;
    Wow, that was pretty sarcastic. Please realize I made this post because I don't know all the answers, but unlike many, I choose to learn. Cut me a little slack, okay? Your reply didn't relly lend to much to this topic.

    I posted this elsewhere. I got some pretty good replies on the Accessify Forums. One of the members there did provide these two specific links which sort of support for Pro-use argument.

    http://w3c.org/International/tutoria...c/#assumptions
    http://w3c.org/International/tutoria...enc/#mimetypes
    Please forgive me. I didn't intend to be sarcastic; I simply wanted to demonstrate how we have to be very careful about what we think that we know. Put another way, a lot of people seem to think that just because XHTML exists the W3C wants us to be using it.
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

  15. #15
    Join Date
    Jan 2005
    Location
    Nottingham NH
    Posts
    399
    That's cool. Thanks.

    This does seem to be a topic just begging for debate.

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