(temporarily?) remove abstract pattern for declarable elements #2751
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
branch concern
I am not 100% that I got the branch-management part of this correct. My instinct is that the patch release should be made from the "release-4.10.1" branch, and then it should be merged into the "released" branch (i.e., this PR). But IIRC the actual release procedure is to merge first.
changes made and why
[I told the folks at the meeting this morning that I would test removing only the abstract pattern, rather than removing all 40 concrete instances of that pattern, but that I did not think it would work because Schematron would (quite reasonably) complain that it cannot find the abstract pattern that is instantiated in each of the att.declarable elements.]
Boy, am I an idiot. Or, more likely, I am getting demented.
I tested (by removing the one abstract pattern from P5/Source/Specs/att.declarable.xml), and the build worked! But it should not have worked. You can test this if you want by whipping up a new Schematron schema that has nothing but:
If you try to process that with SchXslt for sure, and with any modern Schematron processor I bet, you will get serious errors. Heck, oXygen flags validity errors before you even try to use it! This is because this code says to the processor “go find the pattern with ID "W-P" and execute it, replacing the parameter $Wendy with the value
Chynna.”, but when the processor looks for a pattern with ID "W-P" it cannot find one.So why was there no error in our build process? Because less than 3 months ago we updated our Stylesheets so as to drop concrete instances of abstract patterns when the abstract pattern is missing (see TEIC/Stylesheets#751). That is, when our Stylesheets find a Schematron pattern in p5.xml (or p5subset.xml) that has an
@is-a, they check to see if there is a corresponding abstract pattern; if there is NOT such an abstract pattern, the pattern with the@is-ais NOT copied over to the output schema.That is to say ~3 months ago we wrote code for the Stylesheets that anticipated this exact situation, and does the right thing. The embarrassing bit is that I was the one who did that! Sigh.
addendum, not really pertinent to the actual change to TEI
We originally thought I was going to have to modify all 40 specifications for the elements that are members of att.declarable. I asserted at the meeting (some might say bragged) that I would probably do this using an Emacs macro, so I could do it “using only one keystroke” per file. Others at the meeting, perhaps a bit dubious, wanted me to post the macro, so here it is:
That macro deserve a little annotation:
M-<= goto top of file (probably not needed, as files open to the top by default, but just in case …)C-s SPC i s - a = \"= incremental search (forward) for the string “ is-a="” (which will never occur except in a concrete instantiation of an abstract pattern)<right>= move cursor one character to the right (not really important, but cancels the incremental search — if I had thought ahead I might have done a regular search instead, but the result is the same)C-r < c o … p e c= incremental search (backward) for the string “<constraintSpec”C-a= move cursor to the beginning of the line (which is now the line that has “<constraintSpec”)C-SPCremember this spot (i.e., remember the current cursor position)C-s < / c … p e c= incremental search (forward) for the string “</constraintSpec”C-e= move cursor to the end of the line (which is now the line that has “</constraintSpec”)<right>= move cursor one character to the right (which puts it at 1st char of line after end-constraintSpec tag)M-x c o m … e g i <tab> <return>= issue the commandcomment-regionwhich comments out all lines between the spot that was remembered and the place the cursor is currentlyAnd presto! Just by typing
C-x e(which means “execute last keyboard macro”) it (the problematic<constraintDecl>) is commented out. Setting up this macro took around 1 minute.The observant among you will notice that this would not work if there were other tags on the same lines as
<constraintSpecand</constraintSpec. Luckily there are not. You also might say “but that is 2 keystrokes, Syd,C-xande”. And, in some sense, that is a valid complaint. But IIRC the Emacs manual calls the entire combination a single keystroke. (TheC-xpart is differentiated as a "prefix".)