Skip to content

Commit 052a340

Browse files
authored
Merge pull request #2559 from TEIC/sydb_2497_p_in_epigraph_in_lg_is_OK
fix an abstract model violation msg
2 parents fe8f7ce + 32bbed2 commit 052a340

File tree

7 files changed

+97
-89
lines changed

7 files changed

+97
-89
lines changed

P5/Source/Specs/ab.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@
2828
<content>
2929
<macroRef key="macro.abContent"/>
3030
</content>
31-
<constraintSpec ident="abstractModel-structure-ab-in-l-or-lg" scheme="schematron" xml:lang="en">
31+
<constraintSpec ident="abstractModel-structure-ab-in-l" scheme="schematron" xml:lang="en">
3232
<constraint>
33-
<sch:rule context="tei:ab">
34-
<sch:report test="(ancestor::tei:l or ancestor::tei:lg) and not( ancestor::tei:floatingText |parent::tei:figure |parent::tei:note )">
35-
Abstract model violation: Lines may not contain higher-level divisions such as p or ab, unless ab is a child of figure or note, or is a descendant of floatingText.
36-
</sch:report>
33+
<sch:rule context="tei:l//tei:ab">
34+
<sch:assert test="ancestor::tei:floatingText | parent::tei:figure | parent::tei:note">
35+
Abstract model violation: Metrical lines may not contain higher-level divisions such as p or ab, unless ab is a child of figure or note, or is a descendant of floatingText.
36+
</sch:assert>
3737
</sch:rule>
3838
</constraint>
3939
</constraintSpec>

P5/Source/Specs/div.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@
6565
</sequence>
6666
</sequence>
6767
</content>
68-
<constraintSpec ident="abstractModel-structure-div-in-l-or-lg" scheme="schematron" xml:lang="en">
68+
<constraintSpec ident="abstractModel-structure-div-in-l" scheme="schematron" xml:lang="en">
6969
<constraint>
70-
<sch:rule context="tei:div">
71-
<sch:report test="(ancestor::tei:l or ancestor::tei:lg) and not(ancestor::tei:floatingText)">
72-
Abstract model violation: Lines may not contain higher-level structural elements such as div, unless div is a descendant of floatingText.
73-
</sch:report>
70+
<sch:rule context="tei:l//tei:div">
71+
<sch:assert test="ancestor::tei:floatingText">
72+
Abstract model violation: Metrical lines may not contain higher-level structural elements such as div, unless div is a descendant of floatingText.
73+
</sch:assert>
7474
</sch:rule>
7575
</constraint>
7676
</constraintSpec>

P5/Source/Specs/p.xml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,12 @@
4949
</sch:rule>
5050
</constraint>
5151
</constraintSpec>
52-
<constraintSpec ident="abstractModel-structure-p-in-l-or-lg" scheme="schematron" xml:lang="en">
52+
<constraintSpec ident="abstractModel-structure-p-in-l" scheme="schematron" xml:lang="en">
5353
<constraint>
54-
<sch:rule context="tei:p">
55-
<sch:report test="( ancestor::tei:l or ancestor::tei:lg ) and
56-
not( ancestor::tei:floatingText
57-
| parent::tei:figure
58-
| parent::tei:note )">
59-
Abstract model violation: Lines may not contain higher-level structural elements such as div, p, or ab, unless p is a child of figure or note, or is a descendant of floatingText.
60-
</sch:report>
54+
<sch:rule context="tei:l//tei:p">
55+
<sch:assert test="ancestor::tei:floatingText | parent::tei:figure | parent::tei:note">
56+
Abstract model violation: Metrical lines may not contain higher-level structural elements such as div, p, or ab, unless p is a child of figure or note, or is a descendant of floatingText.
57+
</sch:assert>
6158
</sch:rule>
6259
</constraint>
6360
</constraintSpec>

P5/Test/detest.odd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -464,14 +464,14 @@
464464
<desc>This <gi>constraintSpec</gi> is invalid because it is
465465
missing <att>scheme</att> in <val>add</val> mode.</desc>
466466
<constraint>
467-
<sch:report test="false()">This rule never fires.</sch:report>
467+
<sch:report test="false()">This rule never fires, 01</sch:report>
468468
</constraint>
469469
</constraintSpec>
470470
<constraintSpec ident="replace_missing_scheme" mode="replace" xml:lang="en">
471471
<desc>This <gi>constraintSpec</gi> is invalid because it is
472472
missing <att>scheme</att> in <val>replace</val> mode.</desc>
473473
<constraint>
474-
<sch:report test="false()">This rule never fires.</sch:report>
474+
<sch:report test="false()">This rule never fires, 02.</sch:report>
475475
</constraint>
476476
</constraintSpec>
477477
<constraintSpec ident="test_contextless_report" scheme="schematron" xml:lang="en">
@@ -480,7 +480,7 @@
480480
(i.e., does not have a <tag>sch:rule
481481
context="…"</tag>.)</desc>
482482
<constraint>
483-
<sch:report test="false()">This rule never fires.</sch:report>
483+
<sch:report test="false()">This rule never fires, 03.</sch:report>
484484
</constraint>
485485
</constraintSpec>
486486
<!--

P5/Test/detest.xml

Lines changed: 77 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
<head>Testing schematron constraints</head>
8383

8484
<p xml:lang="la">
85-
sicut erat in
85+
sicut erat in
8686
<bibl><author>freddy</author></bibl> principia
8787
<list>
8888
<item>
@@ -91,14 +91,14 @@
9191
<num value="1/2"/> cats
9292
</item>
9393
</list>
94-
</p>
94+
</p>
9595

96-
<div>
96+
<div>
9797
<p>Added by MDH. This tests the Schematron constraint that any
9898
element with <att>calendar</att> must have some textual
9999
content.</p>
100100
<p><date when="2012-09-06" calendar="http://en.wikipedia.org/wiki/Gregorian_calendar"/></p>
101-
</div>
101+
</div>
102102

103103
<div>
104104
<head generatedBy="human">For CMC</head>
@@ -130,7 +130,7 @@
130130
</div>
131131
</div>
132132

133-
<div type="testingSpan">
133+
<div type="testingSpan">
134134
<p><del>This has some content which is OK </del>
135135
<delSpan spanTo="#ds1"/>This one doesn't<anchor xml:id="ds1"/> but that's also OK.
136136
<delSpan/> That one (just to my left) is illegal
@@ -145,8 +145,8 @@
145145
<head>A Canon Text</head>
146146
<p>hello</p>
147147
</div>
148-
</div>
149-
<div type="canon">
148+
</div>
149+
<div type="canon">
150150
<head>Canon 2</head>
151151
<p>hello</p>
152152
<div type="canonText">
@@ -157,35 +157,35 @@
157157
<head>A 2nd Canon Text</head>
158158
<p>hello</p>
159159
</div>
160-
</div>
161-
<div type="canon">
160+
</div>
161+
<div type="canon">
162162
<head>Canon 3</head>
163163
<div type="canon">
164164
<head>Canon 4</head>
165165
</div>
166-
</div>
167-
<div type="register">
166+
</div>
167+
<div type="register">
168168
<head>Register 1</head>
169169
<div type="canon">
170170
<head>Canon 5</head>
171171
</div>
172-
</div>
173-
<div type="redundant">
172+
</div>
173+
<div type="redundant">
174174
<p>
175175
<s>This sentence contains
176176
<s>an illegally nested phrase</s>
177177
and should trigger a schematron squawk</s>
178178
</p>
179-
</div>
179+
</div>
180180
</div>
181181
<div type="test">
182182
<p>
183-
Testing multiple occurences of a datatype in a single
184-
attribute value. The following should be valid:
185-
<distinct type="valid" o01="0" o02="0" o0i="0" o11="0" o12="1" o1i="1" o22="1 2" o2i="1 2">minimum</distinct>
186-
<distinct type="valid" o01="1" o02="1" o0i="1" o11="1" o12="1 2" o1i="1 2" o22="1 2" o2i="1 2 3">min +1 unless ≤, in which case max</distinct>
187-
<distinct type="valid" o01="1" o02="1 2" o0i="1 2 3 4 5 6 7 8 9 0" o11="1" o12="1 2" o1i="1 2 3 4 5 6 7 8 9 0" o22="1 2" o2i="1 2 3 4 5 6 7 8 9 0">max</distinct>
188-
</p>
183+
Testing multiple occurences of a datatype in a single
184+
attribute value. The following should be valid:
185+
<distinct type="valid" o01="0" o02="0" o0i="0" o11="0" o12="1" o1i="1" o22="1 2" o2i="1 2">minimum</distinct>
186+
<distinct type="valid" o01="1" o02="1" o0i="1" o11="1" o12="1 2" o1i="1 2" o22="1 2" o2i="1 2 3">min +1 unless ≤, in which case max</distinct>
187+
<distinct type="valid" o01="1" o02="1 2" o0i="1 2 3 4 5 6 7 8 9 0" o11="1" o12="1 2" o1i="1 2 3 4 5 6 7 8 9 0" o22="1 2" o2i="1 2 3 4 5 6 7 8 9 0">max</distinct>
188+
</p>
189189
</div>
190190

191191
<div>
@@ -234,15 +234,15 @@
234234
<div>
235235
<head>Some transcribed text with subst errors</head>
236236
<p>... are all included. <del hand="#RG">It is</del>
237-
<subst><add>T</add></subst>the expressed</p>
237+
<subst><add>T</add></subst>the expressed</p>
238238
<p> that he and his Sister Miſs D —
239-
<lb/>who always lived with him, wd. be very
240-
<subst><lb/><add>principally</add></subst> remembered in her Will.</p>
239+
<lb/>who always lived with him, wd. be very
240+
<subst><lb/><add>principally</add></subst> remembered in her Will.</p>
241241
<p><subst>ἐπιτρέψῃ [ἐπετρέψῃ]</subst> τῷ ὑποδέκτῃ μὴ ὀχλῆσαι</p>
242242
<p>τ<subst><add place="above">ῶν</add></subst>α συνκυρόντων<subst><del>α</del></subst>
243-
ἐργαστηρί<hi rend="above">ων</hi><subst><del>α</del></subst></p>
243+
ἐργαστηρί<hi rend="above">ων</hi><subst><del>α</del></subst></p>
244244
<p>While <del xml:id="r112">pondering</del> thus <add xml:id="r113">she mus'd</add>,
245-
her pinions fann'd<substJoin target="#r112 #r113"/></p>
245+
her pinions fann'd<substJoin target="#r112 #r113"/></p>
246246
</div>
247247

248248
<div>
@@ -278,45 +278,45 @@
278278
</div>
279279

280280
<div xml:id="msDesc_unitary_parts">
281-
<head>test msDesc elements that should not be repeated</head>
282-
<p>Some manuscript description elements are supposed to occur
283-
a max of only once, even though RelaxNG allows infinite.</p>
284-
<p>Added 2023-10-11 19:21 by Syd.</p>
285-
<msDesc>
286-
<msIdentifier>
287-
<repository>MEL</repository> <!-- Middle Earth Library -->
288-
<collection>BB</collection> <!-- Bilbo Baggins -->
289-
<idno>mel:bb:ve:08</idno> <!-- I just made the "08" up -->
290-
<msName>riddle of Strider</msName>
291-
</msIdentifier>
292-
<msContents n="1"><ab>occurs only once, thus valid</ab></msContents>
293-
<physDesc n="1"><ab>occurs twice, thus invalid</ab></physDesc>
294-
<physDesc n="2"><ab>occurs twice, thus invalid</ab></physDesc>
295-
<history n="1"><ab>three occurrences, thus invalid</ab></history>
296-
<history n="2"><ab>three occurrences, thus invalid</ab></history>
297-
<history n="3"><ab>three occurrences, thus invalid</ab></history>
298-
<additional n="1"><surrogates>four occurrences, thus invalid</surrogates></additional>
299-
<additional n="2"><surrogates>four occurrences, thus invalid</surrogates></additional>
300-
<additional n="3"><surrogates>four occurrences, thus invalid</surrogates></additional>
301-
<additional n="4"><surrogates>four occurrences, thus invalid</surrogates></additional>
302-
</msDesc>
303-
<p>The above <gi>msDesc</gi> should generate 3 errors, one
304-
each for <gi>physDesc</gi>, <gi>history</gi>, and
305-
<gi>additional</gi>.</p>
306-
<lg>
307-
<lg>
308-
<l>All that is gold does not glitter,</l>
309-
<l>Not all those who wander are lost;</l>
310-
<l>The old that is strong does not wither,</l>
311-
<l>Deep roots are not reached by the frost.</l>
312-
</lg>
313-
<lg>
314-
<l>From the ashes a fire shall be woken,</l>
315-
<l>A light from the shadows shall spring;</l>
316-
<l>Renewed shall be blade that was broken,</l>
317-
<l>The crownless again shall be king.</l>
318-
</lg>
319-
</lg>
281+
<head>test msDesc elements that should not be repeated</head>
282+
<p>Some manuscript description elements are supposed to occur
283+
a max of only once, even though RelaxNG allows infinite.</p>
284+
<p>Added 2023-10-11 19:21 by Syd.</p>
285+
<msDesc>
286+
<msIdentifier>
287+
<repository>MEL</repository> <!-- Middle Earth Library -->
288+
<collection>BB</collection> <!-- Bilbo Baggins -->
289+
<idno>mel:bb:ve:08</idno> <!-- I just made the "08" up -->
290+
<msName>riddle of Strider</msName>
291+
</msIdentifier>
292+
<msContents n="1"><ab>occurs only once, thus valid</ab></msContents>
293+
<physDesc n="1"><ab>occurs twice, thus invalid</ab></physDesc>
294+
<physDesc n="2"><ab>occurs twice, thus invalid</ab></physDesc>
295+
<history n="1"><ab>three occurrences, thus invalid</ab></history>
296+
<history n="2"><ab>three occurrences, thus invalid</ab></history>
297+
<history n="3"><ab>three occurrences, thus invalid</ab></history>
298+
<additional n="1"><surrogates>four occurrences, thus invalid</surrogates></additional>
299+
<additional n="2"><surrogates>four occurrences, thus invalid</surrogates></additional>
300+
<additional n="3"><surrogates>four occurrences, thus invalid</surrogates></additional>
301+
<additional n="4"><surrogates>four occurrences, thus invalid</surrogates></additional>
302+
</msDesc>
303+
<p>The above <gi>msDesc</gi> should generate 3 errors, one
304+
each for <gi>physDesc</gi>, <gi>history</gi>, and
305+
<gi>additional</gi>.</p>
306+
<lg>
307+
<lg>
308+
<l>All that is gold does not glitter,</l>
309+
<l>Not all those who wander are lost;</l>
310+
<l>The old that is strong does not wither,</l>
311+
<l>Deep roots are not reached by the frost.</l>
312+
</lg>
313+
<lg>
314+
<l>From the ashes a fire shall be woken,</l>
315+
<l>A light from the shadows shall spring;</l>
316+
<l>Renewed shall be blade that was broken,</l>
317+
<l>The crownless again shall be king.</l>
318+
</lg>
319+
</lg>
320320
</div>
321321
<div>
322322
<head>Shift should have a new attribute</head>
@@ -401,14 +401,24 @@
401401
<p>Here is <floatingText><body><div><p>a little floating text</p></div></body></floatingText>.</p>
402402
<ab>Here is <floatingText><body><div><p>another little floating text</p></div></body></floatingText>.</ab>
403403
<lg>
404+
<epigraph>
405+
<quote>
406+
<p>This paragraph should be valid.
407+
The one around “find”, below, should be invalid.</p>
408+
</quote>
409+
</epigraph>
404410
<l>I think that I shall never see <note><ab>Sight of TEI elements is significant in this little poem.</ab></note></l>
405411
<l>A <floatingText><body><ab>floating text</ab></body></floatingText> inside this <figure><ab>tree</ab></figure>.</l>
406412
<l>Nor can it be <floatingText><body><p>that I shall know</p></body></floatingText></l>
407413
<l><figure><p>A paragraph</p></figure> <note><p>herein below</p></note>.</l>
408-
<l>More likely maybe I could find</l>
414+
<l>More likely maybe I could <quote><p>find</p></quote></l>
409415
<l><floatingText><body><div><p>A div</p></div></body></floatingText> stuck in this poem's lines.</l>
410416
</lg>
411417
<p>And here is the same poem again, inside a giant floatingText and coded a little differently.</p>
418+
<p>The “find”, below, <emph>should</emph> be flagged as an
419+
abstract model violation, IMHO, but is not because the
420+
Schematron is fooled by the fact that it is within a
421+
<gi>floatingText</gi>. Sigh. —Syd, 2024-05-18</p>
412422
<floatingText>
413423
<body>
414424
<lg>
@@ -417,7 +427,7 @@
417427
<l>A <floatingText><body><ab>floating text</ab></body></floatingText> inside this <figure><ab>tree</ab></figure>.</l>
418428
<l>Nor can it be that I shall know</l>
419429
<l><figure><p>A paragraph</p></figure> <note><p>herein below</p></note>.</l>
420-
<l>More likely maybe I could find</l>
430+
<l>More likely maybe I could <quote><p>find</p></quote></l>
421431
<l><floatingText><body><div><p>A div</p></div></body></floatingText> stuck in this poem's lines.</l>
422432
</lg>
423433
</body>
@@ -432,7 +442,7 @@
432442
<name type="file">detest.odd</name> because they would break
433443
the build there</desc>
434444
<elementSpec ident="silly_and_not_used" mode="add">
435-
<desc>See <code>//elementSpec[@ident eq 'abbr']/listRef</code> in <name type="file">detest.odd</name></desc>
445+
<desc>See <code>//elementSpec[@ident eq 'abbr']/listRef</code> in <name type="file">detest.odd</name></desc>
436446
<listRef>
437447
<ref type="invalid" n="1">no target (2B caught by Schematron)</ref>
438448
<ref type="valid" n="2" target="https://www.example.edu/tst">good target absolute URI</ref>

P5/Test/expected-results/detest_xml_relaxng.log

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ allowed:
7373
element http://www.tei-c.org/ns/1.0^listRef
7474
element http://www.tei-c.org/ns/1.0^relatedItem
7575
element http://www.tei-c.org/ns/1.0^citedRange
76-
detest.xml:441:12: error: attribute ^target with invalid value ""
76+
detest.xml:451:12: error: attribute ^target with invalid value ""
7777
required:
7878
data http://www.w3.org/2001/XMLSchema-datatypes^anyURI
7979
error: some documents are invalid

P5/Test/expected-results/detest_xml_schematron.log

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,4 @@ In the context of tagset documentation, the listRef element must not self-nest.
3838
In the context of tagset documentation, each ptr or ref element inside a listRef must have a target attribute with only 1 pointer as its value. (@target and not( matches( @target,'\s') ))
3939
In the context of tagset documentation, each ptr or ref element inside a listRef must have a target attribute with only 1 pointer as its value. (@target and not( matches( @target,'\s') ))
4040
The @new attribute should always be supplied; use the special value "normal" to indicate that the feature concerned ceases to be remarkable at this point. (@new / warning)
41+
Abstract model violation: Metrical lines may not contain higher-level structural elements such as div, p, or ab, unless p is a child of figure or note, or is a descendant of floatingText. (ancestor::tei:floatingText | parent::tei:figure | parent::tei:note)

0 commit comments

Comments
 (0)