Let's say I have following XML file:
<authors>
<author>a1</author>
<author>a2</author>
<lastmodified>2010</lastmodified>
</authors>
and an XML schema fragment:
<xs:element name="authors" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="author" maxOccurs="unbounded" type="xs:string"> </xs:element>
<xs:element name="lastmodified" type="xs:date" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:unique name="uniqueAuthor">
<xs:selector xpath="."/>
<xs:field xpath="author"/>
</xs:unique>
</xs:element>
What I want is to make a constraint that will not allow two identical author values, but the one above doesn't work that way. What am I doing wrong?