spacer
XML Gov Logoflag
spacer

XML.Gov Demos: XHTML

by Ken Sall Consulting

Purpose: This demo shows how HTML that isn't 100% valid can be converted to completely valid XHTML 1.0. While not completely automated, the procedure is not too time consuming. The XML.Gov home page is the example page converted here.

Validation is easily verified by clicking on icons that invoke W3C's HTML/XHTML Validation Service and CSS Validation Service.

Stage Explanation
Original HTML Page This is a local copy of the XML.Gov home page before any modifications. The images are missing since they were not copied to my server. To validate the original page, go to http://validator.w3.org/, paste in the URL http://xml.gov/, and select "HTML 4.01 Transitional". Alternatively, you can view the previously generated validation results.
Base Added This version differs from the original only by the addition of a <base href="http://xml.gov/"> reference so that the images would be visible during later stages.
Tidy Version Next step is to convert the file from HTML to XHTML using HTML Tidy. Although the result looks very much the previous one in your browser, the conversion results in source that is significantly different from the original, especially with respect to the use of CSS replacing font and align=center tags and color information. However, this does not result in valid XHTML due to a few problems it could not fix. So we again validate it by going to http://validator.w3.org/, pasting in the URL http://kensall.com/gov/xhtml/tidy-XML_gov-x.html, and selecting "XHTML 1.0 Transitional". Alternatively, you can view the previously generated validation results.
Valid XHTML 1.0 After making the edits suggested by validation of the output from Tidy, we again validate and see the final result. We can optionally insert the XHTML and CSS icons (as W3C suggests) to make it much easier to validate the document in the future (i.e., after later edits). This method depends on the HTTP_REFERER so the files must be on a server to validate via the icons. (These are the same icons that appear at the bottom of this demo page.)
Valid XHTML 1.0! Valid CSS!

Return to Demo Home

Last Updated: July 31, 2002

Copyright © 2002 Kenneth B. Sall. All Rights Reserved.