Re: Question on XPath expression

"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