[The HTML Writers Guild Logo]


The HTML Writers Guild

Project gutenberg
[Previous] [HWG Homepage] [Gutenberg Index] [Next]

Marking up documents in XHTML I

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

What is XHTML?

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.

How does XHTML differ from HTML

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.

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 <img />

Why should I use XHTML?

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.

Using XHTML to style

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.

The shortcomings of XHTML

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

Getting round the short comings

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!

[Previous] [HWG Homepage] [Gutenberg Index] [Next]

[Valid XHTML 1.0]
This page is maintained by frank@hwg.org. Last updated on 7 February 2000.
Copyright © 2000 by the HTML Writers Guild, Inc.