<key> problems.

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

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

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


Imagin that you need to "link" <Form> elements to let's say
<Description> elements. <Descritpion> elements are defined "like" <Form>
elements
Here is an example of what i need to do :-

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

  <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="Form/Description" />
    <xs:field xpath="@ParID" />
    <xs:field xpath="@DescID" />
  </xs:key>

Well, what i'm looking to do is to have a <Description> element which
contain a sub element, here it is called <Paragraph>. The 2 attributes
of <Paragrph> refrence the <key> FormKey. Does this <IDs> element is
valid having the <key> FormKey and the <keyref> RefToFormKey?? I wonder
whether repeating the key in the attribute FieldID of <Form> works? And
if it does, whether it is a good manner to do so? Do you have any
suggetions for that?

In other words, what i'm looking for is to link <Form> elements to
another one; like <Description>. And the relationship is of kind
many-to-one.
Thanks for any help.

Hamid Maran

Received on Monday, 19 November 2001 11:31:33 UTC