Skip to content

Commit

Permalink
Add “pending-“ div types for docs, chs, sections
Browse files Browse the repository at this point in the history
… to be used for divisions withheld pending clearance
  • Loading branch information
joewiz committed Dec 4, 2024
1 parent fb5e255 commit 1709d2d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
6 changes: 3 additions & 3 deletions modules/lib/frus-toc.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<xsl:mode name="html" on-no-match="text-only-copy"/>

<xsl:accumulator name="document-nos" initial-value="()" as="xs:string*">
<xsl:accumulator-rule match="tei:div[@type eq 'document']" select="($value, @n)" phase="end"/>
<xsl:accumulator-rule match="tei:div[@type = ('document', 'document-pending')]" select="($value, @n)" phase="end"/>
</xsl:accumulator>

<xsl:accumulator name="document-ids" initial-value="()" as="xs:string*">
Expand All @@ -29,10 +29,10 @@
</div>
</xsl:template>

<xsl:template match="tei:div[@xml:id][not(@type = ('document'))]">
<xsl:template match="tei:div[@xml:id][not(@type = ('document', 'document-pending'))]">
<xsl:variable name="accDocs" as="xs:string*" select="accumulator-after('document-nos')"/>
<xsl:variable name="prevDocs" as="xs:string*" select="accumulator-before('document-nos')"/>
<xsl:variable name="docs" as="xs:string*" select="if (tei:div[@type eq 'document']) then $accDocs[not(. = $prevDocs)] else ()"/>
<xsl:variable name="docs" as="xs:string*" select="if (tei:div[@type = ('document', 'document-pending')]) then $accDocs[not(. = $prevDocs)] else ()"/>
<xsl:variable name="prevDocIDs" as="xs:string*" select="accumulator-before('document-ids')"/>
<xsl:variable name="docIDs" as="xs:string*" select="accumulator-after('document-ids')[not(. = $prevDocIDs)]"/>
<xsl:variable name="child_list" as="element(ul)?">
Expand Down
9 changes: 9 additions & 0 deletions schema/frus.odd
Original file line number Diff line number Diff line change
Expand Up @@ -1326,15 +1326,24 @@
<valItem ident="document">
<gloss>Document</gloss>
</valItem>
<valItem ident="document-pending">
<gloss>Document (withheld pending clearance)</gloss>
</valItem>
<valItem ident="section">
<gloss>Section</gloss>
</valItem>
<valItem ident="section-pending">
<gloss>Section (withheld pending clearance)</gloss>
</valItem>
<valItem ident="compilation">
<gloss>Compilation</gloss>
</valItem>
<valItem ident="chapter">
<gloss>Chapter</gloss>
</valItem>
<valItem ident="chapter-pending">
<gloss>Chapter (withheld pending clearance)</gloss>
</valItem>
<valItem ident="subchapter">
<gloss>Sub-chapter</gloss>
</valItem>
Expand Down
20 changes: 10 additions & 10 deletions schema/frus.sch
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<extends href="frus-characters.sch"/>

<!-- Define variables used by other patterns -->
<let name="documents" value="//tei:div[@type = 'document']"/>
<let name="documents" value="//tei:div[@type = ('document', 'document-pending')]"/>

<pattern id="processing-instruction-check">
<rule context="/processing-instruction()">
Expand Down Expand Up @@ -161,29 +161,29 @@
<pattern id="div-child-checks">
<title>Compilation/Chapter/Subchapter Nesting Checks</title>
<rule
context="tei:div[@type = ('compilation', 'chapter', 'subchapter')][not(@subtype = ('index', 'referral', 'editorial-note'))]">
context="tei:div[@type = ('compilation', 'chapter', 'chapter-pending', 'subchapter')][not(@subtype = ('index', 'referral', 'editorial-note'))]">
<assert role="warn"
test=".//tei:div[@type = 'document'] or .//tei:div[@subtype = ('index', 'referral', 'editorial-note')]"
test=".//tei:div[@type = ('document', 'document-pending')] or .//tei:div[@subtype = ('index', 'referral', 'editorial-note')]"
>This <value-of select="@type"/> does not contain a div/@type='document'. Please
verify that the structure is correct.</assert>
</rule>
<rule context="tei:div[@type = 'document']">
<rule context="tei:div[@type = ('document', 'document-pending')]">
<assert role="warn"
test="not(preceding-sibling::tei:div[1][@type = ('compilation', 'chapter', 'subchapter')] or following-sibling::tei:div[1][@type = ('compilation', 'chapter', 'subchapter')])"
test="not(preceding-sibling::tei:div[1][@type = ('compilation', 'chapter', 'chapter-pending', 'subchapter')] or following-sibling::tei:div[1][@type = ('compilation', 'chapter', 'chapter-pending', 'subchapter')])"
>This document is preceded or followed by a <value-of select="@type"/>. Please
verify that the structure is correct.</assert>
</rule>
</pattern>

<pattern id="div-numbering-checks">
<title>Document Div Numbering Checks</title>
<rule context="tei:div[@type = 'document'][@n castable as xs:integer]">
<rule context="tei:div[@type = ('document', 'document-pending')][@n castable as xs:integer]">
<assert
test="not(./preceding::tei:div[@type = 'document']) or ./@n = (./preceding::tei:div[@n castable as xs:integer][1]/@n + 1)"
test="not(./preceding::tei:div[@type = ('document', 'document-pending')]) or ./@n = (./preceding::tei:div[@n castable as xs:integer][1]/@n + 1)"
>Document numbering mismatch. Document div/@n numbering must be
consecutive.</assert>
</rule>
<rule context="tei:div[@type = 'document']">
<rule context="tei:div[@type = ('document', 'document-pending')]">
<assert role="warn" test="not(matches(./@n, '^\[.+?\]$'))">Document's @n is encased in
square brackets: "[]". Only use in the rare circumstance that the volume has a block
of unnumbered documents outside the normal stream of numbered documents. Please
Expand Down Expand Up @@ -271,7 +271,7 @@

<pattern id="footnote-id-checks">
<title>Footnote ID Checks</title>
<rule context="tei:note[@xml:id and ancestor::tei:div/@type = 'document']">
<rule context="tei:note[@xml:id and ancestor::tei:div/@type = ('document', 'document-pending')]">
<assert test="substring-before(./@xml:id, 'fn') = ./ancestor::tei:div[1]/@xml:id"
>Footnote ID mismatch. Document ID portion of footnote @xml:id '<value-of
select="./@xml:id"/>' must match its document's @xml:id '<value-of
Expand Down Expand Up @@ -355,7 +355,7 @@
<title>Source Note checks</title>
<!-- limit this rule to volumes covering post-1950 or published after 1995, when source note conventions begin to conform to these rules -->
<rule
context="tei:div[@subtype eq 'historical-document'][root(.)/tei:TEI/tei:teiHeader[.//tei:date[@type eq 'content-date']/@notBefore ge '1950' or .//tei:date[@type eq 'publication-date'] gt '1995']]">
context="tei:div[@subtype eq 'historical-document' and not(@type eq 'document-pending')][root(.)/tei:TEI/tei:teiHeader[.//tei:date[@type eq 'content-date']/@notBefore ge '1950' or .//tei:date[@type eq 'publication-date'] gt '1995']]">
<let name="source-note"
value="(tei:note[@type eq 'source' and @rend eq 'inline'], tei:head/tei:note[@type eq 'source'], tei:head/tei:note//tei:seg[@type eq 'source'])[1]"/>
<let name="source-note-content" value="
Expand Down

0 comments on commit 1709d2d

Please sign in to comment.