key/keyref problem and XSV

I am working on key/keyref and XSV (XSV 1.203/1.106 of 2001/09/03 
16:31:12) doesn't seem to follow our conclusions:

Instance:
<doc>
  <section>
   <key id="1"/>
   <key id="2"/>
  </section>
  <section>
   <key id="3"/>
   <key id="2"/>
  </section>
  <ref ref="1"/>
</doc>

Schema:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
elementFormDefault="qualified">
<xs:element name="doc">
  <xs:complexType>
   <xs:sequence>
     <xs:element name="section" maxOccurs="unbounded">
      <xs:complexType>
       <xs:sequence>
        <xs:element name="key" maxOccurs="unbounded">
         <xs:complexType>
   <xs:attribute name="id" type="xs:integer"/>
         </xs:complexType>
        </xs:element>
       </xs:sequence>
      </xs:complexType>
      <xs:unique name="key">
       <xs:selector xpath="key"/>
       <xs:field xpath="@id"/>
      </xs:unique>
     </xs:element>
     <xs:element name="ref" maxOccurs="unbounded">
      <xs:complexType>
       <xs:attribute name="ref"/>
      </xs:complexType>
     </xs:element>
   </xs:sequence>
  </xs:complexType>
  <xs:keyref refer="key" name="keyref">
   <xs:selector xpath="ref"/>
   <xs:field xpath="@ref"/>
  </xs:keyref>
</xs:element>
</xs:schema>

The xs:unique (or xs:key) is defined at "/doc/section" and should be 
"visible" by the xs:keyref defined at "/doc", but XSV complains that:

<invalid char='1' code='cvc-identity-constraint.2.3.2' line='1' 
resource='key-keyref.xml'>No key or unique constraint named {None}:key 
applies below here, refed by keyref {None}keyref</invalid>

Is-it a XSV bug or anything else I have got wrong?

Thanks

Eric


Henry S. Thompson wrote:

> Sorry I've been on holiday.  I agree with everything Priscilla has
> said in this thread.
> 
> Ignoring the mistaken Primer example, the spec. actually says exactly
> what your Conclusion 3. says, but goes in to more detail wrt cases
> your summary doesn't cover.
> 
> "Aung Aung" <aaung@microsoft.com> writes:
> 
> 
>>3. What I understand your interpretation:
>>In short, we need following 2 rules.... with them the confusion above
>>will be clarified. (do I have it correctly)?
>>    A <key A> is referable by all the <keyref A>s from only
>>ancestor-or-self of the element that host the <key A>. 
>>    A <keyref A> can only refer to one of the <key>s defined in the
>>decendent-or-self of the element that host the <keyref A>. 
>>
> 
> ht
> 

-- 
See you in Scottsdale, Arizona.
      http://xmlconnections.com/xml/xmlfall2001/speakers.asp#evandervlist
------------------------------------------------------------------------
Eric van der Vlist       http://xmlfr.org            http://dyomedea.com
http://xsltunit.org      http://4xt.org           http://examplotron.org
------------------------------------------------------------------------

Received on Monday, 24 September 2001 06:28:04 UTC