On Wed, 27 Jun 2001, Heike Franosch wrote:

> works fine:
> <xsd:element name="foo" type="FooType">
>          <xsd:unique name="blubSelector">                   <-------------
> unique here with xpath="bar"
>            <xsd:selector xpath="bar"/>
>            <xsd:field xpath="@id"/>
>          </xsd:unique>
>      </xsd:element>

> does not work:
> <xsd:element name="foo" type="FooType"/>
> 
> <xsd:complexType name="FooType">
>   <xsd:sequence>
>     <xsd:element name="bar" type="BarType" maxOccurs="unbounded"/>
>        <xsd:unique name="blubSelector">
> <------------------- unique here with xpath "."
>            <xsd:selector xpath="."/>
>            <xsd:field xpath="@id"/>
>          </xsd:unique>

In the first instance, the XPath expression "bar" represents the node set
containing all the bar children of the current element, so the unique
constraint says that the id attributes must be unique among among all the
bars.  In the second case, the XPath expression "." represents a single
node (the current bar), so the uniqueness constraint says that the id
attribute of this single bar element must be unique, which it will always
be.

Ian

-- 
Ian Roberts, Software Engineer        DecisionSoft Ltd.
Telephone: +44-1865-203192            http://www.decisionsoft.com



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to