I’ve never really understood why people use transitional doctypes. Perhaps this comes from my time working in libraries: 7 years being beaten over the head with MARC format and various other library standards gave me a sense for correct coding before I ever sat down and decided to develop websites.
Data formatting is, believe it or not, quite important. The power of XML is wrapped up in formatting – if you’ve left off a closing tag or incorrectly nested XML, you’ve lost significant parts of the overall meaning of the document. Even though HTML isn’t XML, why should it be treated with any less rigidity? The debate between HTML and XHTML has been going on for a long time – and it’s commonly opined that the most important choice is actually between strict and transitional doctypes.
Recently, this topic has experienced a bit of a resurgence in discussion:
My opinion falls squarely in the XHTML 1.0 Strict camp. I don’t feel there’s any value in using XHTML 1.1; but I DO feel there’s a value inherent in the rigidity required by XHTML, thus my preference for that over HTML. What are the issues surrounding XHTML 1.0 Strict?
XHTML and HTML MIME Types
A common argument raised by HTML advocates is the fact that most XHTML documents are delivered to the browser using the MIME type text/html. In many browsers, this means that the document is treated as HTML, regardless of the declared document type. In order to actually deliver XHTML, the MIME type application/xhtml+xml or text/xml is required. Without this MIME type, the advantages of XHTML are irrelevant. (Of course, you can’t serve application/xhtml+xml to Internet Explorer, but that’s a separate issue.)
Or are they?
Actually, I consider the MIME type issue to be more or less irrelevant. My own reasons for using XHTML 1.0 Strict are for consistency. I really dislike the fact that HTML doesn’t require all tags to be closed in order to be valid – and, in fact, requires that certain tags (
<link> for example) must NOT be closed. Yes, this is petty: but to me, it’s sufficient reason to not use HTML.
What are the benefits to Transitional Doctypes?
I’ve heard a variety of other ideas: transitional doctypes for browser compatibility (something which I’ve always observed, personally, to be a problem), transitional XHTML doctypes because transitional allows you to deliver XHTML as text/html (a fallacy, as far as I can tell). None of these other ideas seem to hold water, however.
There is one, final reason to use alternate doctypes: and it’s one which is very annoying to me. Many 3rd party tools are run through
<iframe>s – most types of Amazon affiliate links and many types of embedded content. If you want to incorporate this kind of tool, you’re pretty much stuck either failing to validate or using something other than the strict doctype.
Frustrating…and I don’t have any kind of an answer for it.
When you examine the issues this is a tricky question. There are lots of reasons to use both doctypes, and there are perfectly good reasons for using HTML and XHTML. Personally, I’ll use transitional doctypes exactly the way they’re intended: only when absolutely necessary. Otherwise, it’s strict all the way. I’ll always choose XHTML if I have any choice, because I prefer it: and someday, when browsers can actually consistently handle the XHTML as XML, I’ll celebrate. Until then, I’m just not going to worry about MIME types.