Click to See Complete Forum and Search --> : XHTML or HTML


Green-Beast
01-28-2005, 09:12 AM
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.

MstrBob
01-28-2005, 05:43 PM
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 (http://www.w3.org/TR/xhtml1/#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.

Green-Beast
01-28-2005, 05:55 PM
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?

MstrBob
01-28-2005, 06:02 PM
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.

Green-Beast
01-28-2005, 07:07 PM
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.)

the tree
01-29-2005, 03:28 AM
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.

Fang
01-29-2005, 06:43 AM
Some interesting reading: http://annevankesteren.nl/search?q=xhtml

David Harrison
01-29-2005, 07:01 AM
http://www.autisticcuckoo.net/archive.php?id=2004/11/03/content-negotiation

Charles
01-29-2005, 07:42 AM
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.

Green-Beast
01-29-2005, 08:06 AM
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 (http://w3c.org/International/tutorials/tutorial-char-enc). Just for releated info.

Charles
01-29-2005, 08:14 AM
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."

Green-Beast
01-29-2005, 08:44 AM
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 (http://www.accessifyforum.com/viewtopic.php?t=2363). One of the members there did provide these two specific links which sort of support for Pro-use argument.

http://w3c.org/International/tutorials/tutorial-char-enc/#assumptions
http://w3c.org/International/tutorials/tutorial-char-enc/#mimetypes

MstrBob
01-29-2005, 10:16 AM
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.

Charles
01-29-2005, 12:29 PM
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 (http://www.accessifyforum.com/viewtopic.php?t=2363). One of the members there did provide these two specific links which sort of support for Pro-use argument.

http://w3c.org/International/tutorials/tutorial-char-enc/#assumptions
http://w3c.org/International/tutorials/tutorial-char-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.

Green-Beast
01-29-2005, 01:01 PM
That's cool. Thanks.

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

Stephen Philbin
01-30-2005, 08:27 AM
I wouldn't encourage or discourage either. Certainly not in a general context anyway. I'd discourage the use of xhtml1.0 in favour of 1.1 if you are going to use xhtml, 1.0 is pointless and really does serve no purpose. I think deciding between html and xhtml is probably the stupidest thing any web developer could possibly do really (no offence ment by that mind), any web developer/designer that wants to claim to be a professional should (in my opinion) have a mastery of, or be in the process of mastering both. Obviously you have to decide which would be best to use for a particular project, but deciding not to use or to only use html for all projects is just (in my opinion) absurd.

As a self teaching excercise, I'm building a full sized content management system with in-built forum that will meet as much of the web content accessibility guidelines as is humanly possible and will serve its self as XML to any browser that accepts the mime type and html to any that doesn't. Why would I take on such a large task in such a way? Well like I said, just to learn. Not because I think taking the xhtml route is the best. I know there are many up-sides and downs to using xhtml and I use such a big project to do it on because I know it will throw a great number of different situations and uses that I must investigate and test out, that I simply would never have thought of just by assuming I had learned everything.

I've already identified an area of the cms where I'm going to try and make my own rudimentary mark up language and then mix it into the xhtml 1.1 by taking advantage of the modularisation of xhtml.

It will be a live site and it will be used by many people and it will be nowhere near as stable as it would have been had I just buried my head in the sand, stuck with plain old html and pretended xhtml didn't exist and will never become the norm. It'll almost certainly need a re design as soon as it is finished, but I will have learned a hell of a lot and I will be much more ready for what is to come.

Master them both and the requirements of the project will tell you which is required. For now it will almost always be html 4.01 strict, but only an idiot would not be ready to be able to switch straight over to xhtml and use it that properly on the next project.

Charles
01-30-2005, 08:37 AM
One note about XHTML 1.1&trade;. For the most part it is just 1.0 Strict but with the DTD written in modular form so you can use the modules to build other mark up languages. I tried it once but I found that I couldn't get the thing to pass either the Aelfred parser used by Saxon or the Xerces parser used by Xalan. Either there's an error in that DTD or it is just too complicated for those parsers. And what's the point of XHTML if you can't get it to parse?

MstrBob
01-30-2005, 08:44 AM
If you're taking advantage of XML, then you're using the benefits of XHTML. Thus, the use of it is justified. The point I'm trying to make is that if you're thinking that you'll use XHTML while not working with any XML, just because, then it's pointless because of the lack of support. Now, I take issue with you're saying XHTML 1.0 is pointless.

According to the W3C, HTML-Compatabile XHTML 1.0 may be passed as text/html. XHTML 1.1 should not be passed as text/html. Now, in a world where Internet Explorer dominates, and you'll need to either pass the XHTML as text/html if you wish to use XHTML, XHTML 1.0 is important since it may be passed as such. Otherwise, you'll have to get into content negotiation and pass XHTML 1.1 properly to supporting useragents, and HTML to non-supporting user agents. Either way, this creates additional work for the website's development. Considering there's nothing wrong with HTML, if you're not taking advantage of XHTML's benefits, it's rather pointless.

Now of course I'm not saying DON'T USE XHTML. I'm just saying think about if you really need to be using it. If XHTML isn't neccessary, then use HTML 4.01 Strict.

Stephen Philbin
01-30-2005, 08:07 PM
I say 1.0 is pointless because if you're using 1.0, then you might as well be using 4.01. Whilst the W3C does advise you to not send 1.1 as text/html, I really don't have a problem with doing so at all. I send 1.1 as XML to browsers that accept the mime type and as text to IE. The reason I don't mind sending 1.1 as text/html to IE is simple: IE can't tell the difference between xhtml1.1, xhtml1.0, html4.01 and Herer's special mega markup 20.8 almost strict but just a bit too lazy to be classed as such.

So if IE can't tell to difference between

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

and

<!DOCTYPE for moocows in the windywoo summer need dingdongs to keep them cool
"http://www.teh_big_inturnet.com/ooh_look_a_shiney_toe.chuff">

Why on earth would I worry about IE trying to differentiate between 1.1 and 1.0?

Things like the dtd problem Charles pointed out are (to my mind) the very reason why both should be practiced. Naturally any developer must have their full and solid grounding in html but there's still plenty of aspects of practical usage that need investigating and working out. It only makes it more clear to me that if someone that has been using xml for a while now is still having trouble validating documents under certain conditions, the I've sure as hell got a long way to go and I'm not going to just sit around doing nothing about it until it's too late.

I learn now so I can do later. Pretty obvious logic really.

russell
01-30-2005, 08:43 PM
the key is reaching the widest audience. i have to agree with charles' first post, as well as the points mstrbob makes.

in truth, u could go around using html 4.0 and reach a pretty wide audience.

learn xml, xhtml and css but do what makes the most sense to reach your target audience. in most www cases, this will be html 4.01 with a strict dtd

Stephen Philbin
01-30-2005, 09:41 PM
Aye. The number of cases (as things are now) where html will not be the best option will be very small. Having said that though, this will not always be the case and because it won't, I regard dismissing/ignoring/rejecting xhtml as sheer lunacy and downright unprofessional. Just as ludicrous as renouncing html and sticking only to xhtml. Either extreme is just an outright bad idea.

The question should not be "should I use html or xhtml?" but instead should be "when and why would I use one instead of the other?".

russell
01-30-2005, 11:39 PM
Somebody mark this day on the calendar, when bob, herer, russell and charles ALL agree on an issue!!!

cheers all :)

Stephen Philbin
01-31-2005, 07:01 AM
I think it should be noted in diaries actually. Not a calendar. :p ;)

Robert Wellock
01-31-2005, 09:06 AM
No, a slate is much more effective. :D