Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove @scheme requirement when <constraintSpec> is mode=change or delete #2453

Merged
merged 5 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions P5/Source/Specs/TEI.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ $Id$
<sch:ns prefix="rna" uri="http://relaxng.org/ns/compatibility/annotations/1.0"/>
</constraint>
</constraintSpec>
<constraintSpec ident="c3" scheme="schematron">
<constraint>
<sch:ns prefix="sch" uri="http://purl.oclc.org/dsdl/schematron"/>
<sch:ns prefix="sch1x" uri="http://www.ascc.net/xml/schematron"/>
</constraint>
</constraintSpec>
<attList>
<attDef ident="version" usage="opt">
<desc versionDate="2018-01-24" xml:lang="en">specifies the version number of the TEI Guidelines against
Expand Down
36 changes: 27 additions & 9 deletions P5/Source/Specs/constraintSpec.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ $Id$
<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>
<sch:ns prefix="s" uri="http://www.ascc.net/xml/schematron"/>
<sch:report test="tei:constraint/s:* and @scheme = ('isoschematron','schematron')">Rules
<sch:report test="tei:constraint/sch1x:* and @scheme = ('isoschematron','schematron')">Rules
in the Schematron 1.* language must be inside a constraintSpec
with a value other than 'schematron' or 'isoschematron' on the
scheme attribute</sch:report>
Expand All @@ -58,15 +57,15 @@ $Id$
<constraintSpec ident="isosch" scheme="schematron">
<desc xml:lang="en" versionDate="2018-07-06">Relationship between scheme attribute and contents: ISO Schematron</desc>
<constraint>
<sch:ns prefix="sch" uri="http://purl.oclc.org/dsdl/schematron"/>
<sch:report test="tei:constraint/sch:* and not( @scheme eq 'schematron')">Rules
in the ISO Schematron language must be inside a constraintSpec
with the value 'schematron' on the scheme attribute</sch:report>
<sch:rule context="tei:constraintSpec[ @mode = ('add','replace') or not( @mode ) ]">
<sch:report test="tei:constraint/sch:* and not( @scheme eq 'schematron')">Rules
in the ISO Schematron language must be inside a constraintSpec
with the value 'schematron' on the scheme attribute</sch:report>
</sch:rule>
</constraint>
</constraintSpec>
<constraintSpec ident="needrules" scheme="schematron">
<constraint>
<sch:ns prefix="sch" uri="http://purl.oclc.org/dsdl/schematron"/>
<sch:rule context="tei:macroSpec/tei:constraintSpec[@scheme eq 'schematron']/tei:constraint">
<sch:report test="sch:assert|sch:report">An ISO Schematron constraint specification for a macro should not
have an 'assert' or 'report' element without a parent 'rule' element</sch:report>
Expand All @@ -84,21 +83,40 @@ $Id$
</constraint>
</constraintSpec>
<attList>
<attDef ident="scheme" usage="req">
<attDef ident="scheme" usage="opt">
<!-- Note:
Per "usage_based_on_mode", below,
* usage=req iff mode=add or mode=replace
* usage=not allowed iff mode=change or mode=delete
-->
<desc versionDate="2009-06-10" xml:lang="en">supplies the name of the language in which the constraints
are defined</desc>
<datatype><dataRef key="teidata.enumerated"/></datatype>
<constraintSpec scheme="schematron" ident="usage_based_on_mode">
<constraint>
<sch:rule context="tei:constraintSpec[ @mode = ('add','replace') or not( @mode ) ]">
<sch:assert test="@scheme">The @scheme attribute of &lt;constraintSpec> is required when the @mode is <sch:value-of select="if (@mode) then concat('&quot;',@mode,'&quot;') else 'not specified'"/>.</sch:assert>
</sch:rule>
</constraint>
</constraintSpec>
<valList type="semi">
<valItem ident="schematron">
<gloss versionDate="2016-09-27" xml:lang="en">ISO Schematron</gloss>
</valItem>
</valList>
<remarks versionDate="2021-09-27" xml:lang="en">
<remarks versionDate="2023-08-06" xml:lang="en">
<p>These Guidelines no longer recommend, and the current TEI
stylesheets no longer support, the use of Schematron 1.x
within <gi>constraintSpec</gi>. Thus the value
<val>schematron</val> is used to indicate that ISO Schematron
is used within the <gi>constraintSpec</gi>.</p>
<p>The <att>scheme</att> attribute is required when the value
of <att>mode</att> is <val>add</val> or
<val>replace</val>. The <att>scheme</att> attribute is
permitted when the value of <att>mode</att> is
<val>delete</val>, but these Guidelines make no reccomendation
for what a processor should do if its value does not match
that of the <gi>constraintSpec</gi> being deleted.</p>
</remarks>
</attDef>
<attDef ident="type" mode="replace">
Expand Down
19 changes: 19 additions & 0 deletions P5/Test/detest.odd
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
</sourceDesc>
</fileDesc>
<revisionDesc>
<change when="2023-08-06" who="#sbauman.emt">
Add the <name>add_missing_scheme</name> and
<name>replace_missing_scheme</name> tests for
<gi>constraintSpec</gi>.
</change>
<change when="2022-04-04" who="#sbauman.emt">
<list>
<item>Tweaked some comments and wording of content</item>
Expand Down Expand Up @@ -437,6 +442,20 @@
<content>
<rng:ref name="macro.phraseSeq"/>
</content>
<constraintSpec ident="add_missing_scheme">
<desc>This <gi>constraintSpec</gi> is invalid because it is
missing <att>scheme</att> in <val>add</val> mode.</desc>
<constraint>
<sch:report test="false()">This rule never fires.</sch:report>
</constraint>
</constraintSpec>
<constraintSpec ident="replace_missing_scheme" mode="replace">
<desc>This <gi>constraintSpec</gi> is invalid because it is
missing <att>scheme</att> in <val>replace</val> mode.</desc>
<constraint>
<sch:report test="false()">This rule never fires.</sch:report>
</constraint>
</constraintSpec>
<!--
* The following <constraintSpec>s have an @ident that
* is of the form
Expand Down
20 changes: 14 additions & 6 deletions P5/Test/expected-results/detest_odd_schematron.log
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Buildfile: /TEI/P5/Test/antruntest.xml
Buildfile: /Users/syd/Documents/TEI_gitHub/P5/Test/antruntest.xml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I presume that the expected results here should not be user specific -- should these all be /TEI/ ?


validateodd:
[echo] Validate detest.odd as ODD ...
[echo] ... against RelaxNG (../p5odds.rng) with jing ...
[echo] ... against Schematron (../p5odds.message.isosch.xsl) with Saaxon via trax
[xslt] Processing /TEI/P5/Test/detest.odd to /dev/null
[xslt] Loading stylesheet /TEI/P5/p5odds.message.isosch.xsl
[xslt] Processing /Users/syd/Documents/TEI_gitHub/P5/Test/detest.odd to /dev/null
[xslt] Loading stylesheet /Users/syd/Documents/TEI_gitHub/P5/p5odds.message.isosch.xsl
[xslt]
[xslt] Error: both the versionDate and xml:lang attributes on "remarks" are required when it is a child of "elementSpec".
[xslt] (@xml:lang and @versionDate)
Expand All @@ -25,8 +25,16 @@ validateodd:
[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') ))
[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') ))
[xslt] Rules
[xslt] in the ISO Schematron language must be inside a constraintSpec
[xslt] with the value 'schematron' on the scheme attribute (tei:constraint/sch:* and not( @scheme eq 'schematron'))
[xslt] in the ISO Schematron language must be inside a constraintSpec
[xslt] with the value 'schematron' on the scheme attribute (tei:constraint/sch:* and not( @scheme eq 'schematron'))
[xslt] Rules
[xslt] in the ISO Schematron language must be inside a constraintSpec
[xslt] with the value 'schematron' on the scheme attribute (tei:constraint/sch:* and not( @scheme eq 'schematron'))
[xslt] Rules
[xslt] in the ISO Schematron language must be inside a constraintSpec
[xslt] with the value 'schematron' on the scheme attribute (tei:constraint/sch:* and not( @scheme eq 'schematron'))
[xslt] The @scheme attribute of &lt;constraintSpec&gt; is required when the @mode is not specified. (@scheme)
[xslt] The @scheme attribute of &lt;constraintSpec&gt; is required when the @mode is "replace". (@scheme)
[xslt] Since the @default-is-in-list-req attribute is required, it will always be specified. Thus the default value (of "ONE") will never be used. Either change the definition of the attribute so it is not required ("rec" or "opt"), or remove the defaultVal element. (tei:defaultVal)
[xslt] Since the @default-NOT-in-list-req attribute is required, it will always be specified. Thus the default value (of "ONE") will never be used. Either change the definition of the attribute so it is not required ("rec" or "opt"), or remove the defaultVal element. (tei:defaultVal)
[xslt] In the elementSpec defining
Expand All @@ -43,4 +51,4 @@ validateodd:
[xslt] values (string(tei:defaultVal) = tei:valList/tei:valItem/@ident)

BUILD SUCCESSFUL
Total time: 2 seconds
Total time: 3 seconds