This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
This report relates to the Microsoft Additional test set, test group addB049, which uses the schema test72232_1.xsd and the instance document test72232_1.xml. I'm hesitant to raise a bug on an issue concerning key and keyref with different scope, because the spec here is so complex that there is probably only one person who understands it and that person is not me. However, I believe the instance is invalid, and Xerces appears to agree. The published metadata says that the schema and instance are both valid. References are to Validation Rule: Identity-constraint Satisfied In this example the keyref is associated with element B, which is a child of element root; the referenced key is associated with element root. The element structure contains no recursion. Under rule 4.3, "there must be a ·node table· associated with the {referenced key} in the [identity-constraint table] of the element information item". Here "the element information item" refers to element B. I believe that element B has no node table associated with the referenced key, because an element only acquires such a node table either (a) if the key is defined on that element, or (b) if one of its children has a node table for the key. Informally, the rule seems to be that a keyref can have wider scope than the corresponding key, but it cannot have narrower scope.
Agreed that this test is not valid to be published as a compliance suite. We are following up with the WG to determine the process of updating the test suite.
Discussion of this bug led to long and complex discussion trying to understand the spec. We conjectured that the rules for key/keyref could be replaced by creating some kind of assertion: given E1 with keyref name=KR select=S field=F and E2 with key name=KN select=T field=G, we are saying something like for each E1 for each s in eval(S) let v := eval(F) for each E2 some t in eval(T) satisfies eval(G) = v But en route we confirmed that it seems to be the case that a keyref with lower scope that the key won't be satisfied.
I believe the metadata for the test has been updated incorrectly. The schema has been changed from valid to invalid, while the instance is still marked as valid. The schema should have been left unchanged (as valid) and the instance marked invalid.
Previous comment correct, metadata fixed accordingly