Some interesting info in the articles.
Theres a nice little trick in the first one to get around the application/xhtml+xml issue with Internet Explorer.
From the first document:
|Why is it disallowed to send XHTML 1.1 documents as text/html? |
XHTML 1.1 is pure XML, and only intended to be XML. It cannot reliably be sent to legacy browsers. Therefore XHTML 1.1 documents must be sent with an XML-related media type, such as application/xhtml+xml.
Hmmm, I remember arguing with DrDoc about this a few months ago (I lost the argument, as one tends to do with DrDoc). I thought XHTML 1.1 couldn't be served as
text/html, and he pointed out the W3C documentation showing that it could. Now this document says you can't - but it is only a FAQ, not a technical specification.
So who's right now? Does anybody know for sure?
You can send XHTML1 as text/html (with conditions, such as using <br /> instead of <br/>).
XHTML1.1 should not be sent as text/html. HTML compatible XHTML1.1 doesn't exist.
Interesting links which I followed to here:
As much as I think html forms need to be improved, I don't like their suggested implementation with XForms. Now in order to create a form you need to insert data into the head tag? Are they nuts? Don't they know that there's a ton of software out there with templates that are interchangeable and the headaches of getting extra data into the head would break a lot of software.
|HTML compatible XHTML1.1 doesn't exist. |
That's what I thought - until DrDoc pointed out this:
Note that XHTML 1.0 and 1.1 are marked as "SHOULD NOT" be served as
text/html - as opposed to "MUST NOT".
Clark - there is much debate about XForms - many people prefer the WhatWG approach [whatwg.org] rather than the official W3C one regarding forms - but it remains to be seen whether the WhatWG proposals will be adopted as a standard either by W3C (unlikely at this point) or the IETF (possible, but it's early days).
However RFC 2854 "The text/html media type":
|The text/html media type is now defined by W3C Recommendations; the latest published version is [HTML401]. In addition, [XHTML1] defines a profile of use of XHTML which is compatible with HTML 4.01 and which may also be labeled as text/html. |
XHTML1.1 does not define a profile compatible with HTML4.01.
Also, the definition of SHOULD NOT:
|SHOULD NOT This phrase, or the phrase "NOT RECOMMENDED" mean that there may exist valid reasons in particular circumstances when the particular behavior is acceptable or even useful, but the full implications should be understood and the case carefully weighed before implementing any behavior described with this label. |
And that W3C link also includes "The 'text/html' media type [RFC2854] is primarily for HTML, not for XHTML. In general, this media type is NOT suitable for XHTML."
I think it's clear using text/html for XHTML is frowned upon.
encyclo, I'll look at that link. I don't know about w3c and any other org, but it will interest me when at least Opera or Mozilla enable such use in their browser. This very box I'm typing in should have more flexibility.
There appears to be some confusion:
XHTML 1.0 is a reformation of HTML 4 in XML 1.0 and was purposefully made a transition step that current HTML user agents could understand.
|The 'text/html' media type [RFC2854] is primarily for HTML, not for XHTML. In general, this media type is NOT suitable for XHTML. However, as [RFC2854] says, [XHTML1] defines a profile of use of XHTML which is compatible with HTML 4.01 and which may also be labeled as text/html. |
Appendix C "HTML Compatibility Guidelines" summarizes design guidelines for authors who wish their XHTML documents to render on existing HTML user agents. The use of 'text/html' for XHTML SHOULD be limited for the purpose of rendering on existing HTML user agents, and SHOULD be limited to [XHTML1] documents which follow the HTML Compatibility Guidelines. In particular, 'text/html' is NOT suitable for XHTML Family document types that adds elements and attributes from foreign namespaces, such as XHTML+MathML
XHTML 1.1 is module based XHTML and might not be understood by current HTML user agents.
|The 'application/xhtml+xml' media type [RFC3236] is the media type for XHTML Family document types, and in particular it is suitable for XHTML Host Language document types. XHTML Family document types suitable for this media type include [XHTML1], [XHTMLBasic], [XHTML11] and [XHTML+MathML]. |
So it is quite simple:
- use of xhtml 1.0 and "text/html" is fine. No problem.
- use of xhtml 1.1 and "text/html" is not fine.
- which may cause XML user agents to display incorrectly (as well-formed code is necessary they may well refuse to display anything);
- and HTML user agents may display incorrectly due to unrecognised code.
- use of either xhtml 1.0 or xhtml 1.1 and "application/xhtml+xml" (or similar)
- HTML user agents will probably be unable to display correctly.
- XML user agents will have no problem.
use XHTML 1.0 and "text/html" (like many of us do) which displays just fine and wait on replacement xml user agents to become popular before switching to XHTML 1.1.
There is a very simple solution for the
application/xhtml+xml issue at the cost of a little extra cpu load. Check if the HTTP_ACCEPT for
application/xhtml+xml. If it's there, just send. Else, if it's a user agent known accept it anyway (such as the W3C's validator), again, just send it. Otherwise, do a regex to change each " />" into ">" and then send.
In each case you will also need to send to send the first few lines as appropriate.
D'oh, we'd relied on [xml.com...] which says 1.0 may, 1.1 should not, and 2.0 must.
The problem is not whether one should or shoudn't send XHTML 1.1 as
text/html, but the confusion which appears to reign within the W3C on the matter. There are links in this thread to a number of documents, all originating from w3.org, which give contradictory information.
If the W3C don't even know what the standard is, then how can the rest of us hope to know what to do? It souldn't be a question of personal opinion - it should be laid out clearly in a formal specification.
Good point, but if you always serve the "correct" type the problem is avoided. As far as UA's who can't handle XHTML, send them an HTML version.
|If the W3C don't even know what the standard is, then how can the rest of us hope to know what to do? |
I don't think it really matters if you CAN send 1.1 as text/html because by doing so you loose basically all the extra functionallity that it has.
If you just want to have a page that acts like html then use the 1.0 it can be sent as text/html.
If you need the exrta functionality that 1.1 offers then you CAN'T send it as text/html because the extra functionallity will not work then.
Maybe I am missing something though...
All this confusion is why I am still sticking to HTML 4.01 for the forseeable future.....