Skip to content

Commit

Permalink
Update P5subset and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
trishaoconnor committed Oct 17, 2023
1 parent 611befa commit f1aa9a3
Show file tree
Hide file tree
Showing 14 changed files with 915 additions and 721 deletions.
82 changes: 47 additions & 35 deletions Test/expected-results/test.isosch
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,26 @@
<report test="@notAfter" role="nonfatal">The @to and @notAfter attributes cannot be used together.</report>
</rule>
</pattern>
<pattern id="schematron-constraint-test-att.datable-calendar-calendar-4">
<pattern id="schematron-constraint-test-att.datable-calendar-calendar-check-deprecated-4">
<rule context="tei:*[@calendar]">
<assert test="string-length( normalize-space(.) ) gt 0"> @calendar indicates one or more
systems or calendars to which the date represented by the content of this element belongs,
but this <name/> element has no textual content.</assert>
</rule>
</pattern>
<pattern id="schematron-constraint-test-att.global.source-source-only_1_ODD_source-5">
<pattern id="schematron-constraint-test-att.datable-calendar-calendar-deprecated-5">
<rule context="tei:*[@calendar][ not( self::tei:date | self::tei:time | self::tei:origDate ) ]">
<let name="me_phrase"
value="concat( 'Attribute calendar on ', local-name(.))"/>
<assert test="'2024-11-11' cast as xs:date ge current-date()">
<value-of select="concat( $me_phrase, ' construct is outdated (as of 2024-11-11); ODD processors may ignore it, and its use is no longer supported' )"/>
</assert>
<report role="nonfatal" test="@calendar">
<value-of select="concat( $me_phrase, ' becomes outdated on 2024-11-11' )"/>
</report>
</rule>
</pattern>
<pattern id="schematron-constraint-test-att.global.source-source-only_1_ODD_source-6">
<rule context="tei:*[@source]">
<let name="srcs" value="tokenize( normalize-space(@source),' ')"/>
<report test="( self::tei:classRef | self::tei:dataRef | self::tei:elementRef | self::tei:macroRef | self::tei:moduleRef | self::tei:schemaSpec ) and $srcs[2]">
Expand All @@ -47,50 +59,50 @@
</report>
</rule>
</pattern>
<pattern id="schematron-constraint-test-att.measurement-att-measurement-unitRef-6">
<pattern id="schematron-constraint-test-att.measurement-att-measurement-unitRef-7">
<rule context="tei:*[@unitRef]">
<report test="@unit" role="info">The @unit attribute may be unnecessary when @unitRef is present.</report>
</rule>
</pattern>
<pattern id="schematron-constraint-test-att.typed-subtypeTyped-7">
<pattern id="schematron-constraint-test-att.typed-subtypeTyped-8">
<rule context="tei:*[@subtype]">
<assert test="@type">The <name/> element should not be categorized in detail with @subtype unless also categorized in general with @type</assert>
</rule>
</pattern>
<pattern id="schematron-constraint-test-att.pointing-targetLang-targetLang-8">
<pattern id="schematron-constraint-test-att.pointing-targetLang-targetLang-9">
<rule context="tei:*[not(self::tei:schemaSpec)][@targetLang]">
<assert test="@target">@targetLang should only be used on <name/> if @target is specified.</assert>
</rule>
</pattern>
<pattern id="schematron-constraint-test-att.spanning-spanTo-spanTo-points-to-following-9">
<pattern id="schematron-constraint-test-att.spanning-spanTo-spanTo-points-to-following-10">
<rule context="tei:*[@spanTo]">
<assert test="id(substring(@spanTo,2)) and following::*[@xml:id=substring(current()/@spanTo,2)]">
The element indicated by @spanTo (<value-of select="@spanTo"/>) must follow the current element <name/>
</assert>
</rule>
</pattern>
<pattern id="schematron-constraint-test-att.styleDef-schemeVersion-schemeVersionRequiresScheme-10">
<pattern id="schematron-constraint-test-att.styleDef-schemeVersion-schemeVersionRequiresScheme-11">
<rule context="tei:*[@schemeVersion]">
<assert test="@scheme and not(@scheme = 'free')">
@schemeVersion can only be used if @scheme is specified.
</assert>
</rule>
</pattern>
<pattern id="schematron-constraint-test-p-abstractModel-structure-p-in-ab-or-p-11">
<pattern id="schematron-constraint-test-p-abstractModel-structure-p-in-ab-or-p-12">
<rule context="tei:p">
<report test="(ancestor::tei:ab or ancestor::tei:p) and not( ancestor::tei:floatingText |parent::tei:exemplum |parent::tei:item |parent::tei:note |parent::tei:q |parent::tei:quote |parent::tei:remarks |parent::tei:said |parent::tei:sp |parent::tei:stage |parent::tei:cell |parent::tei:figure )">
Abstract model violation: Paragraphs may not occur inside other paragraphs or ab elements.
</report>
</rule>
</pattern>
<pattern id="schematron-constraint-test-p-abstractModel-structure-p-in-l-or-lg-12">
<pattern id="schematron-constraint-test-p-abstractModel-structure-p-in-l-or-lg-13">
<rule context="tei:p">
<report test="(ancestor::tei:l or ancestor::tei:lg) and not( ancestor::tei:floatingText |parent::tei:figure |parent::tei:note )">
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.
</report>
</rule>
</pattern>
<pattern id="schematron-constraint-test-desc-deprecationInfo-only-in-deprecated-13">
<pattern id="schematron-constraint-test-desc-deprecationInfo-only-in-deprecated-14">
<rule context="tei:desc[ @type eq 'deprecationInfo']">
<assert test="../@validUntil">Information about a
deprecation should only be present in a specification element
Expand All @@ -99,43 +111,43 @@ The element indicated by @spanTo (<value-of select="@spanTo"/>) must follow the
type="deprecationInfo"&gt;.</assert>
</rule>
</pattern>
<pattern id="schematron-constraint-test-rt-target-rt-target-not-span-14">
<pattern id="schematron-constraint-test-rt-target-rt-target-not-span-15">
<rule context="tei:rt/@target">
<report test="../@from | ../@to">When target= is
present, neither from= nor to= should be.</report>
</rule>
</pattern>
<pattern id="schematron-constraint-test-rt-from-rt-from-15">
<pattern id="schematron-constraint-test-rt-from-rt-from-16">
<rule context="tei:rt/@from">
<assert test="../@to">When from= is present, the to=
attribute of <name/> is required.</assert>
</rule>
</pattern>
<pattern id="schematron-constraint-test-rt-to-rt-to-16">
<pattern id="schematron-constraint-test-rt-to-rt-to-17">
<rule context="tei:rt/@to">
<assert test="../@from">When to= is present, the from=
attribute of <name/> is required.</assert>
</rule>
</pattern>
<pattern id="schematron-constraint-test-ptr-ptrAtts-17">
<pattern id="schematron-constraint-test-ptr-ptrAtts-18">
<rule context="tei:ptr">
<report test="@target and @cRef">Only one of the
attributes @target and @cRef may be supplied on <name/>.</report>
</rule>
</pattern>
<pattern id="schematron-constraint-test-ref-refAtts-18">
<pattern id="schematron-constraint-test-ref-refAtts-19">
<rule context="tei:ref">
<report test="@target and @cRef">Only one of the
attributes @target' and @cRef' may be supplied on <name/>
</report>
</rule>
</pattern>
<pattern id="schematron-constraint-test-list-gloss-list-must-have-labels-19">
<pattern id="schematron-constraint-test-list-gloss-list-must-have-labels-20">
<rule context="tei:list[@type='gloss']">
<assert test="tei:label">The content of a "gloss" list should include a sequence of one or more pairs of a label element followed by an item element</assert>
</rule>
</pattern>
<pattern id="schematron-constraint-test-relatedItem-targetorcontent1-20">
<pattern id="schematron-constraint-test-relatedItem-targetorcontent1-21">
<rule context="tei:relatedItem">
<report test="@target and count( child::* ) &gt; 0">
If the @target attribute on <name/> is used, the
Expand All @@ -144,51 +156,51 @@ relatedItem element must be empty</report>
or a child element to indicate the related bibliographic item</assert>
</rule>
</pattern>
<pattern id="schematron-constraint-test-l-abstractModel-structure-l-in-l-21">
<pattern id="schematron-constraint-test-l-abstractModel-structure-l-in-l-22">
<rule context="tei:l">
<report test="ancestor::tei:l[not(.//tei:note//tei:l[. = current()])]">
Abstract model violation: Lines may not contain lines or lg elements.
</report>
</rule>
</pattern>
<pattern id="schematron-constraint-test-lg-atleast1oflggapl-22">
<pattern id="schematron-constraint-test-lg-atleast1oflggapl-23">
<rule context="tei:lg">
<assert test="count(descendant::tei:lg|descendant::tei:l|descendant::tei:gap) &gt; 0">An lg element
must contain at least one child l, lg, or gap element.</assert>
</rule>
</pattern>
<pattern id="schematron-constraint-test-lg-abstractModel-structure-lg-in-l-23">
<pattern id="schematron-constraint-test-lg-abstractModel-structure-lg-in-l-24">
<rule context="tei:lg">
<report test="ancestor::tei:l[not(.//tei:note//tei:lg[. = current()])]">
Abstract model violation: Lines may not contain line groups.
</report>
</rule>
</pattern>
<pattern id="schematron-constraint-test-quotation-quotationContents-24">
<pattern id="schematron-constraint-test-quotation-quotationContents-25">
<rule context="tei:quotation">
<report test="not(@marks) and not (tei:p)">
On <name/>, either the @marks attribute should be used, or a paragraph of description provided</report>
</rule>
</pattern>
<pattern id="schematron-constraint-test-citeStructure-match-citestructure-outer-match-25">
<pattern id="schematron-constraint-test-citeStructure-match-citestructure-outer-match-26">
<rule context="tei:citeStructure[not(parent::tei:citeStructure)]">
<assert test="starts-with(@match,'/')">An XPath in @match on the outer <name/> must start with '/'.</assert>
</rule>
</pattern>
<pattern id="schematron-constraint-test-citeStructure-match-citestructure-inner-match-26">
<pattern id="schematron-constraint-test-citeStructure-match-citestructure-inner-match-27">
<rule context="tei:citeStructure[parent::tei:citeStructure]">
<assert test="not(starts-with(@match,'/'))">An XPath in @match must not start with '/' except on the outer <name/>.</assert>
</rule>
</pattern>
<pattern id="schematron-constraint-test-facsimile-no_facsimile_text_nodes-27">
<pattern id="schematron-constraint-test-facsimile-no_facsimile_text_nodes-28">
<rule context="tei:facsimile//tei:line | tei:facsimile//tei:zone">
<report test="child::text()[ normalize-space(.) ne '']">
A facsimile element represents a text with images, thus
transcribed text should not be present within it.
</report>
</rule>
</pattern>
<pattern id="schematron-constraint-test-path-pathmustnotbeclosed-28">
<pattern id="schematron-constraint-test-path-pathmustnotbeclosed-29">
<rule context="tei:path[@points]">
<let name="firstPair" value="tokenize( normalize-space( @points ), ' ')[1]"/>
<let name="lastPair"
Expand All @@ -202,62 +214,62 @@ On <name/>, either the @marks attribute should be used, or a paragraph of descri
the zone element rather than the path element. </report>
</rule>
</pattern>
<pattern id="schematron-constraint-test-addSpan-addSpan-requires-spanTo-29">
<pattern id="schematron-constraint-test-addSpan-addSpan-requires-spanTo-30">
<rule context="tei:addSpan">
<assert test="@spanTo">The @spanTo attribute of <name/> is required.</assert>
</rule>
</pattern>
<pattern id="schematron-constraint-test-damageSpan-damageSpan-requires-spanTo-31">
<pattern id="schematron-constraint-test-damageSpan-damageSpan-requires-spanTo-32">
<rule context="tei:damageSpan">
<assert test="@spanTo">The @spanTo attribute of <name/> is required.</assert>
</rule>
</pattern>
<pattern id="schematron-constraint-test-delSpan-delSpan-requires-spanTo-33">
<pattern id="schematron-constraint-test-delSpan-delSpan-requires-spanTo-34">
<rule context="tei:delSpan">
<assert test="@spanTo">The @spanTo attribute of <name/> is required.</assert>
</rule>
</pattern>
<pattern id="schematron-constraint-test-subst-substContents1-35">
<pattern id="schematron-constraint-test-subst-substContents1-36">
<rule context="tei:subst">
<assert test="child::tei:add and (child::tei:del or child::tei:surplus)">
<name/> must have at least one child add and at least one child del or surplus</assert>
</rule>
</pattern>
<pattern id="schematron-constraint-test-div-abstractModel-structure-div-in-l-or-lg-38">
<pattern id="schematron-constraint-test-div-abstractModel-structure-div-in-l-or-lg-39">
<rule context="tei:div">
<report test="(ancestor::tei:l or ancestor::tei:lg) and not(ancestor::tei:floatingText)">
Abstract model violation: Lines may not contain higher-level structural elements such as div, unless div is a descendant of floatingText.
</report>
</rule>
</pattern>
<pattern id="schematron-constraint-test-div-abstractModel-structure-div-in-ab-or-p-39">
<pattern id="schematron-constraint-test-div-abstractModel-structure-div-in-ab-or-p-40">
<rule context="tei:div">
<report test="(ancestor::tei:p or ancestor::tei:ab) and not(ancestor::tei:floatingText)">
Abstract model violation: p and ab may not contain higher-level structural elements such as div, unless div is a descendant of floatingText.
</report>
</rule>
</pattern>
<pattern id="schematron-constraint-test-link-linkTargets3-40">
<pattern id="schematron-constraint-test-link-linkTargets3-41">
<rule context="tei:link">
<assert test="contains(normalize-space(@target),' ')">You must supply at least two values for @target or on <name/>
</assert>
</rule>
</pattern>
<pattern id="schematron-constraint-test-ab-abstractModel-structure-ab-in-l-or-lg-41">
<pattern id="schematron-constraint-test-ab-abstractModel-structure-ab-in-l-or-lg-42">
<rule context="tei:ab">
<report test="(ancestor::tei:l or ancestor::tei:lg) and not( ancestor::tei:floatingText |parent::tei:figure |parent::tei:note )">
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.
</report>
</rule>
</pattern>
<pattern id="schematron-constraint-test-join-joinTargets3-42">
<pattern id="schematron-constraint-test-join-joinTargets3-43">
<rule context="tei:join">
<assert test="contains(@target,' ')">
You must supply at least two values for @target on <name/>
</assert>
</rule>
</pattern>
<pattern id="schematron-constraint-test-standOff-nested_standOff_should_be_typed-43">
<pattern id="schematron-constraint-test-standOff-nested_standOff_should_be_typed-44">
<rule context="tei:standOff">
<assert test="@type or not(ancestor::tei:standOff)">This
<name/> element must have a @type attribute, since it is
Expand Down
Loading

0 comments on commit f1aa9a3

Please sign in to comment.