Recently I have written an article about the doctypes and SharePoint 2007. My conclusion was that if you’re striving to deliver a standards compliant web site built upon SharePoint 2007 you should be using the XHTML doctype. As if delivering an XHTML compliant web site in SharePoint 2007 wasn’t challenging enough, there are multiple mime-types which can be used for XHTML compliant web pages.
XHTML defines a strict set of rules on how an HTML page should be build like and how the markup should be used. All of this has been done to enable the benefits of using XHTML which leverages the power of XML. By creating XHTML compliant web pages you make it possible for external systems to process your information just as it were XML data. Another great benefit is creating content and then restyling it using different XSLT for different purposes like Internet, Intranet, mobile, newsletters, etc.
So why not everyone uses XHTML if it is so great, powerful and flexible? XHTML has introduced a new mime-type which describes XHTML content: application/xhtml+xml. What mime-type is, is a way to tell an application what the content is so the application can process it in the right way. Because XHTML is based on XML it should be processed like XML not like HTML. That is why a new mime-type has been introduced. XML processing engine is faster and more powerful yet it is very strict and disallows even smallest errors.
As the picture above illustrates, even the smallest error will break your web page: and only the presentation, you will get a parsing error and the whole page will not get displayed at all! SharePoint 2007 Rich Text Editor (RTE) doesn’t produce XHTML compliant output. Furthermore, even if you use an alternative editor, you can’t rely 100% on it as SharePoint 2007 modifies the HTML output while saving the page.
Another huge problem with the application/xhtml+xml mime-type lies beyond SharePoint 2007 and any other CMS: none of the currently available versions of Internet Explorer support it: Microsoft Internet Explorer 6 doesn’t render the page at all and Windows Internet Explorer 7 renders it as XML. And because Internet Explorer is being using by the majority of all Internet users you simply cannot afford to ignore this group. Although there are some tricks possible to force IE7 to render the page correctly using the application/xhtml+xml doctype, are you sure you want your web site to rely on hacks? Is this the quality you’re looking for?
To avoid all the problems described above you should be using the text/html mime-type with web pages using the XHTML doctype. Although it seems to be totally wrong after you read Ian Hickson’s article on XHTML and mime-types, it seems to me like the only way to provide one and the same web page to every device out there: at least for the time being.
If the information presented on your web site is being processed by some other information systems which do require the application/xhtml+xml doctype and you know which information systems that are, you could make use of the mime-type switching method. You have to be careful though and control your web site on integrity of the provided information on a regular basis.
SharePoint 2007 relies on the ASP.NET 2.0 development platform which produces XHTML markup. Although users can control this markup on many places and could theoretically achieve rendering HTML 4.01 compliant markup, ASP.NET 2.0 internals rely on markup which is compliant only with the XHTML doctype. XHTML pages can be served with two mime-types: text/html or application/xhtml+xml. Only by using the second one the markup leverages the concept of XHTML. Yet lack of support for this mime-type by the Internet Explorer browser family doesn’t allow you to benefit of that mime-type’s power in most scenario’s. To preserve consistency and deliver the same content to each device and agent requesting the web site you should be using the text/html mime-type while working with XHTML pages in SharePoint 2007.