CSS3 Rocks! Please use latest browser version.
Welcome to Walter Moore Canada's Blog. These comments are strictly opinion. You can disagree!

Thursday, January 21, 2010

XHTML



Updated 2009-11-25
Most development software now codes XHTML compliant tags. There are many smart phones that require XHTML to display properly. Welcome to the XML world. Was it really that bad? Now get ready for CSS3 and DHTML5.0.

Published 2003-03-31

XHTML is the evolution of HTML. The concept is simple… Make HTML documents into an XML compliant document.
Why should I convert?
XHTML is the “new” HTML and many new devices require compliance. XHTML applies strict rules which enforces standards. XHTML can be used as XML. The only choice you have is when… this is inevitable.
Why not?
If you only intend to support PC type platforms with standard browsers there is no value in converting. Every page in your site will have to be converted with no visible improvements… How do you justify the costs. You may be able to wait until your web development tool automatically generates XHTML compliant code. If you do not intend to support PDA/Phones there is no reason to convert.
Problems….
Virtually all web tools at the moment write standard HTML. After converting documents all future HTML edits will have to be reviewed for XHTML compliance manually until your tools write XHTML. In XHTML ALL tags must have a closing tag(
must have
). In XHTML tags that do not have closing tags must end with a “/” symbol(
must be
). This includes meta tags as well..
Even if you are diligent and always provide closing tags in your HTML you will have to do many adjustments. All tables must have a TBODY tag. All tags and properties must be in lowercase. Inline CSS & Script encapsulated in comments must be in a CDATA block. These are just some of the more common issues. If you use strict XHTML, style properties only exist in CSS and will require even more adjustments. I recommend you review W3C standards for XHTML at http://www.w3c.org/
How to Convert
There is a lot more than most people think to convert DHTML to XHTML but I have found some good cheats…
There are several tools out there that will automatically convert DHTML to XHTML. I strongly recommend you use these rather than manually adjusting your HTML. You can convert the core site pages immediately then convert the rest as time permits. For tools you can use http://cgi.w3.org/cgi-bin/tidy that provides an online solution or you can download WebMatrix from http://www.asp.net/. I think Tidy provides the best implementation. There is a version of Tidy you can download and run from your PC… look on W3C site.
No matter what you decide, start writing all new documents with XHTML standards. It will save you having to re-write them later. That said you might notice this document is NOT XHTML compliant. I intend to convert  the entire demo site at one time so I am waiting till then… ;-)

No comments:

Post a Comment