- From: Jeni Tennison <jeni@jenitennison.com>
- Date: Mon, 19 Nov 2001 13:07:38 +0000
- To: Kevin Burges <xmldude@burieddreams.com>
- CC: ht@cogsci.ed.ac.uk ((\(Henry S. Thompson)), xmlschema-dev@w3.org
Hi Kevin,
> I understand that a single key cannot assert the uniqueness of FormIDs
> and FieldIDs within those, as that would be a multi-stage key. Lets
> assume this uniqueness does not exist, and something like this was valid:
>
> <IDs>
> <Form FormID="FORM_1">
> <Field FieldID="FIELD_1"/>
> </Form>
> <Form FormID="FORM_2">
> <Field FieldID="FIELD_1"/>
> </Form>
> <Form FormID="FORM_1"> <!-- NOTE: FORM_1 again -->
> <Field FieldID="FIELD_2"/>
> </Form>
> </IDs>
>
> Could I not have a multipart key which consists of:
> {@FormID @FieldID}
>
> which in this example would give:
> {FORM_1 FIELD_1}
> {FORM_2 FIELD_1}
> {FORM_1 FIELD_2}
In this case, you could because you could make a key that selected
each *Form* element and created an entry for its FormID attribute and
its child Field's FieldID attribute:
<xs:key name="...">
<xs:selector xpath="Form" />
<xs:field xpath="@FormID" />
<xs:field xpath="Field/@FieldID" />
</xs:key>
But this would rely on you only having one Field under each Form -
otherwise the key would not be valid.
> By my understanding this would be a multipart key not a multi-stage
> key, because it is only the combination of FormID and FieldID which
> is being constrained.
>
> Functionally it would do what I want, as I could set a keyref to check
> that:
>
> <Check FormID="FORM_1" FieldID="FIELD_2"/>
>
> does actually refer to the {FORM_1 FIELD_2} entry in of the key??
You could write a keyref to the above key based on those attributes no
problem.
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
Received on Monday, 19 November 2001 08:07:41 UTC