Here are some notes on using XHTML to markup a document. First we will look at how XHTML differs from HTML, and why we should use it in preference to HTML
XHTML is HTML described as an application of XML. It is very similar to HTML, indeed all the element names and their semantics are identical, but it has some important differences. We will look at the more important of these now.
Here are the major differences that concern us when we use it as a markup language. There are others, but they will probably not concern us. You should consult the XHTML spec (www.w3.org) for a full list of differences.
cellpadding="10", NOT cellpadding=10.
'img'element must take a special form, namely
<img/>. Not the penultimate forward slash.
<li>...</li>. Implied closing tags are not allowed.
<body>...</body>tags can be implied. In XHTML they must be written out in full.
xmlnsattribute on the
N.B. The penultimate closing slash on empty elements such as the
<img/> element can cause a problem in older browsers. For this reason it is recommended that you leave a space before the slash, namely
Because XHTML is XML, it has all the virtues of XML. In particular XML tools can be used on XHTML documents. This means that they can be easily converted to another document type, and they can be easily searched and manipulated. This is an invaluable boon for researchers.
For the purposes of marking up an historic document, it is imperative that we just use the structural and semantic elements to markup the document. Even if the original text was bolded, use the
<strong> element. We can not stress too strongly that you should not use any of the style elements of XHTML!!!. We repeat 'Do not use any of the style elements of XHTML!!!'. All styling should be done by style sheets.
XHTML is a very simple language as far as 'book' type languages go, and it is not very descriptive. In fact XHTML really only defines the structure of the document, and with a few exceptions, it says nothing about the content of the document. All we can do is say that such and such is a paragraph or a level 1 heading or a paragraph etc. Other XML based languages such as the XML we are advocating in the HWG pages allow a much richer description of the content of the document. Further more XHTML does not allow many levels of nesting. We can however get round these short comings using the div element
We can nest the div element to any depth we want, and we can assign semantic meaning to each element using the class attribute. We will see how to do this on the next page!