[whatwg] xml:lang and xmlns in HTML

Le 1 d?c. 2006 ? 3:47, Henri Sivonen a ?crit :

> On Dec 1, 2006, at 04:15, Michel Fortin wrote:
>
>> that their valid XHTML1 documents served as text/html, when  
>> updated to XHTML5, are now called valid HTML5 documents by the  
>> validator.
>
> Except:
>  * xmlns is illegal in HTML5.
>  * xml:lang vs. lang.
>  * <base> vs. xml:base.
>  * <meta http-equiv... vs. <?xml version='1.0' encoding=...

Ok, fine. The document still has to be non-conformant with one of the  
two syntaxes, and that's always true since xmlns is required for  
XHTML but not allowed in HTML. Still, that list of difference is  
amazingly short. Could it be shorter? Should it be?

I wonder if xml:lang and xmlns couldn't be made legal in HTML.  
xml:lang would simply become conformant in HTML as a synonym for the  
lang attribute, it's already in the spec that it should get the  
correct treatment anyway. xmlns would only be allowable on <html> and  
only with the HTML namespace as its value.

This would make it possible to have documents conformant with both  
syntaxes at the same time. That's assuming you don't use <base> or  
<meta http-equiv="">; in the cases they're needed they'd have to be  
changed to xml:base and <?xml ?>, but that's a lot simpler to do than  
to change every instance of lang in a document for xml:lang, and it  
can be avoided in the vast majority of the cases.

This could also help reinforce the idea that it's the media type that  
differentiate HTML from XHTML. It'd make many valid XHTML1 documents  
out there conformant with HTML5 with a mere modification to the  
doctype. Just like for "/>", xmlns and xml:lang are already pretty  
common on text/html pages because of XHTML1. I concede however that  
having the word "xml" at two places in the HTML language could make  
things a little more confusing.

What do you think?


Michel Fortin
michel.fortin at michelf.com
http://www.michelf.com/

Received on Friday, 1 December 2006 05:43:21 UTC