[XMLSCHEMA-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: FW: use of xml:lang

From: Jeni Tennison <jeni@jenitennison.com>
Date: Sat, 24 Nov 2001 14:16:28 +0000
Message-ID: <898320624.20011124141628@jenitennison.com>
To: "Chan, Philip" <Philip.Chan@rbccm.com>
CC: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>
xsd xml lang unique
Hi Philip,

> As Guillaume is not using keyref, should it be coded as below or it
> doesn't matter at all:
>
>         <xs:element name="name">
>             ...
>             <xs:unique name="languageKey">
>               <xs:selector xpath="language" />
>               <xs:field xpath="@xml:lang" />
>             </xs:unique>
>           </xs:element>

The only difference between key and unique is that all the elements
that you select with a key have to have values for the fields that you
use for the key. With a unique identity constraint, on the other hand,
you can have some of the elements that you select with no value for
the fields.

Note that whether you use key or unique makes no difference whatsoever
as to whether you can refer to the identity constraint using a keyref.

In this example, assuming that you didn't set a default on the
xml:lang attribute, using xs:unique as above would allow:

  <name>
    <language>brazil</language>
    <language>brésil</language>
    <language>brasil</language>
  </name>

whereas a key identity constraint would reject this example because
the language elements don't have xml:lang attributes. A key identity
constraint would likewise reject:

  <name>
    <language>brazil</language>
    <language xml:lang="fr">brésil</language>
    <language xml:lang="es">brasil</language>
  </name>

However, with the default set for xml:lang, I think that key and
unique would work in exactly the same way.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/
Received on Saturday, 24 November 2001 10:06:07 GMT

Subscribe to the Stylus Scoop newsletter for helpful XML tips and tutorials.
Email
First Name
Last Name
Company

Download Stylus Studio 6 XML Enterprise Edition

Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.