W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > April to June 2000

Re: Question on XPath expression

From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
Date: 08 May 2000 14:52:50 +0100
To: "gmacri@libero.it"<gmacri@libero.it>
Cc: www-xml-schema-comments@w3.org
Message-ID: <f5b4s89qhcd.fsf@cogsci.ed.ac.uk>
"gmacri@libero.it"<gmacri@libero.it> writes:

> In this example there is a definition of a key:
> <xs:element name="car">
>    <xs:complexType model="empty">
>     . . .
>     <xs:attribute name="regRef" type="dt:integer"/>
>     <xs:attribute name="regState" type="twoLetterCode"/>
>    </xs:complexType>
>   </xs:element>
>  </xs:complexType>
> 
>  <xs:key name="carRef" >
>   <xs:selector>.//car[@regRef]</xs:selector>
>    <xs:field>@regRef</xs:field>
>    <xs:field>@regState</xs:field>
>  </xs:keyref>
> </xs:element>
> 
> If I want define a key  similar to the key defined up, can I use as 
> content of <field> a name of element that not is descendant of "car" 
> but is  a name of element that is, for instance, the child of an 
> ancestor of car ?. 
> Thank you for all.

Yes.  As the spec. says [1], the things picked
out by <field> are not constrained to lie within the element picked
out by <selector>, and no other constraint as to locality is imposed.

ht

[1] http://www.w3.org/TR/xmlschema-1/#Identity-constraint_Definition_details
-- 
  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
          W3C Fellow 1999--2001, part-time member of W3C Team
     2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
	    Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk
		     URL: http://www.ltg.ed.ac.uk/~ht/
Received on Monday, 8 May 2000 09:53:00 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:49:52 UTC