-
Notifications
You must be signed in to change notification settings - Fork 96
no duplicate <attDef>s allowed
#2534
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
Conversation
that flags as an error any 2+ attDef elements who both share an ancestor attList and have the same ident= attribute (regardless of the mode= attr value) unless they are both (all) children of an attList that has an org= attribute value of "choice".
|
@sydb Does this take account of namespaces? You could correctly have two atts with the same |
|
No, it does not. For some reason I guess I thought we had decided to look at only |
Per suggestion @martindholmes, make sure to think of two attributes that have the same local name (i.e., ident= attribute) but different namespaces (i.e., ns= attribute); since the attList element does not have an ns= attribute, we do not have to worry about inheritance, which makes this much easier.
|
Fixed, and added more tests to detest. |
|
One possible concern is that the comments I put in the Schematron show up in the Guidelines. Some folks will like that, others won’t. |
|
@sydb I know you will think this is trivial, but I don't think we should use YouTube URLs as spurious namespaces in tests. I don't think it's polite to commandeer someone else's domain for this sort of purpose, and I would also be concerned that any controversy or conflict arising in relation to one of these URLs in future might draw the TEI into something it has no connection with. I would prefer to use something like http://www.tei-c.org.ns/test/eg1, 2, 3 and so on. If you have no strong preference for keeping these YouTube URLs, I'll happily add a fix to the PR for this. |
that flags as an error any 2+ attDef elements who both share an ancestor attList and have the same ident= attribute (regardless of the mode= attr value) unless they are both (all) children of an attList that has an org= attribute value of "choice".
Per suggestion @martindholmes, make sure to think of two attributes that have the same local name (i.e., ident= attribute) but different namespaces (i.e., ns= attribute); since the attList element does not have an ns= attribute, we do not have to worry about inheritance, which makes this much easier.
Per suggestion @ebeshero use a different host for easter egg namespace URIs. Also required update to expected results to match new formatting of Schematron msgs. (Not sure why that change wasn’t already present.)
|
|
@martindholmes Our VF2F subgroup agreed, and our suggestion was just to make up a portmanteau URL, like |
that flags as an error any 2+ attDef elements who both share an ancestor attList and have the same ident= attribute (regardless of the mode= attr value) unless they are both (all) children of an attList that has an org= attribute value of "choice".
|
OK. We really should not have let this fester for 11 months. (I take much of the blame for that, BTW.) Made it quite difficult to bring it up to date with current dev branch and to figure out what the BLEEP is being done. Luckily, I left reasonably detailed comments. They are, however, the problem. That is, I think this branch is ready to go, except for the issue of the comments. It still requires review and testing, of course, this is complicated stuff. But the comments require a decision by Council. This is some pretty complicated Schematron code. (I suspect, but do not know, that it would be somewhat simpler using the upcoming next version of Schematron, but I do not think it would be simple enough that anything in this discussion about comments would be different.) The good news is the comments therein make it somewhat easier to understand. The bad news is those comments get reproduced in the HTML output of the Guidelines. Some folks do not think the comments should be there. Possible ways to address this concern (in a numbered list just so we can refer to them, no order of preference implied, as I have not made up my mind):
|
|
Council decides this PR is blocked awaiting TEIC/Stylesheets#746. |
|
Just updating the comments here: No longer blocked because we resolved the method of excluding comments from the Guidelines output. So we're now testing whether this constraint works to target duplicate |
ebeshero
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sydb I've reviewed the code, made a bunch of tiny prose edits on the detest file in GitHub's suggest mode that we can just review and merge in via the web interface. I can verify that this passes tests, doesn't break builds, and when I run exemplars and work with a generated TEI-All schema, it works to validate an ODD with a bunch of different test cases for attributes of the same @ident value with and without namespaces. Looks good to me.
| preceding-sibling::tei:attDef[ | ||
| @ident eq $ad/@ident | ||
| and | ||
| ( @ns, $notanamespace )[1] eq ( $ad/@ns, $notanamespace )[1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sydb This part seems a little abstruse, but it's ultimately readable when we see that $notanamespace is just a bit of string. I guess it saves you from having to write an extra set of conditions for namespaced attribute or not, and somehow it makes sense for coping with the situation of the same attribute name with and without a namespace. And I can definitely verify that it works on a test ODD I just wrote.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm just committing my suggestions since they're pretty tiny and just prose edits.
Address #2371 with a Schematron constraint that flags as an error any 2+
<attDef>s that both share an ancestor<attList>and have the same@ident(regardless of the@mode) unless they are both (all) children of an<attList>that has an@orgattribute value of "choice".The file detest.odd has been updated to test this reasonably well.
If tests pass, I personally do not think any deprecation period is necessary. (What would it deprecate, anyway?) The error this new constraint catches is an error.
Reviewers: If you actually look at the code differences the most important bit (by far) to look at is the new lines 24–76 (in green) of attList.xml.