W3C has morphed HTML into XHTML, but they still splash around in the same gene pool.
XHTML 1.0, a reformulation of HTML, appeared in 2000 as a W3C recommendation (http://www.w3.org/TR/xhtml1/). The simple difference between HTML and XHTML is that the tags in an HTML document are based on an SGML DTD, but the tags in an XHTML document are based on an XML DTD, and, as such, XHTML is an XML vocabulary.
An XHTML document must be well-formed XML, and may be validated against one of three official DTDs: transitional (http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd), strict (http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd), and frameset (http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd). The transitional DTD permits some older HTML elements that have been eliminated in the strict DTD. The frameset DTD has elements for creating frames.
Here is an example of a strict XHTML document (Example 4-4).
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Time</title> </head> <body style="font-family:sans-serif"> <h1>Time</h1> <table style="font-size:14pt" cellpadding="10"> <tbody align="center"> <tr> <th>Timezone</th> <th>Hour</th> <th>Minute</th> <th>Second</th> <th>Meridiem</th> <th>Atomic</th> </tr> <tr> <td>PST</td> <td>11</td> <td>59</td> <td>59</td> <td>p.m.</td> <td>true</td> </tr> </tbody> </table> </body> </html>
This document looks remarkably similar to an HTML document in text form and in a browser (see Figure 4-2). It begins with an optional XML declaration, followed by a document type declaration for the string XHTML 1.0 DTD. The XHTML 1.0 namespace (http://www.w3.org/1999/xhtml) is declared on the html element. The remaining markup is classic HTML and CSS; however, the elements are all lowercase, as mandated by XHTML 1.0.
You can validate this document using the W3C MarkUp Validation Service at http://validator.w3.org (see Figure 4-3). You can submit a document on the Web or upload a local document, as shown. The outcome of successfully validating this document against the strict XHTML DTD is shown in Figure 4-4.
After XHTML 1.0, XHTML started trending toward modularization. This means that the DTDs were modularized?divided into smaller files?to facilitate use on smaller devices that don't need or want an entire XHTML DTD. Work is now underway at the W3C on XHTML 2.0 (http://www.w3.org/TR/xhtml2/), but there are several other XHTML-related specs sandwiched in between 1.0 and 2.0 (http://www.w3.org/MarkUp/#recommendations).
XHTML Basic: http://www.w3.org/TR/xhtml-basic
Modularization of XHTML: http://www.w3.org/TR/xhtml-modularization
XHTML 1.1?Module-based XHTML: http://www.w3.org/TR/xhtml11
XHTML Events: http://www.w3.org/TR/xml-events