use Pure ODD for content model elements#2734
Conversation
Schematron, to constrain content of content model elements
alternate element must have 2+ children
not effect what is considered valid or invalid, but make the content model more readable by humans.
|
This looks like a clever replacement to me that matches the intended behavior for |
|
I agree with @raffazizzi that the closer thing is probably not part of this. I also went back to the original ticket for this branch, which is closed, and I'm not sure I understand what the actual motivation for this PR is. Schematron is a fully valid component of the TEI schema system, and I worry that an overly-complicated Pure ODD content model is perhaps less comprehensible and maintainable than a simple Schematron rule. @sydb is there any motivation other than that it's an interesting challenge to make this work? |
So, as I see it, the arguments in favor are:
The argument against is:
I have tried to mitigate that one argument against by providing lots of commentary. |
NOTE — this PR is to merge changes into theiss2154_interleavebranch, notdev. Therefore it would beehoove us to merge it before we mergeiss2154_interleave.The primary idea behind this PR is to use Pure ODD, rather than Schematron, to require that each of the content model wrapper elements (
<alternate>,<interleave>, and<sequence>) has two or more children.HOWEVER, as I went about doing so I realized that the existing content model for
<alternate>had a bug. It wasThat allows for two or more
<valList>children. I am not 100% sure what having an<alternate>with 3<valList>s would mean.¹ But in any case, if there is more than one<valList>, the Stylesheets simply ignore the whole<alternate>(and, in my test, the<elementRef>I had before it, but not the<elementRef>I had after it — weird).So I replaced this content model (and the Schematron that went with it to ensure 2+ children) with:
That is reasonably complicated, partially because it is a mildly complex set of restrictions, and partially because we cannot use an ambigous model (because DTDs and XSDs choke on them). But I have provided an English description below. In any case, the really astute reader may notice that this new content model prohibits two sequences of elements that were allowed under the old one:
<valList>. Since these don’t work, anyway, this is a good thing. (And one of the desired effects.)model.contentPartfollowed by a<valList>followed by one or moremodel.contentPart. It is at least very difficult, if not impossible, to allow this sequence and remain unambiguous. But I really cannot see any user complaining that she has to put the<valList>either first or last. (Heck, I find it hard to imagine any user ever making use of an<alternate>that includes a<valList>child and has more than 2 children. There are no such cases in P5.)In any case, I have built P5 and the exemplars and run the tests in the Docker (this branch against the
devbranch of the Stylesheets), and they all worked.below
It is a bit easier to say this in English if the content model were written in a different order:
That declares exactly the same content, and if I had thought ahead to the problem of explaining it in English, I might have done it that way. Given this re-ordered model, the following is a possibly helpful description of it:
notes
¹ My guess is that it would mean “any one value from any of these value lists”. And one could imagine a situation where it would be useful to get the lists into the
<alternate>via XInclude, and thus allowing more than 1 would be necessary. But I daresay no one has ever even seen that done before, let alone done it, because our Stylesheets couldn’t process it!