it isn't too terribly difficult to bring HTML 4 documents up to par with the XHTML 1.1 specification. You've already learned about the ways in which XHTML documents differ from HTML documents. These differences become your guide to converting HTML to XHTML.
Following is a checklist to use as a guide while performing the conversion from HTML to XHTML:
1. | Add a document type declaration that declares the XHTML 1.1 DTD.
|
2. | Declare the XHTML 1.1 namespace in the html element that matches the DTD.
|
3. | Convert all element and attribute names to lowercase.
|
4. | Match every start tag with an end tag.
|
5. | Replace > with /> at the end of all empty tags.
|
6. | Enclose all attribute values in quotes (").
|
7. | Make sure that all elements and attributes are defined in the XHTML 1.1 DTD; use CSS styles to replace deprecated presentation tags.
|
8. | Convert special characters to entity references; for example, " becomes " (see Table D.1 for more details).
Table D.1. Characters to Avoid Using in XHTML PagesReplace This… | With This… |
|---|
& (ampersand) | & or & | " (quotation/inch mark) | " or " | < (open angle bracket) | < or < | > (close angle bracket) | > or > | [ (open square bracket) | [ | ] (close square bracket) | ] | ' (apostrophe/single quote) | ' |
|
see whether your pages adhere completely to the official XHTML standard. The validation service, located at http://validator.w3.org/ the final word on the accuracy of XHTML code.
existing pages that don't conform to XHTML, you should be able to methodically tackle the conversion by following the steps mentioned in this appendix. If you carry out each of these steps, you should arrive at a legitimate XHTML document that conforms to all the rules of the XHTML 1.1 standard.