Skip to content

Commit 21ba627

Browse files
committed
take a crack at issuing warning when ISO Schematron assertion is made without a context
1 parent 2abbebc commit 21ba627

40 files changed

+562
-562
lines changed

Diff for: P5/Source/Guidelines/en/TD-DocumentationElements.xml

+41-35
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ $Id$
99
<?xml-model href="https://jenkins.tei-c.org/job/TEIP5-dev/lastSuccessfulBuild/artifact/P5/release/xml/tei/odd/p5.nvdl" type="application/xml" schematypens="http://purl.oclc.org/dsdl/nvdl/ns/structure/1.0"?>
1010
<div xmlns="http://www.tei-c.org/ns/1.0"
1111
type="div1" xml:id="TD" n="27"
12+
xmlns:sch="http://purl.oclc.org/dsdl/schematron"
1213
xmlns:rng="http://relaxng.org/ns/structure/1.0"
1314
xmlns:xi="http://www.w3.org/2001/XInclude" >
1415
<head>Documentation Elements</head>
@@ -840,22 +841,25 @@ to mark any technical term, thus:
840841
current version of the Guidelines, constraint specifications expressed as Schematron rules have been
841842
added, as follows:
842843
<egXML xmlns="http://www.tei-c.org/ns/Examples">
843-
<constraintSpec ident="reforkeyorname" scheme="schematron">
844+
<constraintSpec ident="ref-or-key-or-name" scheme="schematron">
844845
<constraint>
845-
<assert xmlns="http://purl.oclc.org/dsdl/schematron" test="@ref or @key or @name">One of the
846-
attributes 'name', 'ref' or 'key' must be supplied</assert>
846+
<sch:rule context="tei:relation">
847+
<sch:assert test="@ref or @key or @name">One of the attributes @name, @ref or @key must be supplied</sch:assert>
848+
</sch:rule>
847849
</constraint>
848850
</constraintSpec>
849-
<constraintSpec ident="activemutual" scheme="schematron">
851+
<constraintSpec ident="active-mutual" scheme="schematron">
850852
<constraint>
851-
<report xmlns="http://purl.oclc.org/dsdl/schematron" test="@active and @mutual">Only one of the
852-
attributes @active and @mutual may be supplied</report>
853+
<sch:rule context="tei:relation">
854+
<sch:report test="@active and @mutual">Only one of the attributes @active and @mutual may be supplied</sch:report>
855+
</sch:rule>
853856
</constraint>
854857
</constraintSpec>
855-
<constraintSpec ident="activepassive" scheme="schematron">
858+
<constraintSpec ident="active-passive" scheme="schematron">
856859
<constraint>
857-
<report xmlns="http://purl.oclc.org/dsdl/schematron" test="@passive and not(@active)">the
858-
attribute 'passive' may be supplied only if the attribute 'active' is supplied</report>
860+
<sch:rule context="tei:relation">
861+
<sch:report test="@passive and not(@active)">the attribute @passive may be supplied only if the attribute @active is supplied</sch:report>
862+
</sch:rule>
859863
</constraint>
860864
</constraintSpec>
861865
</egXML>
@@ -881,16 +885,16 @@ to mark any technical term, thus:
881885
<egXML xmlns="http://www.tei-c.org/ns/Examples">
882886
<constraintSpec ident="introtitle" scheme="schematron">
883887
<constraint>
884-
<assert xmlns="http://purl.oclc.org/dsdl/schematron"
885-
test="tei:fileDesc/tei:titleStmt/tei:title[@type='introductory']"> an introductory component
886-
of the title is expected </assert>
888+
<sch:rule context="tei:title">
889+
<sch:assert test="tei:fileDesc/tei:titleStmt/tei:title[@type='introductory']"> an introductory component of the title is expected</sch:assert>
890+
</sch:rule>
887891
</constraint>
888892
</constraintSpec>
889893
<constraintSpec ident="maintitle" scheme="schematron">
890894
<constraint>
891-
<assert xmlns="http://purl.oclc.org/dsdl/schematron"
892-
test="tei:fileDesc/tei:titleStmt/tei:title[@type='main']"> a main title must be supplied
893-
</assert>
895+
<sch:rule context="tei:title">
896+
<sch:assert test="tei:fileDesc/tei:titleStmt/tei:title[@type='main']"> a main title must be supplied</sch:assert>
897+
</sch:rule>
894898
</constraint>
895899
</constraintSpec>
896900
</egXML>
@@ -1019,32 +1023,32 @@ to mark any technical term, thus:
10191023
<dataFacet name="minInclusive" value="-360.0"/>
10201024
</dataRef></egXML>
10211025
Note that restrictions are either expressed with <att>restriction</att> or <gi>dataFacet</gi>, never both.</p>
1022-
<p>A datatype may be used to constrain the textual content of
1023-
an element, rather than the value of an attribute. But because
1024-
they are intended for use in defining ranges of attribute
1025-
values, datatypes may not contain elements or attributes.</p>
1026+
<p>A datatype may be used to constrain the textual content of
1027+
an element, rather than the value of an attribute. But because
1028+
they are intended for use in defining ranges of attribute
1029+
values, datatypes may not contain elements or attributes.</p>
10261030
<p>The attributes <att>minOccurs</att> and
10271031
<att>maxOccurs</att> are available for the case where an
10281032
attribute may take more than one value of the type
10291033
specified. For example, the <att>columns</att> attribute of
10301034
the <gi>layout</gi> element can have one or two non-negative
10311035
integers as its value:
10321036
<egXML xmlns="http://www.tei-c.org/ns/Examples">
1033-
<attDef ident="columns">
1034-
<gloss xml:lang="en" versionDate="2007-06-12">columns</gloss>
1035-
<desc versionDate="2005-01-14" xml:lang="en">specifies the number of columns per page</desc>
1036-
<datatype minOccurs="1" maxOccurs="2">
1037-
<dataRef key="teidata.count"/>
1038-
</datatype>
1039-
<remarks xml:lang="en" versionDate="2017-07-09">
1040-
<p>If a single number is given, all pages referenced
1041-
have this number of columns. If two numbers are given,
1042-
the number of columns per page varies between the
1043-
values supplied. Where <att>columns</att> is omitted
1044-
the number is assumed to be <val>1</val>.</p>
1045-
</remarks>
1046-
</attDef>
1047-
</egXML>
1037+
<attDef ident="columns">
1038+
<gloss xml:lang="en" versionDate="2007-06-12">columns</gloss>
1039+
<desc versionDate="2005-01-14" xml:lang="en">specifies the number of columns per page</desc>
1040+
<datatype minOccurs="1" maxOccurs="2">
1041+
<dataRef key="teidata.count"/>
1042+
</datatype>
1043+
<remarks xml:lang="en" versionDate="2017-07-09">
1044+
<p>If a single number is given, all pages referenced
1045+
have this number of columns. If two numbers are given,
1046+
the number of columns per page varies between the
1047+
values supplied. Where <att>columns</att> is omitted
1048+
the number is assumed to be <val>1</val>.</p>
1049+
</remarks>
1050+
</attDef>
1051+
</egXML>
10481052
indicating that the <att>target</att> attribute may take any number of values, each being of the
10491053
same datatype, namely the TEI data specification <ident>teidata.pointer</ident>. As is usual in XML,
10501054
multiple values for a single attribute are separated by one or more white space characters. Hence,
@@ -1075,7 +1079,9 @@ to mark any technical term, thus:
10751079
<datatype><dataRef key="teidata.count"/></datatype>
10761080
<constraintSpec ident="lessThan150" scheme="schematron">
10771081
<constraint>
1078-
<report xmlns="http://purl.oclc.org/dsdl/schematron" test=". >= 150"> age at death must be an integer less than 150 </report>
1082+
<sch:rule context="@ageAtDeath">
1083+
<sch:assert test=". le 150">age at death must be an integer less than 150</sch:assert>
1084+
</sch:rule>
10791085
</constraint>
10801086
</constraintSpec>
10811087
</attDef>

Diff for: P5/Source/Guidelines/en/USE.xml

+2
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,11 @@ that practice. -->
101101
scheme="schematron"
102102
ident="no_outputs_nor_predicates_4_my_kids">
103103
<constraint>
104+
<sch:rule context="tei:modelSequence">
104105
<sch:report test="tei:model[@output]" role="warning">The 'model' children
105106
of a 'modelSequence' element inherit the @output attribute of the
106107
parent 'modelSequence', and thus should not have their own</sch:report>
108+
</sch:rule>
107109
</constraint>
108110
</constraintSpec>
109111

Diff for: P5/Source/Specs/ab.xml

+6-4
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,11 @@
3535
</content>
3636
<constraintSpec ident="abstractModel-structure-ab-in-l-or-lg" scheme="schematron">
3737
<constraint>
38-
<sch:report test="(ancestor::tei:l or ancestor::tei:lg) and not( ancestor::tei:floatingText |parent::tei:figure |parent::tei:note )">
39-
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.
40-
</sch:report>
38+
<sch:rule context="tei:ab">
39+
<sch:report test="(ancestor::tei:l or ancestor::tei:lg) and not( ancestor::tei:floatingText |parent::tei:figure |parent::tei:note )">
40+
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.
41+
</sch:report>
42+
</sch:rule>
4143
</constraint>
4244
</constraintSpec>
4345
<exemplum xml:lang="en">
@@ -67,4 +69,4 @@
6769
<listRef>
6870
<ptr target="#SASE"/>
6971
</listRef>
70-
</elementSpec>
72+
</elementSpec>

Diff for: P5/Source/Specs/addSpan.xml

+11-11
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,13 @@ $Id$
1515
<gloss versionDate="2007-05-04" xml:lang="es">fragmento de texto añadido</gloss>
1616
<gloss versionDate="2007-01-21" xml:lang="it">porzione di testo aggiunta</gloss>
1717
<gloss versionDate="2018-12-28" xml:lang="ja">追加テキストの範囲</gloss>
18-
<desc versionDate="2005-01-14" xml:lang="en">marks the beginning of a longer sequence of text added by an
19-
author, scribe, annotator or corrector (see also <gi>add</gi>).</desc>
18+
<desc versionDate="2005-01-14" xml:lang="en">marks the beginning of a longer sequence of text added by an author, scribe, annotator or corrector (see also <gi>add</gi>).</desc>
2019
<desc versionDate="2007-12-20" xml:lang="ko">저자, 필기사, 주석자, 또는 교정자에 의해 추가된 긴 연쇄의 텍스트 시작부를 표시한다.(<gi>add</gi> 참조)</desc>
2120
<desc versionDate="2007-05-02" xml:lang="zh-TW">標記由作者、抄寫者、註解者或更正者所加入的較長連續文字之開端 (參照<gi>add</gi>) 。</desc>
22-
<desc versionDate="2008-04-05" xml:lang="ja">著者、筆写者、注釈者、校正者の手による長めの追加テキストを挿入する始
23-
点を示す(<gi>add</gi>も参照のこと)。</desc>
24-
<desc versionDate="2009-11-16" xml:lang="fr">marque le début d'une longue partie de texte ajoutée par un auteur, un copiste, un annotateur ou
25-
un correcteur (voir aussi <gi>add</gi>).</desc>
21+
<desc versionDate="2008-04-05" xml:lang="ja">著者、筆写者、注釈者、校正者の手による長めの追加テキストを挿入する始 点を示す(<gi>add</gi>も参照のこと)。</desc>
22+
<desc versionDate="2009-11-16" xml:lang="fr">marque le début d'une longue partie de texte ajoutée par un auteur, un copiste, un annotateur ou un correcteur (voir aussi <gi>add</gi>).</desc>
2623
<desc versionDate="2007-05-04" xml:lang="es">señala el inicio de un fragmento largo de texto añadido por un autor, un transcriptor, un comentarista o un corrector (ver también <gi>add</gi>).</desc>
27-
<desc versionDate="2007-01-21" xml:lang="it">segnala l'inizio di una porzione di testo più lunga aggiunta
28-
da un autore, un trascrittore, un annotatore o un correttore (vedi anche <gi>add</gi>)</desc>
24+
<desc versionDate="2007-01-21" xml:lang="it">segnala l'inizio di una porzione di testo più lunga aggiunta da un autore, un trascrittore, un annotatore o un correttore (vedi anche <gi>add</gi>)</desc>
2925
<classes>
3026
<memberOf key="att.global"/>
3127
<memberOf key="model.global.edit"/>
@@ -38,12 +34,16 @@ $Id$
3834
<content><empty/></content>
3935
<constraintSpec ident="addSpan-requires-spanTo" scheme="schematron">
4036
<constraint>
41-
<sch:assert test="@spanTo">The @spanTo attribute of <sch:name/> is required.</sch:assert>
37+
<sch:rule context="tei:addSpan">
38+
<sch:assert test="@spanTo">The @spanTo attribute of <sch:name/> is required.</sch:assert>
39+
</sch:rule>
4240
</constraint>
4341
</constraintSpec>
4442
<constraintSpec ident="addSpan-requires-spanTo-fr" scheme="schematron" xml:lang="fr">
4543
<constraint>
46-
<sch:assert test="@spanTo">L'attribut spanTo est requis.</sch:assert>
44+
<sch:rule context="tei:addSpan">
45+
<sch:assert test="@spanTo">L'attribut spanTo est requis.</sch:assert>
46+
</sch:rule>
4747
</constraint>
4848
</constraintSpec>
4949
<exemplum xml:lang="en">
@@ -94,4 +94,4 @@ $Id$
9494
<listRef>
9595
<ptr target="#PHAD"/>
9696
</listRef>
97-
</elementSpec>
97+
</elementSpec>

Diff for: P5/Source/Specs/alternate.xml

+6-4
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,16 @@ $Id$
2323
</content>
2424
<constraintSpec ident="alternatechilden" scheme="schematron">
2525
<constraint>
26-
<sch:assert test="count(*)&gt;1">The alternate element must have at least two child elements</sch:assert>
26+
<sch:rule context="tei:alternate">
27+
<sch:assert test="count(*) gt 1">The alternate element must have at least two child elements</sch:assert>
28+
</sch:rule>
2729
</constraint>
2830
</constraintSpec>
2931
<exemplum xml:lang="en">
3032
<egXML xmlns="http://www.tei-c.org/ns/Examples" xml:lang="en" source="#UND"><content>
3133
<alternate>
32-
<elementRef key="name"/>
33-
<elementRef key="persName"/>
34+
<elementRef key="name"/>
35+
<elementRef key="persName"/>
3436
</alternate>
3537
</content>
3638
</egXML>
@@ -40,4 +42,4 @@ $Id$
4042
<listRef>
4143
<ptr target="#DEFCON" type="div2"/>
4244
</listRef>
43-
</elementSpec>
45+
</elementSpec>

Diff for: P5/Source/Specs/att.repeatable.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ $Id$
2020
<att>maxOccurs</att> is 1, when <att>maxOccurs</att> is not specified
2121
<att>minOccurs</att> must always be less than or equal to 1.</desc> -->
2222
<constraint>
23-
<sch:rule context="*[ @minOccurs and @maxOccurs ]">
23+
<sch:rule context="tei:*[ @minOccurs and @maxOccurs ]">
2424
<sch:let name="min" value="@minOccurs cast as xs:integer"/>
2525
<sch:let name="max" value="if ( normalize-space( @maxOccurs ) eq 'unbounded') then -1 else @maxOccurs cast as xs:integer"/>
2626
<sch:assert test="$max eq -1 or $max ge $min">@maxOccurs should be greater than or equal to @minOccurs</sch:assert>
2727
</sch:rule>
28-
<sch:rule context="*[ @minOccurs and not( @maxOccurs ) ]">
28+
<sch:rule context="tei:*[ @minOccurs and not( @maxOccurs ) ]">
2929
<sch:assert test="@minOccurs cast as xs:integer lt 2">When @maxOccurs is not specified, @minOccurs must be 0 or 1</sch:assert>
3030
</sch:rule>
3131
</constraint>

0 commit comments

Comments
 (0)