[whatwg] several messages about XML syntax and HTML5

Michel Fortin michel.fortin at michelf.com
Mon Dec 4 11:12:46 PST 2006


Le 4 déc. 2006 à 12:30, Mihai Sucan a écrit :

> <html lang="fr" xmlns="http://www.w3.org/1999/xhtml">
> <head>
> <title>Sans titre</title>
> </head>
> <body>
> <p>Bonjour à tous!</p>
> <p lang="ro">Bună ziua tuturor!</p>
> <p><img src="merci.png" alt="Merci!" id="mon-image" /></p>
> </body>
> </html>

Nice example Mihai.

To reformulate my previous suggestion more clearly, this example  
validates for XHTML 1.0 Strict, but it doesn't for XHTML 1.1 with  
errors on the two lang attributes. (Using W3C's validator.) It happen  
to be valid HTML5 according to the current spec too (if you add the  
proper doctype). The question is: should this be valid XHTML5?

I think it should.

  - - -

The HTML5 spec currently gives the following authoring requirements  
regarding lang and xml:lang:

> The lang attribute only applies to HTML documents. Authors must not  
> use the lang attribute in XML documents. Authors must instead use  
> the xml:lang attribute, defined in XML. [XML]

I'd change it for this:

"Only the lang attribute applies to HTML documents. For XHTML  
documents, authors should instead use the xml:lang attribute as  
defined in XML, although the lang attribute is also allowed for  
backward compatibility reasons. If an element has both the lang and  
the xml:lang attributes set, both attributes must have the same value."

I'm wondering if the two attributes shouldn't be mutually exclusive  
however, meaning that if one is present, the other must not be.


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





More information about the whatwg mailing list