This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 23570 - What is the difference between "lang attribute in the XML namespace" and "attribute in no namespace with no prefix and with the literal localname 'xml:lang'"?
Summary: What is the difference between "lang attribute in the XML namespace" and "att...
Status: RESOLVED WORKSFORME
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL: http://www.whatwg.org/specs/web-apps/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-19 23:29 UTC by contributor
Modified: 2013-10-20 16:07 UTC (History)
2 users (show)

See Also:


Attachments

Description contributor 2013-10-19 23:29:20 UTC
Specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html
Multipage: http://www.whatwg.org/C#the-lang-and-xml:lang-attributes
Complete: http://www.whatwg.org/c#the-lang-and-xml:lang-attributes
Referrer: http://www.whatwg.org/specs/web-apps/current-work/multipage/

Comment:
What is the difference between "lang attribute in the XML namespace" and
"attribute in no namespace with no prefix and with the literal localname
'xml:lang'"?

Posted from: 78.13.41.251 by master.skywalker.88@gmail.com
User agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36
Comment 1 Andrea Rendine 2013-10-19 23:40:29 UTC
Must there be a namespace declaration in order to consider @xml:lang a "lang attribute in XML namespace"? 
And in which contexts is the "note" rule valid? i.e.: 
- what applications are required to read xml:lang
- which ones are required NOT to derive any effect from it 
- and what are the applications to which the rule "user agents must use the lang attribute in the XML namespace, and the lang attribute in no namespace must be ignored for the purposes of determining the element's language" apply?
Perhaps it is just me who finds it a bit confusing, but I am interested in knowing whether (and in what cases) the redundancy of attributes can be avoided.
Thanks.
Comment 2 Michael[tm] Smith 2013-10-20 13:36:38 UTC
(In reply to Andrea Rendine from comment #1)
> Perhaps it is just me who finds it a bit confusing, but I am interested in
> knowing whether (and in what cases) the redundancy of attributes can be
> avoided.

The redundancy can always be avoided. Just always use "lang" only, and never use "xml:lang" -- regardless of whether you're serving the document as text/html or with an XML mime type.

(In reply to contributor from comment #0)
> What is the difference between "lang attribute in the XML namespace" and
> "attribute in no namespace with no prefix and with the literal localname
> 'xml:lang'"?

Suppose you have a file with xml:lang="en" in it; then there are two ways in might end up getting represented in the DOM:

A. If you serve the file as text/html, you end up in the DOM with an attribute with the literal name "xml:lang" (an "attribute in no namespace with no prefix and with the literal localname 'xml:lang'").

B. If you serve the file with an XML mime type, you end up in the DOM with an attribute with the local name "lang" but in the XML namespace.

(In reply to Andrea Rendine from comment #1)
> Must there be a namespace declaration in order to consider @xml:lang a "lang
> attribute in XML namespace"?

I think the prefix "xml:" is special to XML parsers so it's automatically reserved/recognized for being in the XML namespace and you don't need to have an explicit namespace declaration for it.
 
> And in which contexts is the "note" rule valid? i.e.: 
> - what applications are required to read xml:lang
> - which ones are required NOT to derive any effect from it

Dunno. I'm not sure the spec says anything about that, nor needs to.
 
> - and what are the applications to which the rule "user agents must use the
> lang attribute in the XML namespace, and the lang attribute in no namespace
> must be ignored for the purposes of determining the element's language"
> apply?

User agents.
Comment 3 Andrea Rendine 2013-10-20 16:07:34 UTC
Thank you very much! It could look like a purely theoretic question, especially for me who usually serve HTML pages on my sites, but I always try to understand also theory. And as (X)HTML can always be processed as XML by applications other than Web user agents, it can be useful.