14. XHTML I18N Attribute Module


This section is normative.

This module defines the I18N attribute collection.

14.1. I18N Attribute Collection

xml:lang = LanguageCode
This attribute indicates the language of an element's attribute values and text content, and of all elements it contains, unless overridden. It is defined normatively in [XML] section 2.12. The default value of this attribute is unspecified.

An element inherits language code information according to the following order of precedence (highest to lowest):

  1. The @xml:lang attribute set for the element itself.
  2. The closest parent element that has the @xml:lang attribute set (i.e., the @xml:lang attribute is inherited).

In this example, the default text-processing language of the document is French ("fr"). Within the first paragraph a single word is declared to be in English ("en"), after which the primary language returns to French. The following paragraph is declared to be in English and includes an embedded French word.


<html xmlns="http://www.w3.org/2002/06/xhtml2" xml:lang="fr" ...>
   <title>Un document multilingue</title>
<p>En janvier, toutes les boutiques de Londres
affichent des panneaux <span xml:lang="en">SALE</span>,
mais en fait ces magasins sont bien propres!</p>
<p xml:lang="en">Everwhere I went in France
the bakeries had signs up saying <em xml:lang="fr">PAIN</em>,
but despite that the bakers seemed quite happy.
its:translate = ( "yes" | "no"* )
This attribute is incorporated from the [ITS] specification and can be used to indicate whether the contents of an element should be translated. Note that this element is in the its namespace. ITS rules are incorporated into XHTML family documents via the link element with a @rel attribute value of itsRules.

Implementations: RELAX NG, XML Schema