I promised a series of articles about emerging web technologies, so here is the first one.
XHTML is the next evolution of the omnipresent HTML. There aren't many obvious differences between XHTML and HTML, apart from the stricter restrictions on tag and attribute formatting. This prevents the creation of 'bad markup' that is so prevalent with HTML pages (especially ones generated by filthy software such as Microsoft Frontpage).
<INPUT TYPE=CHECKBOX VALUE=1 CHECKED>
<input type="checkbox" value="1" checked="checked" />
- All attribute values have to be surrounded by double-quotation marks (")
- All attributes and tag names have to be lower-case
- All tags have to either self-close (e.g.
<tag />), or be closed properly (e.g.
- All attributes must have a value (e.g.
- All elements must be properly nested (e.g. you can't have a paragraph element just below another paragraph element).
idattribute has replaced the
nameattribute for most things (including absolute CSS referencing).
- Some elements are now mandatory: the DOCTYPE definition, the
<head>) and the
Apart from being easier to view and parse than HTML, XHTML is extensible. It is actually just another standard XML namespace now, instead of being an entirely different markup languge. This allows the use of XML namespaces in XHTML, and other such XML-only paradigms.
That code could be inserted directly into an XHTML document almost anywhere (although putting it in the
<head> section wouldn't be very helpful). Providing your browser is supportive of this functionality (not many are yet, as not many have inbuilt MathML/SVG functionality), this will render as proper MathML. (I will cover MathML more fully in a later article.)
One of the things that is required to create an XHTML page is the DOCTYPE definition, and a couple of adjoining tags. Here is the minimal XHTML template that cannot be reduced further:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<title>XHTML 1.1 Strict</title>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=iso-8859-1" />
Notice that I have added in the
<meta> MIME type tag. This is because the above template uses XHTML 1.1 Strict, as opposed to XHTML 1.0 Transitional. XHTML 1.1 Strict has an added restriction in that it should if at all possible be sent out with the MIME type of "application/xhtml+xml" as opposed to "text/html" which is fine for HTML and XHTML 1.0. This is all wonderful and happy for decent browsers such as Mozilla Firefox, but old browsers such as Microsoft Internet Explorer 6 die when given that MIME type. This forces people to create logic at the server to decide what the browser is, and what to set the MIME type as.