xhtml-html-lang-attributes.html
15.3 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css" media="all">
@import "/QA/2006/01/blogstyle.css";
</style>
<meta name="keywords" content='html, i18n, specification' />
<meta name="description" content=" There has been a discussion about lang attributes on the RDFa mailing-list, on what should be used depending on the HTML version. So I have done a bit or research and compilation and here are the results. The lang..." />
<meta name="revision" content="$Id: xhtml-html-lang-attributes.html,v 1.75 2011/12/16 02:58:31 gerald Exp $" />
<link rel="alternate" type="application/atom+xml" title="Atom" href="http://www.w3.org/QA/atom.xml" />
<link rel="alternate" type="application/rss+xml" title="RSS 1.0" href="http://www.w3.org/QA/news.rss" />
<title>lang attributes accross (X)HTML versions - W3C Blog</title>
<link rel="start" href="http://www.w3.org/QA/" title="Home" />
<link rel="prev" href="http://www.w3.org/QA/2007/08/html_community_roundup.html" title="Web spotting roundup: the WASP lead edition" />
<link rel="next" href="http://www.w3.org/QA/2007/08/tokyo-svg-open-2007.html" title="Tokyo hosts SVG Open 2007" />
<!--
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<rdf:Description
rdf:about="http://www.w3.org/QA/2007/08/xhtml-html-lang-attributes.html"
trackback:ping="http://www.w3.org/QA/sununga/mt-tb.cgi/68"
dc:title="lang attributes accross (X)HTML versions"
dc:identifier="http://www.w3.org/QA/2007/08/xhtml-html-lang-attributes.html"
dc:subject="HTML"
dc:description=" There has been a discussion about lang attributes on the RDFa mailing-list, on what should be used depending on the HTML version. So I have done a bit or research and compilation and here are the results. The lang..."
dc:creator="Karl Dubost"
dc:date="2007-08-28T06:40:28+00:00" />
</rdf:RDF>
-->
<!-- <script type="text/javascript" src="http://www.w3.org/QA/mt.js"></script>-->
</head>
<body class="layout-one-column">
<div id="banner">
<h1 id="title">
<a href="http://www.w3.org/"><img height="48" alt="W3C" id="logo" src="http://www.w3.org/Icons/WWW/w3c_home_nb" /></a>
W3C Blog
</h1>
</div>
<ul class="navbar" id="menu">
<li><strong><a href="/QA/" title="W3C Blog Home">[ W3C Blog ]</a></strong></li>
<li><a href="/QA/Library/" title="Documents and Publications on Web and Quality">Documents</a></li>
<li><a href="/QA/Tools/" accesskey="3" title="Validators and other Tools">Tools</a></li>
<li><a href="/2007/12/qa-blog-help/index#feedback">Feedback</a></li>
</ul>
<div id="searchbox">
<form method="get" action="http://www.google.com/custom" enctype="application/x-www-form-urlencoded">
<p id="formbox"><input type="text" size="15" class="textfield" name="q" accesskey="E" maxlength="255" /> <input type="submit" class="submitfield" value="Search" id="goButton" name="sa" accesskey="G" /> <input type="hidden" name="cof" value="T:black;LW:72;ALC:#ff3300;L:http://www.w3.org/Icons/w3c_home;LC:#000099;LH:48;BGC:white;AH:left;VLC:#660066;GL:0;AWFID:0b9847e42caf283e;" /><input type="hidden" id="searchW3C" name="sitesearch" checked="checked" value="www.w3.org/QA" /><input type="hidden" name="domains" value="www.w3.org/QA" /></p>
</form>
</div>
<div id="main"><!-- This DIV encapsulates everything in this page - necessary for the positioning -->
<p class="content-nav">
<a href="http://www.w3.org/QA/2007/08/html_community_roundup.html">« Web spotting roundup: the WASP lead edition</a> |
<a href="http://www.w3.org/QA/">Main</a>
| <a href="http://www.w3.org/QA/2007/08/tokyo-svg-open-2007.html">Tokyo hosts SVG Open 2007 »</a>
</p>
<h2 class="entry-header">lang attributes accross (X)HTML versions</h2>
<div class="entry-body">
<p>There has been a <a href="http://lists.w3.org/Archives/Public/public-rdf-in-xhtml-tf/2007Aug/0140.html" title="outline language-dependent features from Mark Birbeck on 2007-08-16">discussion about <code>lang</code> attributes on the RDFa</a> mailing-list, on what should be used depending on the HTML version. So I have done a bit or research and compilation and here are the results.</p>
<h3 id="lang-attr">The lang attribute</h3>
<p>W3C Internationalization has created a full tutorial on <cite class="title"><a href="http://www.w3.org/International/tutorials/language-decl/">declaring language in XHTML and HTML</a></cite>.As the tutorial says that <q>information about the language in use on a page is important for accessibility, styling, searching.</q>. You can also read <cite class="title"><a href="http://www.w3.org/TR/i18n-html-tech-lang/#ri20030510.102829377" title="Internationalization Best Practices: Specifying Language in XHTML & HTML Content">Using attributes to declare language</a></cite>.</p>
<h3 id="abstract">lang attributes in specifications</h3>
<table>
<tr>
<th>version</th>
<th>syntaxe</th>
<th>content-type</th>
<th>comment</th>
</tr>
<tr>
<td><a href="http://www.w3.org/TR/html4/struct/dirlang.html#adef-lang" title="Language information and text direction">html 4.01</a></td>
<td>lang</td>
<td>text/html</td>
<td>There are specific rules for lang inheritance of tables.</td>
</tr>
<tr>
<td><a href="http://www.w3.org/TR/xhtml1/#C_7" title="XHTML 1.0: The Extensible HyperText Markup Language (Second Edition)">xhtml 1.0</a></td>
<td>lang<br/> xml:lang</td>
<td>text/html<br/> application/xhtml+xml</td>
<td>xhtml 1.0 is using the definition given in the HTML 4.01 specification. The issue is that the specification gives the possibility to serve the same document with two different content-types. When there is a conflict between <code>xml:lang</code> and <code>lang</code> values, <code>xml:lang</code> takes <strong>precedence even served as <code>text/html</code></strong>.</td>
</tr>
<tr>
<td><a href="http://www.w3.org/TR/xhtml11/changes.html#a_changes" title="XHTML 1.1 - Changes from XHTML 1.0 Strict">xhtml 1.1</a></td>
<td>xml:lang</td>
<td>application/xhtml+xml</td>
<td>The semantics of xhtml 1.1 is defined in html 4.01 but <q>"On every element, the <code>lang</code> attribute has been removed in favor of the <code>xml:lang</code> attribute (as defined in [XHTMLMOD])."</q></td>
</tr>
<tr style="background-color:#ECECEC;">
<td><a href="http://www.w3.org/TR/xhtml2/mod-i18n.html#adef_i18n_xml:lang" title="XHTML 2.0 - XHTML I18N Attribute Module">xhtml 2.0</a><br/>working draft</td>
<td>xml:lang</td>
<td>application/xhtml+xml</td>
<td>xhtml 2.0 follows the rules <a href="http://www.w3.org/TR/REC-xml/#sec-lang-tag" title="Extensible Markup Language (XML) 1.0 (Fourth Edition)">defined in XML for the xml:lang attribute</a>. There are no specific rules defined for tables. By the user agent conformance rules, <code>lang</code> attributes must be ignored.</td>
</tr>
<tr style="background-color:#CECECE;">
<td><a href="http://www.w3.org/html/wg/html5/#the-lang" title="HTML 5">html5/html</a><br/>editor draft</td>
<td>lang</td>
<td>text/html</td>
<td><q>The <code>lang</code> attribute may only be used on elements of HTML documents. Authors <strong>must not use</strong> the <code>lang</code> attribute in XML documents.</q></td>
</tr>
<tr style="background-color:#CECECE;">
<td><a href="http://www.w3.org/html/wg/html5/#the-lang" title="HTML 5">html5/xml</a><br/>editor draft</td>
<td>xml:lang</td>
<td>application/xhtml+xml</td>
<td>html5/xml follows the rules <a href="http://www.w3.org/TR/REC-xml/#sec-lang-tag" title="Extensible Markup Language (XML) 1.0 (Fourth Edition)">defined in XML for the xml:lang attribute</a>.The editor document says that <q>The <code>xml:lang</code> attribute may only be used on elements of XML documents. Authors <strong>must not use</strong> the <code>xml:lang</code> attribute in HTML documents.</q></td>
</tr>
</table>
</div>
<div id="more" class="entry-more">
</div>
<p class="postinfo">Filed by <a href="http://www.w3.org/People/karl/">Karl Dubost</a> on August 28, 2007 6:40 AM in <a href="http://www.w3.org/QA/archive/technology/html/">HTML</a>, <a href="http://www.w3.org/QA/archive/web_spotting/reference/">Reference</a><br />
<span class="separator">|</span> <a class="permalink" href="http://www.w3.org/QA/2007/08/xhtml-html-lang-attributes.html">Permalink</a>
| <a href="http://www.w3.org/QA/2007/08/xhtml-html-lang-attributes.html#comments">Comments (5)</a>
| <a href="http://www.w3.org/QA/2007/08/xhtml-html-lang-attributes.html#trackback">TrackBacks (0)</a>
</p>
<h3 class="comments-header" id="comments">Comments</h3>
<div class="comment" id="comment-62605">
<p class="comment-meta" id="c062605">
<span class="comment-meta-author"><strong>Richard Ishida </strong></span>
<span class="comment-meta-date"><a href="#c062605">#</a> 2007-08-28</span>
</p>
<div class="comment-bulk">
<p>"When there is a conflict between xml:lang and lang values, xml:lang takes precedence even served as text/html."</p>
<p>Well, that's the theory, but as far as I'm aware from testing it is not at all the practice. This may not be clear to some people, and may cause some confusion when they read this post.</p>
</div>
</div>
<div class="comment" id="comment-62658">
<p class="comment-meta" id="c062658">
<span class="comment-meta-author"><strong>Karl Dubost <a class="commenter-profile" href="http://www.w3.org/People/karl/"><img alt="Author Profile Page" src="http://www.w3.org/QA/sununga/mt-static/images/comment/mt_logo.png" width="16" height="16" /></a></strong></span>
<span class="comment-meta-date"><a href="#c062658">#</a> 2007-08-28</span>
</p>
<div class="comment-bulk">
<p>@Richard: This is an interesting information. Do you have a link to an implementation report for the products which behave as such and those which don't and in which circumstances. I'm pretty sure it would be helpful for the community and the HTML WG.</p>
</div>
</div>
<div class="comment" id="comment-63437">
<p class="comment-meta" id="c063437">
<span class="comment-meta-author"><strong>Anne van Kesteren </strong></span>
<span class="comment-meta-date"><a href="#c063437">#</a> 2007-09-02</span>
</p>
<div class="comment-bulk">
<p>It's only the case when xml:lang is inserted through the DOM. The attribute as such can't be written in a text/html document as text/html doesn't do namespaces. (You can test this all fairly trivially using the :lang selector.)</p>
</div>
</div>
<div class="comment" id="comment-64721">
<p class="comment-meta" id="c064721">
<span class="comment-meta-author"><strong>hemal shah </strong></span>
<span class="comment-meta-date"><a href="#c064721">#</a> 2007-09-10</span>
</p>
<div class="comment-bulk">
<p>Hi there, i was not able to read this page (comments section) properly in IE7. So out of doubt, i checked this page for its validity... this page is not valid and has four errors. but primarly, can some one look why it does not show properly in IE7?</p>
</div>
</div>
<div class="comment" id="comment-174201">
<p class="comment-meta" id="c174201">
<span class="comment-meta-author"><strong>Dom </strong></span>
<span class="comment-meta-date"><a href="#c174201">#</a> 2009-03-06</span>
</p>
<div class="comment-bulk">
<p>Note that there are now <a href="http://lists.w3.org/Archives/Public/public-xhtml2/2009Jan/0049.html" rel="nofollow">ongoing and promising discussions</a> on bringing the lang attribute to all versions of XHTML.</p>
</div>
</div>
<div class="comments-open" id="comments-open">
<h3 class="comments-open-header">Leave a comment</h3>
<div class="comments-open-moderated">
<p>
Note: this blog is intended to foster <strong>polite
on-topic discussions</strong>. Comments failing these
requirements and spam will not get published. Please,
enter your real name and email address. Every
individual comment is reviewed by the W3C staff.
This may take some time, thank you for your patience.
</p>
<p>
You can use the following HTML markup (a href, b, i,
br/, p, strong, em, ul, ol, li, blockquote, pre)
and/or <a href="http://daringfireball.net/projects/markdown/syntax">Markdown syntax</a>.</p>
</div>
<div id="comments-open-data">
<form method="post" action="http://www.w3.org/QA/sununga/beach.pl" id="comments-form">
<h4>Your comment</h4>
<div id="comments-open-text">
<textarea id="comment-text" name="text" rows="20" cols="100"></textarea><br />
<label for="comment-text">Write your comment text here. Remember, keep the discussion on topic and courteous.</label>
</div>
<h4>About you</h4>
<div id="comment-form-name">
<input type="hidden" name="static" value="1" />
<input type="hidden" name="entry_id" value="75" />
<input type="hidden" name="__lang" value="en" />
<label for="comment-author">Your Name</label>
<input id="comment-author" name="author" size="30" value="" />
</div>
<div id="comment-form-email">
<label for="comment-email">Your Email Address</label>
<input id="comment-email" name="email" size="30" value="" />
</div>
<div id="comments-open-footer">
<input type="submit" accesskey="s" name="post" id="comment-submit" value="Submit" />
</div>
</form>
</div>
</div>
<p id="gentime">This page was last generated on $Date: 2011/12/16 02:58:31 $</p>
</div><!-- End of "main" DIV. -->
<address>
This blog is written by W3C staff and working group participants,<br />
and maintained by <a href="/People/CMercier/">Coralie Mercier</a>.<br />
Authorized parties may <a href="/QA/new">log in</a> to create a new entry.<br/>
<span id="poweredby">Powered by Movable Type, magpierss and a lot of Web Technology</span>
</address>
<p class="copyright">
<a rel="Copyright" href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 1994-2011
<a href="http://www.w3.org/"><acronym title="World Wide Web Consortium">W3C</acronym></a>®
(<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>,
<a href="http://www.ercim.eu/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>,
<a href="http://www.keio.ac.jp/">Keio</a>),
All Rights Reserved.
W3C <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
<a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>,
<a rel="Copyright" href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a>
and <a rel="Copyright" href="http://www.w3.org/Consortium/Legal/copyright-software">software licensing</a>
rules apply. Your interactions with this site are in accordance
with our <a href="http://www.w3.org/Consortium/Legal/privacy-statement#Public">public</a> and
<a href="http://www.w3.org/Consortium/Legal/privacy-statement#Members">Member</a> privacy
statements.
</p>
</body>
</html>