Stylesheets icon indicating copy to clipboard operation
Stylesheets copied to clipboard

restriction= fails to restrict a <dataRef> with a key=

Open sydb opened this issue 7 years ago • 6 comments

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/ :-)

sydb avatar Dec 08 '18 15:12 sydb

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.

sydb avatar Dec 08 '18 15:12 sydb

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.

lb42 avatar Jul 21 '19 17:07 lb42

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.)

sydb avatar Jul 21 '19 18:07 sydb

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.

lb42 avatar Jul 21 '19 18:07 lb42

@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.

sydb avatar Feb 28 '21 19:02 sydb

Either way, I think this change should probably be reverted per #1606 (we do not allow @restriction on a <dataRef> that uses @key).

sydb avatar Mar 01 '21 02:03 sydb