use Pure ODD for content model elements #2734
Open
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.
NOTE — this PR is to merge changes into the
iss2154_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!