Re: New article published: xml:lang in XML document schemas

At 14:45 05/11/25, Felix Sasaki wrote:

 >This discussion is getting more and more a non i18n issue, so now just one
 >more argument which makes it possibly i18n relevant again. xml:lang is
 >defined in terms of RFC 3066, which encompasses two language subtags: for
 >language and for country codes. Suppose you want to put additional
 >constraints on the value of xml:lang, so that it allows only for a subset
 >of rfc 3066 values (e. g. only language codes, but not country codes).
 >With XML Schema it is no problem, but would you  be able to do that with
 >RELAX NG? It would not be possibly with DTDs.

I'm not sure what the last sentence means. If it means
"It would not be possible with DTDs.", then that's wrong.
The XML spec itself contains an example

A simple declaration for xml:lang might take the form
     xml:lang CDATA #IMPLIED
but specific default values MAY also be given, if appropriate.
In a collection of French poems for English students, with
glosses and notes in English, the xml:lang attribute might
be declared this way:
     <!ATTLIST poem   xml:lang CDATA 'fr'>
     <!ATTLIST gloss  xml:lang CDATA 'en'>
     <!ATTLIST note   xml:lang CDATA 'en'>

The benefit of this and other restrictions should be
obvious, in particular for checking documents against
consistency criteria above and beyond what e.g. a particular
spec might require. In a perfect Schema/RelaxNG world,
the XML namespace schema would be predefined, but
restrictions would be allowed.

Regards,    Martin. 

Received on Monday, 28 November 2005 10:04:31 UTC