Properly Using CSS and JavaScript in XHTML Documents

Compliance, compliance, compliance. Always an issue for any Web developer attempting to implement W3C standards and support cross-browser compatibility.

The perpetuation of dev group conflict vis a vis "My browser is better than yours" exacerbates the problem. As an example, the ascertation that the code samples wouldn't render properly in Internet Explorer and the issue of not not recognizing MIME type "application/xml" and the like.

Insofar as it goes on the surface, this is correct -- however Web developers that do not understand the methodology of application implementation are prone to the misconception above. Microsoft chose another XML implementation path: the use of the XML processing instruction --

   <?xml version="1.0" encoding="UTF-8" standalone="no" ?>

If the above is added to the beginning of the XHTML document (and yes, PI nodes are acceptable in the XML DOM), IE5+ will recognize the document no matter what extension you give it (.xhtml, .xml -- though for bizarre extensions some server-side configuration may be necessary). Even without the PI, IE will render a collapsible XML DOM (based on its internal XML DOM and some nifty CSS) if the .xml extension is used.

So, the case in point is not a matter of compliance with W3C, but about application methodology of processing. I agree, the MIME type in a meta element is more elegant, but both methodologies work, and both degrade gracefully -- which, as a developer, is all that really matters.

XmlGuru

Document Tags and Contributors

 Contributors to this page: XmlGuru
 Last updated by: XmlGuru,