Skip to content

Commit bd1570a

Browse files
committed
Add tests for new constraint, and
fix error they found.
1 parent e87b81f commit bd1570a

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

P5/Source/Specs/elementRef.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<constraintSpec ident="only_sensible_attrs" scheme="schematron">
1414
<constraint>
1515
<sch:pattern>
16-
<sch:rule context="tei:elementRef[ parent::schemaSpec | parent::specGrp ]">
16+
<sch:rule context="tei:elementRef[ parent::tei:schemaSpec | parent::tei:specGrp ]">
1717
<sch:report test="@minOccurs | @maxOccurs" role="error">An element reference is not repeatable when part of a schema specification (and thus this &lt;elementRef> should not have @minOccurs or @maxOccurs).</sch:report>
1818
</sch:rule>
1919
<sch:rule context="tei:content//tei:elementRef">

P5/Test/detest.odd

+23
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@
6060
<div>
6161
<head>A Test Schema</head>
6262
<p>Here is the introduction to your document</p>
63+
<specGrp xml:id="limit_attrs_on_elementRef">
64+
<elementRef key="p" minOccurs="2" maxOccurs="4">
65+
<!-- Should be flagged as an error: @m[ia][nx]Occurs not allowed here -->
66+
</elementRef>
67+
<elementRef key="charName" source="tei:3.5.0"/>
68+
</specGrp>
6369
<p>Here is the schema:</p>
6470
<schemaSpec ident="detest" start="TEI">
6571
<moduleRef key="header"/>
@@ -535,6 +541,23 @@
535541
</listRef>
536542
</elementSpec>
537543

544+
<specGrpRef target="#limit_attrs_on_elementRef"/>
545+
<elementSpec ident="test_elementRef_attr_constraints" mode="add">
546+
<desc xml:lang="en" versionDate="2024-05-02">yet another completely spurious element made up for testing purposes only</desc>
547+
<classes>
548+
<memberOf key="att.global"/>
549+
<memberOf key="model.pPart.data"/>
550+
</classes>
551+
<content>
552+
<alternate>
553+
<elementRef key="idno" source="tei:3.5.0">
554+
<!-- Should be flagged as an error: @source not allowed here -->
555+
</elementRef>
556+
<elementRef key="num" minOccurs="2" maxOccurs="5"/>
557+
</alternate>
558+
</content>
559+
</elementSpec>
560+
538561
</schemaSpec>
539562
</div>
540563
</body>

P5/Test/expected-results/detest_odd_schematron.log

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ validateodd:
2121
[xslt]
2222
[xslt] Error: both the versionDate and xml:lang attributes on "remarks" are required when it is a child of "elementSpec".
2323
[xslt] (@xml:lang and @versionDate)
24+
[xslt] An element reference is not repeatable when part of a schema specification (and thus this &lt;elementRef&gt; should not have @minOccurs or @maxOccurs). (@minOccurs | @maxOccurs / error)
25+
[xslt] An element reference within a content model must refer to a locally defined element specification (and thus this &lt;elementRef&gt; should not have @source). (@source / error)
2426
[xslt] In the context of tagset documentation, the listRef element must not self-nest. (tei:listRef)
2527
[xslt] 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') ))
2628
[xslt] 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') ))

0 commit comments

Comments
 (0)