eXtensible HyperText Markup Language. The HTML
to replace HTML 4.01. It has a tighter syntax specification which makes it
easier to write a conforming browser or validator. It allows you to mix XML and
HTML in the same document. This will allow smarter search engines that take into
account the tag context of a piece of data. XHTML is almost identical to HTML
4.01. All tags must nest properly and all start tags must have an matching end
tag, even <p> and <br>. All tags must be specified in lower case.
You can prepare for XHTML by cleaning up your HTML. XHTML has two big advantages
over HTML.
- XHTML has a much stricter syntax. If the document is not perfect, the browser
will refuse to render it. The advantage is, if your document works on one
browser it will work on all.
- It is a flavour of xML. This means it is designed for easy data extraction or semantic
content to use the latest in term.
Like HTML, there three basic types of XHTML.
- XHTML 1.0 Strict - Use this when you want really clean structural mark-up, free
of any markup associated with layout. Use this together with W3C’s Cascading
Style Sheet language (CSS) to get the font, color, and layout effects you want.
- XHTML 1.0 Transitional - Many people writing Web pages for the general public to
access might want to use this flavor of XHTML 1.0. The idea is to take advantage
of XHTML features including style sheets but nonetheless to make small
adjustments to your markup for the benefit of those viewing your pages with
older browsers which can’t understand style sheets. These include using the body
element with bgcolor, text and link attributes.
- XHTML 1.0 Frameset - Use this when you want to use Frames to partition the
browser window into two or more frames.
Because more than just browsers can process XHTML, the cognoscenti refer to
anything that reads it as a user agent.
You can convert your web pages to XHTML using HTMLValidator
Tidy, HTMLTidy,
or Amaya.
When you are done, it looks pretty much as it always did with these exceptions:
Converting to XHTML
Even if you don’t flip to XHTML right away, you can prepare for it now by
getting your tags all balanced and everything syntax checked.
I am not at all convinced that converting to XHTML is a game worth the candle.
It is a huge amount of mindless, pointless busy work. The resulting code is
bulkier. The resulting code takes more work to maintain. I don’t see how the end
result is really any easier to extract information from as claimed. You can get
an idea of what you are in for converting to XHTML by:
- Running some sample pages through a converter like HTMLTidy
to do the bullwork, like convert <br> to <br
/>
- Prepend a strict XHTML header on your sample pages like this:
- Then run your pages through a verifier like HTMLValidator
and look at what errors pop out.
XTML has idiotic restrictions, for example that <a
tags can’t appear in the body. They must be nested inside some other tag. You
could spend months manually “cleaning” just that one problem, all to
satisfy some prissy old batchelor at W3C who made up these arbitrary rules.
What I Really Think of XHTML
XHTML is an utterly ridiculous exercise. Its intent is to incovenience humans,
and waste thousands of man years of labour to make the files marginally simpler
for a computer to parse. That is a form of idolatry. Sacrificing labour to
mildly convenience a computer is as silly as worshipping a computer with burnt
offerings..
To add insult to injury. when you are done, some browsers, such as IE, will be
confused by the XHTML header and a do a worse job of rendering than ever.