XHTML: April 2007 Archives

What made me switch to XHTML? XSLT!

| | Comments (1)

I read an interesting article from HTML Goodies reminding me that the switch to XHTML was mostly hype for a long time
http://www.htmlgoodies.com/beyond/xml/article.php/3669451

As Philbin points out, most of the reasons given aren't valid. This is because XHTML and HTML 4 pretty much have the same functionality, so basically:

  1. Well formed HTML is as valid as well formed XHTML. HTML Strict is pretty strict by the way - no FONT tags or ALIGN attributes allowed.

  2. You can make the same stupid accessibility glitches in either HTML or XHTML (did you know that black on black text is valid code...but illegible?)

  3. Browsers will be supporting both HTML and XHTML for many, many years to come.

  4. Not all browsers support ad hoc combinations of XML and XHTML.
BUT Philbin did miss one thing that made me switch - XSLT. This is another XML schema which lets you convert non HTML XML into XHTML. But because XSLT is an XML schema, it can only reference another XML file...and only XHTML fits the bill. If you want an XSLT generated page to mesh well with the rest of the site, the entire site should really be in XHTML.

This may be a case of the future is coming, but it really takes 5-10 years for it to arrive.

By the way, Dreamweaver 8 was my "bestest" friend ever in the switch. You open any document, then go to the File menu, then Convert, then pick your format (I recommend XHTML Transitional for beginnners, unless you were already HTML Strict).

Once you do this, Dreamweaver magically converts all <br> tags to <br> tags, and all <img> tags to <img /> (and it adds the pesky slash to all your single line meta tags). It also adds the correct DTD statement (so I'm not having to cut and paste that either). After that your WSYWIG editors is set to produce the XHTML versions of the tags and Dreamweaver valildation is generally picker when it's XHTML so it finds basic glitches much faster.

Now...we just have to worry about XHTML 2!