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). Example 4-4. time.html <?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 > <h1>Time</h1> <table 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. Figure 4-2. time.html in Firefox 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. Figure 4-3. W3C MarkUp Validation Service Figure 4-4. Results from the W3C MarkUp Validation Service 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). 4.4.1 See Also 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 XHTML-Print: http://www.w3.org/TR/xhtml-print |