restriction= fails to restrict a <dataRef> with a key=
The Stylesheets do the right thing with
<dataRef name="nonNegativeInteger" restriction="[0-9][0-9]?">
However, when handed a
<dataRef key="teidata.count" restriction="[0-9][0-9]?">
The @restriction is ignored.
(Discovered, BTW, while working on Test2/ :-)
Note: when this is fixed, the file Test2/expected-results/testPure1InvalidInstanceRngMessages.txt will need to be updated, and the <note> in Test2/inputFiles/invalidInstances/testPure1InvalidInstance.xml deleted.
If you want to further restrict a TEI datatype, why not just define a new dataSpec? I suspect that the logic of combining a restriction with a predefined TEI datatype (which might itself have a restriction) may be a bit less than obvious.
Well, you’re absolutely right, @lb42, that creating a new datatype with <dataSpec> is another way to do this sort of thing, and may even be a better way. But the documentation for <dataRef> says that you can use @restriction exactly like this. So I still think we should either fix the Stylesheets so it works or add a remark that says you shouldn’t use @restriction with @key. (And schema code, either <attList org="choice">, or if #144 affects this, then Schematron, to back it up.)
The spec doesn't actually say you CAN use @restriction with @key, though I agree it doesn't forbid it as firmly as it forbids using a child dataFacet with @key. Since this (using dataFacet) is really very similar, I'd vote for tweakling the existing schematron rule to prohibit either.
@hcayless — My apologies for not paying attention to this for 11 months. Sigh. Is d15e452 supposed to fix this issue, or just part of it? I ask because a quick test says it works when the <dataRef> points to teidata.count, but not when it points to teidata.temporal.w3c. I have not done further testing, figuring I should ask, first.
Either way, I think this change should probably be reverted per #1606 (we do not allow @restriction on a <dataRef> that uses @key).