Using <unique> for multilingual elements

I'm working on a schema spec for some open-source work of mine. In it,
I want to define an element called <documentation>, for obvious uses.
I would also like to limit it to one instance per scope (it will be
used at several context levels). Here's the catch: I want to allow
multiple occurrances if an attribute "lang" is different. So, only one
*English* version, and perhaps a Russian one, or a Greek one, etc.

This is the block that defines the complexType:

  <xsd:complexType id="descriptionType" name="descriptionType">
    <xsd:annotation>
      <xsd:documentation>
        A description block is used to document everything from specific change
        items to the release as a whole.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:simpleContent>
      <xsd:extension base="xsd:string">
        <xsd:attribute default="en-US" name="lang" type="xsd:language" />
      </xsd:extension>
    </xsd:simpleContent>
  </xsd:complexType>

Here's an example of an element declaration that references a type
that references the above. This declaration includes a unique
constraint:

  <xsd:element id="item" name="item" nillable="false" type="tns:itemType">
    <xsd:annotation>
      <xsd:documentation>
        An item element contains a single block representing an itemType.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:unique name="itemDescriptionLangConstraint">
      <xsd:selector xpath="tns:description" />
      <xsd:field xpath="@lang" />
    </xsd:unique>
  </xsd:element>

This *looks* like it should be correct. However, the xsltproc
command-line tool from libxslt doesn't implement <unique>, yet. I get
warnings of an unimplemented feature  exactly as many times as I have
that tag. I haven't been able to get a working Java-based tool for
plain validation,. so I haven't been able to test it.

Any advice? Am I on the right track?

The full schema, if you want to look at it all in context, can be viewed here:

    http://www.blackperl.com/XML/ChangeLog/changelog093.xsd

Randy
-- 
Randy J. Ray / randy.j.ray@gmail.com
Campbell, CA

Received on Friday, 8 April 2005 17:35:16 UTC