Tuesday Sep 21, 2010

xml:lang versus lang

I was following an email thread when I hit this interesting link.

http://www.w3.org/TR/i18n-html-tech-lang/#ri20040429.092928424

It talks about best practices while specifying language for content served on HTML/XHTML/XML pages.
Quoting

"For HTML use the lang attribute only, for XHTML 1.0 served as text/html use the lang and xml:lang attributes, and for XHTML served as XML use the xml:lang attribute only."

e.g.

1. HTML

<helloWorld lang="en-US"/>

2.XHTML served as text/html
<helloWorld lang="en-US" xml:lang="en-US"/>

3. XHTML served as xml
<helloWorld xml:lang="en-US"/>

Bottomline -
Browser understands only "lang" for text/html content.
Dont use "lang" with XHTML 1.1. Its not in the spec. [Its okay in 1.0]

About

Principal Product Manager

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today