The lang and xml lang Attributes and XHTML
|
|
|
|
| Articles Reviews XHTML | |
| Written by Bogdan V | |
| Wednesday, 31 January 2007 | |
|
{mos_sb_discuss:22} The second reason is that screen reading software use it to pronounce the content correctly. Other is to help user agents select glyph variants, help user agents choose a set of quotation marks and assist spell checkers and grammar checkers. Sometimes documents contain or reference different types of natural language content. Other times they are needed to store a natural language value as data or meta-data about something external to the document. Because these different applications use similar formats, schema designers are sometimes confused about when they should use xml:lang and when to define their own language-related element or attribute. When to use your own element or attribute When the language value is really an attribute of or metadata about some external content, then xml:lang is not an appropriate choice. In these cases you want to store language information, but the language doesn't refer to the content of the XML document (or external content, such as images, which are processed as part of the document) directly. In this case you should define an element or attribute of using a different name and not use the xml:lang attribute. The value of the element or attribute should use RFC 3066 (or its successor), just like xml:lang. Some examples of this might include: An element in an XML document describing your DVD collection to indicate which languages are available on the soundtrack an element in a customer database with a field for the customer's language preference an attribute of a link element (such as {{}} in XHTML) pointing to a translation of this document into another language. The reason you would choose to create your own element (or attribute) is to convey the language as a value--as part of a data structure or as meta-data about an external document--rather than to indicate the language of a specific piece of content. Avoiding the use of xml:lang to describe external language values avoids creating problems for content authors who need to label content for processing purposes. For example, an XML document might look like this: Casablanca zh-HK In this example, the xml:lang attribute conveys information about the natural language of text appearing in this document. The dialogue element and the language attribute of the subtitles element are defined in the XML document schema and convey a natural language value associated with these items. For example, it conveys the information that the subtitles on Track #1 are written or displayed in Traditional Chinese ("zh-Hant").
Powered by jReviews |
|
| Last Updated ( Thursday, 07 June 2007 ) | |
| < Prev | Next > |
|---|







