- From: Chan, Philip <Philip.Chan@rbccm.com>
- Date: Wed, 21 Nov 2001 12:06:12 -0500
- To: "'xmlschema-dev'" <xmlschema-dev@w3.org>
- Message-ID: <A2AB950B23E5D411B23C00805FA7BBC80195EF0B@TOTOMB04>
Given an XML such as: <payroll> <depts> <hr location="Toronto"> ... </hr> <hr location="London"> ... </hr> <finance location="Toronto"> ... </finance> <finance location="New York"> ... </finance> </depts> <employees> <name="xxx"> <dept> <name>hr</name> <location>London</location> </dept> </name> <name="xxxx"> ... </name> </employees> </payroll> In the above XML, the number of depts are known and limited to not more than 20. In the schema, I have defined unique constaints on both hr and finance and for other depts, if any: <xsd:unique name="HRKey"> <xsd:selector xpath="/payroll/depts/hr" /> <xsd:field xpath="@location" /> </xsd:unique> <xsd:unique name="FinanceKey"> <xsd:selector xpath="/payroll/depts/finance" /> <xsd:field xpath="@location" /> </xsd:unique> Now, is it possible to create a key and keyref constaints so that /payroll/employees/name/dept/name and /payroll/employees/name/dept/location are only pointing to: /payroll/"any node()" and /payroll/"the node()"@location? I understand that life will be much easier if I could rewrite the XML to: <payroll> <depts> <dept name="hr" location="Toronto"> ... </dept> <dept name="hr" location="London"> ... </dept> <dept name="finance" location="Toronto"> ... </dept> <dept name="finance" location="New York"> ... </dept> </depts> ... but I couldn't. Thanks Philip
Received on Wednesday, 21 November 2001 12:06:53 UTC