f



Why xml:lang instead of lang?

What was the reason to introduce a new attribute "xml:lang"
instead of "lang"? This bothers both authors and browsers
in different language versions: HTML 4, XHTML 1.0, XHTML 1.1.
HTML has only "lang"; XHTML 1.1 has only "xml:lang";
XHTML 1.0 has both!

For example, Mozilla 1.7 recognizes the lang attribute
http://www.unics.uni-hannover.de/nhtcapri/temp/lang-attribute.htm
but it does not recognize the xml:lang attribute.
http://www.unics.uni-hannover.de/nhtcapri/temp/lang-attribute.xhtml

What do we gain from "xml:lang"?

0
nhtcapri (183)
3/31/2006 12:26:43 PM
comp.text.xml 8781 articles. 0 followers. Post Follow

12 Replies
7110 Views

Similar Articles

[PageSpeed] 51


Andreas Prilop wrote:

> What was the reason to introduce a new attribute "xml:lang"
> instead of "lang"? 

> What do we gain from "xml:lang"?

By putting the attribute in the general and predefined namespace 
http://www.w3.org/XML/1998/namespace it can be used by any XML 
application (e.g. XHTML, SVG) without any further effort and without any 
danger of colliding with attributes in no namespace a particular XML 
application might want to define.

-- 

	Martin Honnen
	http://JavaScript.FAQTs.com/
0
mahotrash (2052)
3/31/2006 12:46:50 PM
Andreas Prilop wrote:
> What was the reason to introduce a new attribute "xml:lang"
> instead of "lang"?

Since it is useful to have a means of describing language in the core
of XML.

It only looks silly from an (X)HTML-centric viewpoint.

--
David Dorward
http://dorward.me.uk/

0
dorward1 (4)
3/31/2006 1:01:15 PM
In article <Pine.GSO.4.44.0603311415390.8640-100000@s5b004.rrzn.uni-hannover.de>,
Andreas Prilop  <nhtcapri@rrzn-user.uni-hannover.de> wrote:

>What was the reason to introduce a new attribute "xml:lang"
>instead of "lang"? This bothers both authors and browsers
>in different language versions: HTML 4, XHTML 1.0, XHTML 1.1.
>HTML has only "lang"; XHTML 1.1 has only "xml:lang";
>XHTML 1.0 has both!

XML has always had xml:lang, XHTML gets it because it's XML.

-- Richard
0
richard91 (3692)
3/31/2006 2:49:28 PM
Andreas Prilop wrote:

> What was the reason to introduce a new attribute "xml:lang"
> instead of "lang"? This bothers both authors and browsers
> in different language versions: HTML 4, XHTML 1.0, XHTML 1.1.
> HTML has only "lang"; XHTML 1.1 has only "xml:lang";
> XHTML 1.0 has both!
> 
> For example, Mozilla 1.7 recognizes the lang attribute
> http://www.unics.uni-hannover.de/nhtcapri/temp/lang-attribute.htm
> but it does not recognize the xml:lang attribute.
> http://www.unics.uni-hannover.de/nhtcapri/temp/lang-attribute.xhtml
> 
> What do we gain from "xml:lang"?

xml:lang is not a 'new' attribute. It's part of the XML1.0 specification
which predates XHTML. XHTML1.0 tries to be compatible with HTML4.01 and
supports the lang attributes and you should use both, if you want to be
compatiable with tag-soup parsers. But by being XML it also inherited
xml:lang. Using xml:lang has the advantage that this is (or could be)
recognized by any XML processing tool that needs this information (e.g.
spellcheckers) but does not have knowledge of the XHTML semantics (so it
does not understand 'lang').


-- 
Benjamin Niemann
Email: pink at odahoda dot de
WWW: http://pink.odahoda.de/
0
pink (113)
3/31/2006 3:24:30 PM
Andreas Prilop wrote:

> What was the reason to introduce a new attribute "xml:lang"
> instead of "lang"? This bothers both authors and browsers
> in different language versions: HTML 4, XHTML 1.0, XHTML 1.1.
> HTML has only "lang"; XHTML 1.1 has only "xml:lang";
> XHTML 1.0 has both!
> 
> For example, Mozilla 1.7 recognizes the lang attribute
> http://www.unics.uni-hannover.de/nhtcapri/temp/lang-attribute.htm
> but it does not recognize the xml:lang attribute.
> http://www.unics.uni-hannover.de/nhtcapri/temp/lang-attribute.xhtml

I can reproduce this with FF1.5 - I'd say, it's time for a bugreport ;)

-- 
Benjamin Niemann
Email: pink at odahoda dot de
WWW: http://pink.odahoda.de/
0
pink (113)
3/31/2006 3:29:09 PM
On Fri, 31 Mar 2006, Benjamin Niemann wrote:

>> For example, Mozilla 1.7 recognizes the lang attribute
>> http://www.unics.uni-hannover.de/nhtcapri/temp/lang-attribute.htm
>> but it does not recognize the xml:lang attribute.
>> http://www.unics.uni-hannover.de/nhtcapri/temp/lang-attribute.xhtml
>
> I can reproduce this with FF1.5 - I'd say, it's time for a bugreport ;)

Bug #234485 at http://bugzilla.mozilla.org/

0
nhtcapri (183)
3/31/2006 4:14:51 PM
Andreas Prilop wrote:

> What was the reason to introduce a new attribute "xml:lang"

You've had lots of answers in comp.text.xml

Please do NOT multipost.

-- 
David Dorward       <http://blog.dorward.me.uk/>   <http://dorward.me.uk/>
                     Home is where the ~/.bashrc is
0
dorward (199)
3/31/2006 5:40:23 PM
David Dorward wrote:
> You've had lots of answers in comp.text.xml

This is comp.text.xml

> Please do NOT multipost.

AFAICS it was a crosspost, not a multipost.
-- 
Johannes Koch
Spem in alium nunquam habui praeter in te, Deus Israel.
                          (Thomas Tallis, 40-part motet)
0
koch8601 (279)
3/31/2006 6:26:24 PM
Johannes Koch wrote:

> AFAICS it was a crosspost, not a multipost.

err... whoops, so it was.

-- 
David Dorward       <http://blog.dorward.me.uk/>   <http://dorward.me.uk/>
                     Home is where the ~/.bashrc is
0
dorward (199)
3/31/2006 8:24:51 PM
"David Dorward" <dorward@gmail.com> wrote:

> Since it is useful to have a means of describing language in the core
> of XML.

But why would that be particularly useful as compared with other features 
that could have been included into the "core"? Why don't we have
xml:dir (for text directionality), too, for example?

-- 
Yucca, http://www.cs.tut.fi/~jkorpela/
0
jkorpela (371)
3/31/2006 8:53:40 PM
In article <Xns9797F2CF91FBFjkorpelacstutfi@193.229.4.246>,
Jukka K. Korpela <jkorpela@cs.tut.fi> wrote:

>But why would that be particularly useful as compared with other features 
>that could have been included into the "core"? Why don't we have
>xml:dir (for text directionality), too, for example?

That would be rather different: xml:lang describes the content itself,
not how it should be presented.  But I'm not sure why xml:lang was
deemed important enough to include.

-- Richard
0
richard91 (3692)
3/31/2006 10:40:23 PM
Andreas Prilop wrote:
> What was the reason to introduce a new attribute "xml:lang"
> instead of "lang"? This bothers both authors and browsers
> in different language versions: HTML 4, XHTML 1.0, XHTML 1.1.
> HTML has only "lang"; XHTML 1.1 has only "xml:lang";
> XHTML 1.0 has both!

XHTML 1.0 could be read as invalid HTML markup if sent with the 
text/html content-type, maybe this is why there are these to differents 
lang attributes ? One for SGML based markup, one for XML based markup.

The compatibility guidelines of the XHTML 1.0 recommandation tells 
something that make me think this :
http://www.w3.org/TR/xhtml1/#C_7
0
pgoiffon1 (1)
4/3/2006 7:45:29 AM
Reply: