Reputation: 488
Why are the below schemas different? I am just trying to make a simple keyref, and I can provide more context if necessary...
<!-- This works -->
<xsd:keyref name="followsKey" refer="userKey">
<xsd:selector xpath="user/follows" />
<xsd:field xpath="." />
</xsd:keyref>
<!-- This doesn't -->
<xsd:keyref name="followsKey" refer="userKey">
<xsd:selector xpath="user" />
<xsd:field xpath="@follows" />
</xsd:keyref>
Upvotes: 0
Views: 42
Reputation: 163468
They are different in that one refers to an element named "follows", the other refers to an attribute named "follows".
If the second one were written <xsd:field xpath="follows"/>
, it would differ from the first in that it would only work if a user
element has a single follows
element child, whereas the first allows a user
to have multiple follows
children, each of which acts as a keyref.
Upvotes: 2