Skip to main content

A bit more on XHTML

Strictly Conforming XHTML

All HTML documents produced as part of this course conform to the basic rules of XML and are said to be well-formed. A strictly conforming document is well-formed but should also reference the official XHTML DTD and obey the rules specified within that DTD. Every strictly conforming XHTML document must:

  • begin with an XML declaration and must begin with the following line:
    <?xml version="1.0" charset="iso-8859-1" ?>

  • have a DOCTYPE declaration just after the XML declaration shown above, of the form:
    <DOCTYPE html PUBLIC "-//W3C/DTD XHMTL 1.0 Strict//EN" "http://www.w3.org/TR/xhtml/DTD/strict.dtd">
    The complexity of this line is legacy syntax from SGML and defines the public name of the DTD and its location via the URL.

  • Every document must contain a single element and this element must be use the xmlns attribute to declare the namespace [a place where all the rules can be found] for XHTML and is usually of the form:
    <html xmlns="http://www.w3.org/TR/xhtml1">

So to turn any Web page you have produced as part of this course into a "strictly conforming" XHTML Web page replace the <html> tag at the top of your page with:

<?xml version="1.0" charset="iso-8859-1" ?>
<DOCTYPE html PUBLIC "-//W3C/DTD XHMTL 1.0 Strict//EN" "http://www.w3.org/TR/xhtml/DTD/strict.dtd">
<html xmlns="http://www.w3.org/TR/xhtml1">