Forum Moderators: open
Don't suppose you're in that CSS bunch are ya ;) I write HTML/XHTML in DW or Notepad, makes no difference to me, or anyone else.
I switched to XHTML because of whats been mentioned about XHTML and the "semantic web". If I can make my info more "uniform", then I will. (and take what papapaer says as the right answer in most instances :))
It only took 5 minutes and some regex (in DW actually) to do the switch. Hopefully when I'm more familiar with XML my code won't need to be re-hashed into a more "machine readable" form.
This is a problem, as valid XHTML is actually invalid HTML.
Secondly, a lot of XHTML authors reckon that if you add a few trailing slashes and an xmlns namespace to an existing document, you have an XHTML document. Ther trouble is, the vast majority of these documents contain errors, which will break the page if the correct MIME type is used.
From W3C XHTML 1.0 Specification
"XHTML Documents which follow the guidelines set forth in Appendix C, "HTML Compatibility Guidelines" may be labeled with the Internet Media Type "text/html" [RFC2854],"
Such documents are definitively not forward-compatible, as once application/xml+xhtml is more widespread, vast swathes of current web sites using XHTML incorrectly risk to break.
Other issues include inline CSS and Javascript - if you use comment tags to hide such styles or scripts, they won't work in application/xml+xhtml documents, and putting such scripts in CDATA blocks can cause problems with backward compatibility. Also, both CSS and JS behave differently depending on the MIME type - again, breaking your page.
It is true there are some issues here but none which cannot be worked around. Your point regarding the comment (which is used to hide javascript from browsers which do not have javascript enabled) is true in the sense that an XML parser is not obliged to parse comments and therefore may or may not render them. My experience is that every parser I have played with does in fact parse comments and so this will more than likely be a non-issue. Your comment regarding CDATA can be resolved simply by keeping your scripts as external files (which is generally good practice anyway) and referring to them. E.g.
<script type="text/javascript" src="http://www.foo.com"></script>
XHTML is XML, not HTML, and so you need to work in a different way. There are no advantages to using XHTML at the moment, unless you are combining it with MathML, SVG or other XML data. Better to write semantic, well-formed, validated HTML 4.01 Strict with CSS for commercial projects, and keep the XHTML for more experimental use.
Quote from W3C:
The XHTML 1.0 spec relies on HTML 4.01 for the meanings of XHTML elements and attributes. This allowed us to reduce the size of the XHTML 1.0 spec very considerably.
I write XHTML pages and have very little problems doing so. Most of the time a page of mine fails to validate it is because it fails against the SGML (HTML 4.01 Strict specification). Modern browsers cope with XHTML 1.0 without any major problem and it is the road to be on for the future. If anyone has XHTML compliancy problems then post them here. I will gladly help to try and resolve them.