Specifying integrity constraints on type

Hello.
I got some problems defining correct xpath expression for some identity 
constraints in a XML schema, where the enclosing element name is not 
constant.

I have a generic EventType type:
<complexType name="EventType" abstract="yes">
  <sequence>
    <element name="author" minOccurs="1" maxOccurs="unbounded">
      <complexType>
        <attribute name="idref" type="string" use="required"/>
      </complexType>
    </element>
  </sequence>
</complexType>

I want to ensure an author could only be a person, so i have a key for 
persons defined in my root element:
<key name="personKey">
  <selector xpath="persons/person"/>
  <field xpath="@id"/>
</key>

And the corresponding keyref will be something as:
<keyref name="eventAuthor" refer="personKey">
  <selector xpath="?"/>
  <field xpath="@idref"/>
</keyref>

But now, how must i define the xpath attribute for the selector element, so 
as to match only author element from an event type ? As this last one is a 
type, it can occurs with arbitrary name (aka identification, observation, 
etc...)...

Auxiliary question: key definition make key field mandatory. Does keyref 
definition makes keyref fields mandatory also ?
-- 
Guillaume Rousse <rousse@ccr.jussieu.fr>
GPG key http://bohm.snv.jussieu.fr/~rousse/gpgkey.html

Received on Friday, 24 August 2001 06:17:23 UTC