[ESW Wiki] Update of "geoFAQxmllang" by 64.105.174.187

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "ESW Wiki" for change notification.

The following page has been changed by 64.105.174.187:
http://esw.w3.org/topic/geoFAQxmllang


------------------------------------------------------------------------------
  
  == Answer ==
  
- XML 1.0 defines a common attribute ''xml:lang'' which indicates the natural language of the content of an element (or attribute)'''[[RI''' I'd remove the stuff in parens - the attribute is the content of the element, but it sounds like you can specify for just an attribute when expressed this way''']]'''. That is, the best application of xml:lang should be to identify the language of text '''[[RI''' not just text - could be an embedded object, like a speech file''']]''' contained by the element (including any sub-elements) as well as any attribute values associated with the element and its descendant elements (though using natural language in attributes is '''not''' best practice).
+ XML 1.0 defines a common attribute ''xml:lang'' which indicates the natural language of the content of an element. That is, the best application of xml:lang should be to identify the language of text or other content (including embedded objects such as an image or sound file) contained by the element. The xml:lang value applies to any sub-elements contained by the element. Attribute values associated with the element and its descendant elements also are associated with the xml:lang (though using natural language in attributes is '''not''' best practice).
  
- Sometimes you need to convey a language as an information item of its own. '''[[RI''' would be good to have an example here''']]''' If '''[[RI''' suggest s/If you/In this case you/ and modify following text to suit''']]''' you want to have an element or attribute whose ''value'' is a language, then you should use RFC 3066 (or its successor) to form the value, but you should define an element or attribute of your own with a different name and not use the xml:lang attribute.
+ Sometimes you need to convey a language as an information item of its own. For example, if you created an XML document describing your DVD collection, you might want an element to indicate what languages are available on the soundtrack portion of each item. In this case you want to have an element or attribute whose ''value'' is a language. You still want to use RFC 3066 (or its successor) to form the value, but you should define an element or attribute of your own with a different name and not use the xml:lang attribute.
  
- For example, in XHTML, there is an hreflang attribute in the <a> element and also an xml:lang (or lang attribute, in the case of HTML) for the content of the <a> element:
+ For example, in XHTML 1.0, there is an hreflang attribute in the <a> element and also an xml:lang (or lang attribute, in the case of HTML) for the content of the <a> element:
  
- {{{<a xml:lang="en" href="xyz" hreflang="de">Click for German</a>}}}
+ {{{<a xml:lang="en" href="xyz" hreflang="de">
+    Click for German
+ </a>}}}
+ 
+ A different example from XHTML 1.0 shows how ''xml:lang'' applies to an attribute:
+ 
+ {{{<abbr title="radio detection and ranging" xml:lang="en">
+    RADAR
+ </abbr>}}}
+ 
+ This is a good example of why applying ''xml:lang'' to an attribute is not desirable: there is no way to supply more than one language of the {{{title}}} attribute.
  
  For example, your XML might look like:
  
  {{{<item>
-   <title xml:lang="en">Casablanca</title> <!-- indicates the language of [[RI s/of/of the text]] 'Casablanca' -->
+   <title xml:lang="en">Casablanca</title> <!-- indicates the language of of the text 'Casablanca' -->
    <runningTime value="137" /> <!-- not language affected -->
-   <dialogue language="zh-min" /> [[RI i'd add a comment here ]]
+   <dialogue language="zh-HK" /> <!-- indicates a language value (attribute) of the dialogue element -->
    <subtitles track="1" language="zh-Hant" />
    <subtitles track="2" language="zh-Hans" /> 
  </item>}}}

Received on Tuesday, 28 June 2005 22:08:41 UTC