lang attributes accross (X)HTML versions

Author(s) and publish date

By:
Published:
Skip to 5 comments

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 attribute

W3C Internationalization has created a full tutorial on declaring language in XHTML and HTML.As the tutorial says that information about the language in use on a page is important for accessibility, styling, searching.. You can also read Using attributes to declare language.

lang attributes in specifications

version syntaxe content-type comment
html 4.01 lang text/html There are specific rules for lang inheritance of tables.
xhtml 1.0 lang
xml:lang
text/html
application/xhtml+xml
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 xml:lang and lang values, xml:lang takes precedence even served as text/html.
xhtml 1.1 xml:lang application/xhtml+xml The semantics of xhtml 1.1 is defined in html 4.01 but "On every element, the lang attribute has been removed in favor of the xml:lang attribute (as defined in [XHTMLMOD])."
xhtml 2.0
working draft
xml:lang application/xhtml+xml xhtml 2.0 follows the rules defined in XML for the xml:lang attribute. There are no specific rules defined for tables. By the user agent conformance rules, lang attributes must be ignored.
html5/html
editor draft
lang text/html The lang attribute may only be used on elements of HTML documents. Authors must not use the lang attribute in XML documents.
html5/xml
editor draft
xml:lang application/xhtml+xml html5/xml follows the rules defined in XML for the xml:lang attribute.The editor document says that The xml:lang attribute may only be used on elements of XML documents. Authors must not use the xml:lang attribute in HTML documents.

Related RSS feed

Comments (5)

Comments for this post are closed.