Peter Williams wrote:
Apart form some trivialities (eg swapping DOCTYPE) correct XHTML is a
superset of correct HTML ?
Not really.
Apart from swapping the DOCTYPE, it is possible to create a document that
is both valid HTML *and* valid XHTML. For example, given the right
DOCTYPE, the following markup is valid HTML 4.01 and XHTML 1.0:
[listing 1]
<html lang="en">
<head>
<title>Example. </title>
</head>
<body>
<h1>Example.</h1>
<p>This is an example.</p>
</body>
</html>
However, the following valid HTML document would not be valid as XHTML:
[listing 2]
<html lang="en">
<title>Example. </title>
<h1>Example.</h1>
<p>This is an example.
</html>
and the following XHTML would not be valid as HTML:
[listing 3]
<html xml:lang="en">
<head>
<title>Example. </title>
<meta name="title" content="Exampl e."></meta>
</head>
<body>
<h1>Example.</h1>
<p>This is an example.</p>
</body>
</html>
So, if we're going to talk subsets and supersets (and forget about
DOCTYPES) then:
If H is the set of all possible valid HTML documents; and X is the set of
all possible valid XHTML documents, then there exists a non-empty set A
such that A⊂H and A⊂X, as illustrated by listing 1, which is a member
of set A.
However, as shown by listing 2, there exists a document h such that h∈H,
but h∉X. And as shown by listing 3, there exists a document x such that
x∉H, but x∈X. These last two findings show that H⊄X and X⊄H.
FWIW, I think that whether you're using XHTML or HTML, it's usually good
practice to aim for your documents to be as close to set A as possible.
--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~
http://tobyinkster.co.uk/contact