Skip to content

Conversation

@sydb
Copy link
Member

@sydb sydb commented Mar 14, 2024

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

sydb added 2 commits March 14, 2024 16:14
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".
@martindholmes
Copy link
Contributor

@sydb Does this take account of namespaces? You could correctly have two atts with the same @ident but in different namespaces, no? Forgive me if I've missed it; I'm reading on my phone.

@sydb
Copy link
Member Author

sydb commented Mar 15, 2024

No, it does not. For some reason I guess I thought we had decided to look at only @ident (not +@ns), but that would be silly.
Will try to fix v. soon.

@sydb sydb marked this pull request as draft March 15, 2024 20:25
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.
@sydb sydb marked this pull request as ready for review March 15, 2024 21:53
@sydb
Copy link
Member Author

sydb commented Mar 15, 2024

Fixed, and added more tests to detest.

@sydb
Copy link
Member Author

sydb commented Mar 15, 2024

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.

@martindholmes
Copy link
Contributor

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

sydb added 5 commits April 13, 2024 02:54
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.)
@sydb
Copy link
Member Author

sydb commented Apr 13, 2024

  1. Rebased current dev into this branch
  2. Addressed concern about namespace URIs, above
  3. Tested, passes all tests on my local system (except NVDL and XeLaTeX do not work on my system, so are untested). Only error is the 3 <superEntry> warnings that have nothing to do with this PR.

@ebeshero
Copy link
Member

ebeshero commented Apr 13, 2024

@martindholmes Our VF2F subgroup agreed, and our suggestion was just to make up a portmanteau URL, likehttps://teitube.org or some such. Re-reading now, your ns suggestion is probably more befitting to the task.

sydb added 6 commits April 25, 2024 15:22
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
Copy link
Member Author

sydb commented May 18, 2025

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

  1. Leave things as they are — users should see the comments on the tagdoc pages. (We might want to make them prettier, though.)
  2. Continue to use the comments in the source, change Stylesheets so that comments within a <constraint> are not reproduced on the tagdoc pages.
  3. Remove the comments from the source. In which case, we probably want to add a big block comment outside the <constraint> that tries to explain what is going on in there. This makes both writing and using the comments somewhat harder, but does solve the problem.
  4. Change the Stylesheets so that comments within a <constraint> are not reproduced on the tagdoc pages, and then start using the <sch:p> element to document things inside a <constraint> when we do want the documentation to show up in the tagdoc page. NOTE: OXygen says the <sch:p> element is valid; our schema says it is not. So we would have to investigate and fix that, first.
  5. Invent a mechanism to allow the ODD author to say whether any particular comment should show up in the output or not. (E.g., a <tei:comment> element with an @includeInDocumentation attribute.)

@sydb
Copy link
Member Author

sydb commented May 19, 2025

Council decides this PR is blocked awaiting TEIC/Stylesheets#746.

@sydb sydb removed Status: Blocked Status: Pending pending action described in a comment, to return to discussion before further action will be taken labels Jan 3, 2026
@ebeshero
Copy link
Member

ebeshero commented Jan 4, 2026

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 <attDef> elements with the same @ident in the same ancestor::attList[not(@choice)] and not in different namespaces. Reminding myself of that, I'll try to test the PR now.

@ebeshero ebeshero self-requested a review January 4, 2026 00:26
Copy link
Member

@ebeshero ebeshero left a 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]
Copy link
Member

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.

Copy link
Member

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.

@ebeshero ebeshero merged commit dce382e into dev Jan 4, 2026
2 checks passed
@sydb sydb deleted the sydb_2371 branch January 4, 2026 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants