-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add warning when using <constraintSpec> inside <classSpec> #2173
Comments
Actually, since So the first step in resolving this ticket is generating the list of places the Stylesheets do provide an intelligent context. Schematron is processed in at least 2 different ways, I submit that if the context is generate in either method, we should not issue a warning. [1] The list is: |
Contexts in which odds/teiodds.xsl generates a
|
It seems to me that allowing constraintSpec anywhere except tagdocs elements makes no sense at all. In the case of elementSpec/attDef, IIRC the context that is generated is often wrong; I'll test that out and report back. But when you say |
Well, yes and no. I did mean “descendant of There is, of course, at least one sensible place inside In the specific case of <xsl:value-of select="ancestor::elementSpec/@nsp"/>
<xsl:value-of select="ancestor::elementSpec/@ident"/>
<xsl:text>/@</xsl:text>
<xsl:value-of select="ancestor::attDef/@nsp"/>
<xsl:value-of select="ancestor::attDef/@ident"/> which looks perfectly correct to me. (By this pass the <xsl:sequence select="
ancestor::elementSpec/@nsp
||ancestor::elementSpec/@ident
||'/@'
||ancestor::attDef/@nsp
||ancestor::attDef/@ident"/> these days. |
OK, I think I now have a working solution. As expected, the Schematron to test this ignoring In any case, this needs testing, and it is not easy to test. While I have created a single ODD file that both contains the proposed constraint and has test cases for it, you can’t just generate schemas from it and validate against them because, by definition, the Schematron schemas generated from some of the test cases have errors. (That’s why we want a constraint to catch such problems at validation stage!) So I have also created a test Schematron file by extracting the useful bits out of the generated .isosch file. So it seems to me the procedure for testing this is to do at least the following:
And we need better wording of the warning messages themselves, of course. If that all goes OK (including someone coming up with better messages), I will generate a pull request with the new constraint (in Specs/constraintSpec.xml, presumably). |
Note — I have edited the previous post by putting a new test file. The main difference is that the old test file was missing the word “not” in a key bit of prose which could have lead to serious confusion. 😕 |
Council makes GREEN to implement, with the further note that we are seriously considering requiring |
As a temporary solution for Stylesheets ticket #519, a warning should be fired whenever a
<constraintSpec>
is used inside<classSpec>
without an explicit@context
.The text was updated successfully, but these errors were encountered: