Skip to content

Commit

Permalink
#2179, item 2:
Browse files Browse the repository at this point in the history
Insist that `<constraintSpec>` of "add" or "replace" do have a child `<constraint>`, and those of "delete" do not.
  • Loading branch information
sydb committed Oct 13, 2021
1 parent abe1a2a commit 02ed81c
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions P5/Source/Specs/constraintSpec.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,26 @@ $Id$
<classRef key="model.glossLike"/>
<classRef key="model.descLike"/>
</alternate>
<elementRef key="constraint" minOccurs="1" maxOccurs="1"/>
<elementRef key="constraint" minOccurs="0" maxOccurs="1"/>
</sequence>
</content>
</content>
<!--
Following <constraintSpec> might be more clearly accomplished
using abstract patterns, but our build process does not
currently support that. For an attempt at using them, see
https://github.com/TEIC/TEI/tree/sydb_issue-2179_1st_via_abstract_pats,
which was my first attempt at doing this. —Syd, 2021-10-13
-->
<constraintSpec scheme="schematron" ident="constraint-unless-delete">
<constraint>
<sch:rule context="tei:constraintSpec[ @mode eq 'delete' ]">
<sch:report test="child::tei:constraint">This 'constraintSpec' element has a mode= of "delete" even though it has a child constraint. Change the mode= to "add", "change", or "replace", or remove the 'constraint' child.</sch:report>
</sch:rule>
<sch:rule context="tei:constraintSpec[ @mode = ('add','replace') ]">
<sch:assert test="child::tei:constraint">This 'constraintSpec' element has a mode= of "<sch:value-of select="@mode"/>", but does not a 'constraint' child element. Specify a constraint or change the mode= to "delete".</sch:assert>
</sch:rule>
</constraint>
</constraintSpec>
<constraintSpec ident="sch_no_more" scheme="schematron">
<desc xml:lang="en" versionDate="2018-07-06">Relationship between scheme attribute and contents: Schematron 1.x</desc>
<constraint>
Expand Down

0 comments on commit 02ed81c

Please sign in to comment.