xml:lang="" and lang=""

On Tue, 19 Aug 2008, Toby A Inkster wrote:
> 
> Although something like this is clearly a mistake and should not be 
> allowed:
> 
> <span lang="fr" xml:lang="de">
> 
> Isn't the following a little more of a grey area?
> 
> <span lang="fr-FR" xml:lang="fr">
> 
> Might an improved criterion for conformance be: if @lang and @xml:lang 
> are both present, they must be equal, or one must be a substring of the 
> other, matching the head of the longer string. (All case insensitive.) 
> When the attributes conform to the previous condition, the longer 
> attribute value is taken to be the language of the element.

On Tue, 19 Aug 2008, Henri Sivonen wrote:
> 
> I think the spec shouldn't get that kind of complexity.
> 
> The point of the conformance requirement is to allow exactly equivalent 
> talismans. The purpose isn't to support elaborate DWIM.

I agree with Henri here.

I changed the requirement to allow case differences, though.


On Tue, 19 Aug 2008, Richard Ishida wrote:
> 
> It seems to me that requiring sameness between lang and xml:lang 
> attributes leads to:
> 
> a. difficulty in establishing what sameness means with things like 
> lang="fr" xml:lang="fr-FR" (which actually mean the same) [Note that in 
> the future there may be a requirement to see things like en-GB and 
> en-Latin-GB as the same by BCP 47 matching rules]

There's no difficulty here, the spec requires that the attributes have the 
exact same value.


> b. the question of what to do if they are not equal

This is already defined. We have to define this even if we don't allow the 
attributes to both be present, anyway.


> I'd have thought that a simpler approach would be to establish 
> precedence rules, such that if lang and xml:lang appear on the same 
> element, one is recognized and the other ignored.

Sure, but we still have to say that the ignored attribute is wrong. I 
mean, there's clearly an error here, that needs to be flagged.


> In fact, you could go further and say that lang and xml:lang are 
> equivalent markup in the html context, albeit that there are precedence 
> rules when both are used on the same element.  This would make it 
> unnecessary to use both lang and xml:lang (frankly a pain in the neck) 
> when authoring XHTML 1.0 that is served as text/html.  This is also 
> likely to significantly reduce, if not eliminate, as we go forward, the 
> likelihood of conflict arising from authors using different 
> declarations, and cases where you'd need to establish precedence.

As far as I can tell the spec agrees with you already.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Thursday, 21 August 2008 01:45:42 UTC