Skip to content

Commit

Permalink
Make ODD file valid; add rule+context around two Schematron asserts.
Browse files Browse the repository at this point in the history
  • Loading branch information
martindholmes committed Jan 29, 2025
1 parent ae41e98 commit f5a0101
Showing 1 changed file with 23 additions and 17 deletions.
40 changes: 23 additions & 17 deletions Test2/inputFiles/testNonTeiOdd1.odd
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?>
<schemaSpec ident="nonTeiOdd" start="div" ns="http://www.w3.org/1999/xhtml">

<moduleSpec ident="NTO_heads">
<ident type="FPI">Non TEI ODD Test, headings</ident>
<idno type="FPI">Non TEI ODD Test, headings</idno>
<desc>This module holds the heading elements of various levels</desc>
</moduleSpec>

<moduleSpec ident="NTO_lists">
<ident type="FPI">Non TEI ODD Test, lists</ident>
<idno type="FPI">Non TEI ODD Test, lists</idno>
<desc>This module holds the elements for lists</desc>
</moduleSpec>

Expand Down Expand Up @@ -65,15 +65,17 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?>
</content>
<constraintSpec ident="headingLevelMustMatchNesting" scheme="schematron">
<constraint>
<sch:assert test="if (child::xh:h3) then count(ancestor::xh:div) = 0
else if (child::xh:h4) then count(ancestor::xh:div) = 1
else if (child::xh:h5) then count(ancestor::xh:div) = 2
else not(child::xh:h3 or child::xh:h4 or child::xh:h5)">
The level of your heading (h3, h4 or h5) must fit
with the depth of your division nesting; so the
top-level div would have h3, a div inside it would
have h4, and a div inside that would have h5.
</sch:assert>
<sch:rule context="xh:div">
<sch:assert test="if (child::xh:h3) then count(ancestor::xh:div) = 0
else if (child::xh:h4) then count(ancestor::xh:div) = 1
else if (child::xh:h5) then count(ancestor::xh:div) = 2
else not(child::xh:h3 or child::xh:h4 or child::xh:h5)">
The level of your heading (h3, h4 or h5) must fit
with the depth of your division nesting; so the
top-level div would have h3, a div inside it would
have h4, and a div inside that would have h5.
</sch:assert>
</sch:rule>
</constraint>
</constraintSpec>
</elementSpec>
Expand Down Expand Up @@ -229,10 +231,12 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?>
<memberOf key="att.identifiable"/>
</classes>
<constraintSpec ident="imgWithoutCaptionNeedsAltAndTitle" scheme="schematron">
<constraint>
<sch:assert test="(@alt and @title) or following-sibling::xh:figcaption or ancestor::xh:ul[@class='gallery']"> If your img element is not inside a figure element with a figcaption,
then it requires @alt and @title attributes to provide help for
visually-impaired users. </sch:assert>
<constraint>
<sch:rule context="xh:img">
<sch:assert test="(@alt and @title) or following-sibling::xh:figcaption or ancestor::xh:ul[@class='gallery']"> If your img element is not inside a figure element with a figcaption,
then it requires @alt and @title attributes to provide help for
visually-impaired users. </sch:assert>
</sch:rule>
</constraint>
</constraintSpec>
<attList>
Expand Down Expand Up @@ -421,8 +425,10 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?>
<memberOf key="model.divBody"/>
</classes>
<content>
<elementRef key="caption" minOccurs="0" maxOccurs="1"/>
<elementRef key="tr" minOccurs="1" maxOccurs="unbounded"/>
<sequence>
<elementRef key="caption" minOccurs="0" maxOccurs="1"/>
<elementRef key="tr" minOccurs="1" maxOccurs="unbounded"/>
</sequence>
</content>
</elementSpec>

Expand Down

0 comments on commit f5a0101

Please # to comment.