Re: key/keyref problem

Priscilla Walmsley wrote:
> 
> Hello,
> 
> You are correct that it should be a QName.  I suspect it was a bug in a
> previous version of XSV because the current on-line version of XSV does not
> consider it an error.

Good ;) ...

> To answer your question about why it is a QName, the key and keyref
> definitions do _not_ have to be defined side by side in the same scoping
> element.  The scoping element of the key can be a child of the scoping
> element of the keyref.  That child may be in a different namespace.

This is a point I find most confusing in the spec.

The rec [1] says that:

If the {identity-constraint category} is keyref, then for each member of
the ·qualified node set· (call this the keyref member), there must be a
·node table· associated with the {referenced key} in the
[identity-constraint table] of the element information item (see
Identity-constraint Table (§3.11.5), which must be understood as
logically prior to this clause of this constraint, below) and there must
be an entry in that table whose ·key-sequence· is equal to the keyref
member's ·key-sequence· member for member, as defined by Equal in [XML
Schemas: Datatypes].

[1]
http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#section-Identity-constraint-Definition-Information-Set-Contributions

I am probably wrong, but I read this as implying a need that the key and
keyref tables belong to the same element.

Furthermore, I would also think that allowing scoping element of the key
or unique definition to be a child of the scoping element of the keyref
still more confusing.

If I understand what you mean correctly, it's allowing cases such as:

<root>
 <sub>
   <key id="1"/>
   <key id="2"/>
 </sub>
 <sub>
   <key id="2"/>
   <key id="3"/>
 </sub>
 <keyref ref="2"/>
</root>

.../...

<xs:element name="root">

  <xs:element name="sub">
   .../...
   <xs:key name="key">
    <xs:selector xpath="key"/>
    <xs:field xpath="@id"/>
   </xs:key>
  </xs:element>

  <xs:keyref name="keyref" refer="key">
   <xs:selector xpath="keyref"/>
   <xs:field xpath="@ref"/>
  </xs:key>

</xs:element>

where one cannot determine which key is referred by a keyref.

This is also troubling to see that the scope of a key is wider than the
element in which it is defined and I would have found it less confusing
if it would have been the scoping element of the keyref that could have
been a child of the scoping element of the key or unique.

I have probably misread the rec and|or your answer, but I can't figure
out what I have wrong!

> In this example, mykey could have been defined in the declaration of keys,
> and dummy1 could have been defined in the declaration of root.
> 
> Hope that helps!

Yes, it does.

Thanks

Eric
> 
> Priscilla Walmsley
> Vitria Technology
> 
-- 
See you at XTech in San Diego.
             http://conferences.oreillynet.com/cs/os2001/view/e_spkr/790
------------------------------------------------------------------------
Eric van der Vlist       http://xmlfr.org            http://dyomedea.com
http://xsltunit.org      http://4xt.org           http://examplotron.org
------------------------------------------------------------------------

Received on Monday, 2 July 2001 16:01:05 UTC