[whatwg] xml:lang and xmlns in HTML

Shadow2531 shadow2531 at gmail.com
Sat Dec 2 03:32:24 PST 2006


On 12/1/06, Michel Fortin <michel.fortin at michelf.com> wrote:
> 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.

It looks like the goal here is to serve markup like the following as
both application/xhtml+xml and text/html and have it be valid in both.

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
        <title>title</title>
        <link rel="stylesheet" type="text/css" href="file.css"/>
        <script type="text/javascrpt" src="file.js"></script>
    </head>
    <body>
        <p><img src="file.png" alt="alt text"/></p>
        <p><embed type="application/x-java-applet"/></p>
        <p>test<hr/>line1<br/>line2<br/>line3</p>
    </body>
</html>

Would that be the correct assumption?

If so, what is the reason for doing so?  Is this because many really
want to use XML, but don't want to get punished by the validator for
supporting IE through a text/html workaround? Or, is there something
more like being able to flip mime types without changing anything ( if
you're careful with how far you follow xml rules)?

I take it that accepting the trailing slash on void elements isn't enough.

It seems html5 could allow xmlns and xml:lang for text/html without
problem, but it still wouldn't be treated as XML, so why allow it?
Just so a validator doesn't show an error?

Or, maybe you're just saying that since a lot of XHTML markup is
*handled* in text/html by UAs, we should define it just to reflect on
current support?

Just trying to see the reason.

Thanks

-- 
burnout426



More information about the whatwg mailing list