Re: <key> problems.

Hi Abdalhmed,

AM> Hi all,
AM> Thanks for explanations. And thanks Kevin. I needed to do something like
AM> that and repeating the FormID key in the Field element was the only way
AM> i found and i was not sure whether something like that is acceptable. In
AM> fact, I need to do a little bit more than repeating keys.
AM> Here is your IDs code :-

AM> <IDs>
AM>   <Form FormID="FORM_1">
AM>     <Field FieldID="FIELD_1" FormID="FORM_1"/>
AM>     <Field FieldID="FIELD_2" FormID="FORM_1"/>
AM>   </Form>
AM>   <Form FormID="FORM_2">
AM>     <Field FieldID="FIELD_1" FormID="FORM_2"/>
AM>   </Form>
AM> </IDs>

AM>   <xs:key name="...">
AM>     <xs:selector xpath="Form/Field" />
AM>     <xs:field xpath="@FormID" />
AM>     <xs:field xpath="@FieldID" />
AM>   </xs:key>


AM> <IDs>
AM>   <Form FormID="1">
AM>     <Field FieldID="1" FormID="1"/>
AM>     <Field FieldID="2" FormID="1"/>
AM>   </Form>
AM>   <Form FormID="2">
AM>     <Field FieldID="1" FormID="2"/>
AM>   </Form>
AM>   <Form FormID="3">
AM>     <Field FieldID="1" FormID="3"/>
AM>     <Field FieldID="2" FormID="3"/>
AM>   </Form>
AM> <Description DescID="1">
AM>     <Paragraph  ParID="1" DescID="1"/>
AM>     <Paragraph  ParID="2" DescID="1"/>
AM>     <Paragraph  ParID="3" DescID="1"/>
AM> </Description>
AM> <Description DescID="2">
AM>     <Paragraph  ParID="1" DescID="2"/>
AM> </Description>
AM> </IDs>

AM>   <xs:key name="FormKey">
AM>     <xs:selector xpath="Form/Field" />
AM>     <xs:field xpath="@FormID" />
AM>     <xs:field xpath="@FieldID" />
AM>   </xs:key>

AM>   <xs:keyref name="RefToFormKey" refer="FormKey">
AM>     <xs:selector xpath="Form/Description" />
AM>     <xs:field xpath="@ParID" />
AM>     <xs:field xpath="@DescID" />
AM>   </xs:key>


If you are trying to do what I think you are trying to do (make the
attributes of Description/Paragraph reference those of Form/Field),
then the <keyref> selector should be "Description/Paragraph" and the
@DescID field should be before the @ParID field. (I am assuming order
is significant here)

So, try putting these on the <IDs> element:

 <xs:key name="FormKey">
   <xs:selector xpath="Form/Field" />
   <xs:field xpath="@FormID" />
   <xs:field xpath="@FieldID" />
 </xs:key>

 <xs:keyref name="RefToFormKey" refer="FormKey">
   <xs:selector xpath="Description/Paragraph" />
   <xs:field xpath="@DescID" />
   <xs:field xpath="@ParID" />
 </xs:key>


-- 
groovy baby,
 Kevin                    mailto:xmldude@burieddreams.com

++++++++++++ Cool music - http://burieddreams.com/marshan
++++++ Attitude Webzine - http://burieddreams.com/attitude

Received on Tuesday, 20 November 2001 06:22:37 UTC