Skip to content

Commit

Permalink
Fix permissions check for new model papers
Browse files Browse the repository at this point in the history
  • Loading branch information
fred-atherden committed Jan 5, 2024
1 parent f9ee893 commit fbc0c61
Show file tree
Hide file tree
Showing 16 changed files with 59 additions and 21 deletions.
5 changes: 4 additions & 1 deletion src/final-JATS-schematron.sch
Original file line number Diff line number Diff line change
Expand Up @@ -2033,14 +2033,17 @@
<let name="author-contrib-group" value="ancestor::article-meta/contrib-group[1]"/>
<let name="copyright-holder" value="e:get-copyright-holder($author-contrib-group)"/>
<let name="license-type" value="license/@xlink:href"/>
<let name="is-prc" value="e:is-prc(.)"/>
<!-- dirty - needs doing based on first date rather than just position? -->
<let name="authoritative-year" value="if ($is-prc) then ancestor::article-meta/pub-history/event[date[@date-type='reviewed-preprint']][1]/date[@date-type='reviewed-preprint'][1]/year[1] else ancestor::article-meta/pub-date[@publication-format='electronic'][@date-type=('publication','pub')]/year[1]"/>

<assert see="https://elifeproduction.slab.com/posts/licensing-and-copyright-rqdavyty#permissions-test-1" test="copyright-statement" role="error" id="permissions-test-1">[permissions-test-1] permissions must contain copyright-statement in CC BY licensed articles.</assert>

<assert see="https://elifeproduction.slab.com/posts/licensing-and-copyright-rqdavyty#permissions-test-2" test="matches(copyright-year[1],'^[0-9]{4}$')" role="error" id="permissions-test-2">[permissions-test-2] permissions must contain copyright-year in the format 0000 in CC BY licensed articles. Currently it is <value-of select="copyright-year"/>.</assert>

<assert see="https://elifeproduction.slab.com/posts/licensing-and-copyright-rqdavyty#permissions-test-3" test="copyright-holder" role="error" id="permissions-test-3">[permissions-test-3] permissions must contain copyright-holder in CC BY licensed articles.</assert>

<assert see="https://elifeproduction.slab.com/posts/licensing-and-copyright-rqdavyty#permissions-test-6" test="copyright-year = ancestor::article-meta/pub-date[@publication-format='electronic'][@date-type=('publication','pub')]/year" role="error" id="permissions-test-6">[permissions-test-6] copyright-year must match the contents of the year in the pub-date[@publication-format='electronic'][@date-type='publication']. Currently, copyright-year=<value-of select="copyright-year"/> and pub-date=<value-of select="ancestor::article-meta/pub-date[@publication-format='electronic'][@date-type=('publication','pub')]/year"/>.</assert>
<assert see="https://elifeproduction.slab.com/posts/licensing-and-copyright-rqdavyty#permissions-test-6" test="copyright-year = $authoritative-year" role="error" id="permissions-test-6">[permissions-test-6] copyright-year must match the the year of first reviewed preprint publication under the new model or first publicaiton date in the old model. For this <value-of select="if ($is-prc) then 'new' else 'old'"/> model paper, currently copyright-year=<value-of select="copyright-year"/> and authoritative pub-date=<value-of select="$authoritative-year"/>.</assert>

<assert see="https://elifeproduction.slab.com/posts/licensing-and-copyright-rqdavyty#permissions-test-7" test="copyright-holder = $copyright-holder" role="error" id="permissions-test-7">[permissions-test-7] copyright-holder is incorrect. If the article has one author then it should be their surname (or collab name). If it has two authors it should be the surname (or collab name) of the first, then ' and ' and then the surname (or collab name) of the second. If three or more, it should be the surname (or collab name) of the first, and then ' et al'. Currently it's '<value-of select="copyright-holder"/>' when based on the author list it should be '<value-of select="$copyright-holder"/>'.</assert>

Expand Down
14 changes: 9 additions & 5 deletions src/final-JATS-schematron.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -10337,6 +10337,8 @@
<xsl:variable name="author-contrib-group" select="ancestor::article-meta/contrib-group[1]"/>
<xsl:variable name="copyright-holder" select="e:get-copyright-holder($author-contrib-group)"/>
<xsl:variable name="license-type" select="license/@xlink:href"/>
<xsl:variable name="is-prc" select="e:is-prc(.)"/>
<xsl:variable name="authoritative-year" select="if ($is-prc) then ancestor::article-meta/pub-history/event[date[@date-type='reviewed-preprint']][1]/date[@date-type='reviewed-preprint'][1]/year[1] else ancestor::article-meta/pub-date[@publication-format='electronic'][@date-type=('publication','pub')]/year[1]"/>

<!--ASSERT error-->
<xsl:choose>
Expand Down Expand Up @@ -10390,19 +10392,21 @@

<!--ASSERT error-->
<xsl:choose>
<xsl:when test="copyright-year = ancestor::article-meta/pub-date[@publication-format='electronic'][@date-type=('publication','pub')]/year"/>
<xsl:when test="copyright-year = $authoritative-year"/>
<xsl:otherwise>
<svrl:failed-assert xmlns:svrl="http://purl.oclc.org/dsdl/svrl" test="copyright-year = ancestor::article-meta/pub-date[@publication-format='electronic'][@date-type=('publication','pub')]/year">
<svrl:failed-assert xmlns:svrl="http://purl.oclc.org/dsdl/svrl" test="copyright-year = $authoritative-year">
<xsl:attribute name="id">permissions-test-6</xsl:attribute>
<xsl:attribute name="see">https://elifeproduction.slab.com/posts/licensing-and-copyright-rqdavyty#permissions-test-6</xsl:attribute>
<xsl:attribute name="role">error</xsl:attribute>
<xsl:attribute name="location">
<xsl:apply-templates select="." mode="schematron-select-full-path"/>
</xsl:attribute>
<svrl:text>[permissions-test-6] copyright-year must match the contents of the year in the pub-date[@publication-format='electronic'][@date-type='publication']. Currently, copyright-year=<xsl:text/>
<svrl:text>[permissions-test-6] copyright-year must match the the year of first reviewed preprint publication under the new model or first publicaiton date in the old model. For this <xsl:text/>
<xsl:value-of select="if ($is-prc) then 'new' else 'old'"/>
<xsl:text/> model paper, currently copyright-year=<xsl:text/>
<xsl:value-of select="copyright-year"/>
<xsl:text/> and pub-date=<xsl:text/>
<xsl:value-of select="ancestor::article-meta/pub-date[@publication-format='electronic'][@date-type=('publication','pub')]/year"/>
<xsl:text/> and authoritative pub-date=<xsl:text/>
<xsl:value-of select="$authoritative-year"/>
<xsl:text/>.</svrl:text>
</svrl:failed-assert>
</xsl:otherwise>
Expand Down
5 changes: 4 additions & 1 deletion src/final-package-JATS-schematron.sch
Original file line number Diff line number Diff line change
Expand Up @@ -2039,14 +2039,17 @@
<let name="author-contrib-group" value="ancestor::article-meta/contrib-group[1]"/>
<let name="copyright-holder" value="e:get-copyright-holder($author-contrib-group)"/>
<let name="license-type" value="license/@xlink:href"/>
<let name="is-prc" value="e:is-prc(.)"/>
<!-- dirty - needs doing based on first date rather than just position? -->
<let name="authoritative-year" value="if ($is-prc) then ancestor::article-meta/pub-history/event[date[@date-type='reviewed-preprint']][1]/date[@date-type='reviewed-preprint'][1]/year[1] else ancestor::article-meta/pub-date[@publication-format='electronic'][@date-type=('publication','pub')]/year[1]"/>

<assert see="https://elifeproduction.slab.com/posts/licensing-and-copyright-rqdavyty#permissions-test-1" test="copyright-statement" role="error" id="permissions-test-1">permissions must contain copyright-statement in CC BY licensed articles.</assert>

<assert see="https://elifeproduction.slab.com/posts/licensing-and-copyright-rqdavyty#permissions-test-2" test="matches(copyright-year[1],'^[0-9]{4}$')" role="error" id="permissions-test-2">permissions must contain copyright-year in the format 0000 in CC BY licensed articles. Currently it is <value-of select="copyright-year"/>.</assert>

<assert see="https://elifeproduction.slab.com/posts/licensing-and-copyright-rqdavyty#permissions-test-3" test="copyright-holder" role="error" id="permissions-test-3">permissions must contain copyright-holder in CC BY licensed articles.</assert>

<assert see="https://elifeproduction.slab.com/posts/licensing-and-copyright-rqdavyty#permissions-test-6" test="copyright-year = ancestor::article-meta/pub-date[@publication-format='electronic'][@date-type=('publication','pub')]/year" role="error" id="permissions-test-6">copyright-year must match the contents of the year in the pub-date[@publication-format='electronic'][@date-type='publication']. Currently, copyright-year=<value-of select="copyright-year"/> and pub-date=<value-of select="ancestor::article-meta/pub-date[@publication-format='electronic'][@date-type=('publication','pub')]/year"/>.</assert>
<assert see="https://elifeproduction.slab.com/posts/licensing-and-copyright-rqdavyty#permissions-test-6" test="copyright-year = $authoritative-year" role="error" id="permissions-test-6">copyright-year must match the the year of first reviewed preprint publication under the new model or first publicaiton date in the old model. For this <value-of select="if ($is-prc) then 'new' else 'old'"/> model paper, currently copyright-year=<value-of select="copyright-year"/> and authoritative pub-date=<value-of select="$authoritative-year"/>.</assert>

<assert see="https://elifeproduction.slab.com/posts/licensing-and-copyright-rqdavyty#permissions-test-7" test="copyright-holder = $copyright-holder" role="error" id="permissions-test-7">copyright-holder is incorrect. If the article has one author then it should be their surname (or collab name). If it has two authors it should be the surname (or collab name) of the first, then ' and ' and then the surname (or collab name) of the second. If three or more, it should be the surname (or collab name) of the first, and then ' et al'. Currently it's '<value-of select="copyright-holder"/>' when based on the author list it should be '<value-of select="$copyright-holder"/>'.</assert>

Expand Down
5 changes: 4 additions & 1 deletion src/pre-JATS-schematron.sch
Original file line number Diff line number Diff line change
Expand Up @@ -1978,14 +1978,17 @@
<let name="author-contrib-group" value="ancestor::article-meta/contrib-group[1]"/>
<let name="copyright-holder" value="e:get-copyright-holder($author-contrib-group)"/>
<let name="license-type" value="license/@xlink:href"/>
<let name="is-prc" value="e:is-prc(.)"/>
<!-- dirty - needs doing based on first date rather than just position? -->
<let name="authoritative-year" value="if ($is-prc) then ancestor::article-meta/pub-history/event[date[@date-type='reviewed-preprint']][1]/date[@date-type='reviewed-preprint'][1]/year[1] else ancestor::article-meta/pub-date[@publication-format='electronic'][@date-type=('publication','pub')]/year[1]"/>

<assert see="https://elifeproduction.slab.com/posts/licensing-and-copyright-rqdavyty#permissions-test-1" test="copyright-statement" role="error" id="permissions-test-1">[permissions-test-1] permissions must contain copyright-statement in CC BY licensed articles.</assert>

<assert see="https://elifeproduction.slab.com/posts/licensing-and-copyright-rqdavyty#permissions-test-2" test="matches(copyright-year[1],'^[0-9]{4}$')" role="error" id="permissions-test-2">[permissions-test-2] permissions must contain copyright-year in the format 0000 in CC BY licensed articles. Currently it is <value-of select="copyright-year"/>.</assert>

<assert see="https://elifeproduction.slab.com/posts/licensing-and-copyright-rqdavyty#permissions-test-3" test="copyright-holder" role="error" id="permissions-test-3">[permissions-test-3] permissions must contain copyright-holder in CC BY licensed articles.</assert>

<assert see="https://elifeproduction.slab.com/posts/licensing-and-copyright-rqdavyty#permissions-test-6" test="copyright-year = ancestor::article-meta/pub-date[@publication-format='electronic'][@date-type=('publication','pub')]/year" role="error" id="permissions-test-6">[permissions-test-6] copyright-year must match the contents of the year in the pub-date[@publication-format='electronic'][@date-type='publication']. Currently, copyright-year=<value-of select="copyright-year"/> and pub-date=<value-of select="ancestor::article-meta/pub-date[@publication-format='electronic'][@date-type=('publication','pub')]/year"/>.</assert>
<assert see="https://elifeproduction.slab.com/posts/licensing-and-copyright-rqdavyty#permissions-test-6" test="copyright-year = $authoritative-year" role="error" id="permissions-test-6">[permissions-test-6] copyright-year must match the the year of first reviewed preprint publication under the new model or first publicaiton date in the old model. For this <value-of select="if ($is-prc) then 'new' else 'old'"/> model paper, currently copyright-year=<value-of select="copyright-year"/> and authoritative pub-date=<value-of select="$authoritative-year"/>.</assert>

<assert see="https://elifeproduction.slab.com/posts/licensing-and-copyright-rqdavyty#permissions-test-7" test="copyright-holder = $copyright-holder" role="error" id="permissions-test-7">[permissions-test-7] copyright-holder is incorrect. If the article has one author then it should be their surname (or collab name). If it has two authors it should be the surname (or collab name) of the first, then ' and ' and then the surname (or collab name) of the second. If three or more, it should be the surname (or collab name) of the first, and then ' et al'. Currently it's '<value-of select="copyright-holder"/>' when based on the author list it should be '<value-of select="$copyright-holder"/>'.</assert>

Expand Down
14 changes: 9 additions & 5 deletions src/pre-JATS-schematron.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -10224,6 +10224,8 @@
<xsl:variable name="author-contrib-group" select="ancestor::article-meta/contrib-group[1]"/>
<xsl:variable name="copyright-holder" select="e:get-copyright-holder($author-contrib-group)"/>
<xsl:variable name="license-type" select="license/@xlink:href"/>
<xsl:variable name="is-prc" select="e:is-prc(.)"/>
<xsl:variable name="authoritative-year" select="if ($is-prc) then ancestor::article-meta/pub-history/event[date[@date-type='reviewed-preprint']][1]/date[@date-type='reviewed-preprint'][1]/year[1] else ancestor::article-meta/pub-date[@publication-format='electronic'][@date-type=('publication','pub')]/year[1]"/>

<!--ASSERT error-->
<xsl:choose>
Expand Down Expand Up @@ -10277,19 +10279,21 @@

<!--ASSERT error-->
<xsl:choose>
<xsl:when test="copyright-year = ancestor::article-meta/pub-date[@publication-format='electronic'][@date-type=('publication','pub')]/year"/>
<xsl:when test="copyright-year = $authoritative-year"/>
<xsl:otherwise>
<svrl:failed-assert xmlns:svrl="http://purl.oclc.org/dsdl/svrl" test="copyright-year = ancestor::article-meta/pub-date[@publication-format='electronic'][@date-type=('publication','pub')]/year">
<svrl:failed-assert xmlns:svrl="http://purl.oclc.org/dsdl/svrl" test="copyright-year = $authoritative-year">
<xsl:attribute name="id">permissions-test-6</xsl:attribute>
<xsl:attribute name="see">https://elifeproduction.slab.com/posts/licensing-and-copyright-rqdavyty#permissions-test-6</xsl:attribute>
<xsl:attribute name="role">error</xsl:attribute>
<xsl:attribute name="location">
<xsl:apply-templates select="." mode="schematron-select-full-path"/>
</xsl:attribute>
<svrl:text>[permissions-test-6] copyright-year must match the contents of the year in the pub-date[@publication-format='electronic'][@date-type='publication']. Currently, copyright-year=<xsl:text/>
<svrl:text>[permissions-test-6] copyright-year must match the the year of first reviewed preprint publication under the new model or first publicaiton date in the old model. For this <xsl:text/>
<xsl:value-of select="if ($is-prc) then 'new' else 'old'"/>
<xsl:text/> model paper, currently copyright-year=<xsl:text/>
<xsl:value-of select="copyright-year"/>
<xsl:text/> and pub-date=<xsl:text/>
<xsl:value-of select="ancestor::article-meta/pub-date[@publication-format='electronic'][@date-type=('publication','pub')]/year"/>
<xsl:text/> and authoritative pub-date=<xsl:text/>
<xsl:value-of select="$authoritative-year"/>
<xsl:text/>.</svrl:text>
</svrl:failed-assert>
</xsl:otherwise>
Expand Down
8 changes: 6 additions & 2 deletions src/schematron.sch
Original file line number Diff line number Diff line change
Expand Up @@ -2766,6 +2766,10 @@
<let name="author-contrib-group" value="ancestor::article-meta/contrib-group[1]"/>
<let name="copyright-holder" value="e:get-copyright-holder($author-contrib-group)"/>
<let name="license-type" value="license/@xlink:href"/>
<let name="is-prc" value="e:is-prc(.)"/>
<!-- dirty - needs doing based on first date rather than just position? -->
<let name="authoritative-year" value="if ($is-prc) then ancestor::article-meta/pub-history/event[date[@date-type='reviewed-preprint']][1]/date[@date-type='reviewed-preprint'][1]/year[1]
else ancestor::article-meta/pub-date[@publication-format='electronic'][@date-type=('publication','pub')]/year[1]"/>

<assert see ="https://elifeproduction.slab.com/posts/licensing-and-copyright-rqdavyty#permissions-test-1"
test="copyright-statement"
Expand All @@ -2783,9 +2787,9 @@
id="permissions-test-3">permissions must contain copyright-holder in CC BY licensed articles.</assert>

<assert see ="https://elifeproduction.slab.com/posts/licensing-and-copyright-rqdavyty#permissions-test-6"
test="copyright-year = ancestor::article-meta/pub-date[@publication-format='electronic'][@date-type=('publication','pub')]/year"
test="copyright-year = $authoritative-year"
role="error"
id="permissions-test-6">copyright-year must match the contents of the year in the pub-date[@publication-format='electronic'][@date-type='publication']. Currently, copyright-year=<value-of select="copyright-year"/> and pub-date=<value-of select="ancestor::article-meta/pub-date[@publication-format='electronic'][@date-type=('publication','pub')]/year"/>.</assert>
id="permissions-test-6">copyright-year must match the the year of first reviewed preprint publication under the new model or first publicaiton date in the old model. For this <value-of select="if ($is-prc) then 'new' else 'old'"/> model paper, currently copyright-year=<value-of select="copyright-year"/> and authoritative pub-date=<value-of select="$authoritative-year"/>.</assert>

<assert see ="https://elifeproduction.slab.com/posts/licensing-and-copyright-rqdavyty#permissions-test-7"
test="copyright-holder = $copyright-holder"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1294,6 +1294,8 @@
<let name="author-contrib-group" value="ancestor::article-meta/contrib-group[1]"/>
<let name="copyright-holder" value="e:get-copyright-holder($author-contrib-group)"/>
<let name="license-type" value="license/@xlink:href"/>
<let name="is-prc" value="e:is-prc(.)"/>
<let name="authoritative-year" value="if ($is-prc) then ancestor::article-meta/pub-history/event[date[@date-type='reviewed-preprint']][1]/date[@date-type='reviewed-preprint'][1]/year[1] else ancestor::article-meta/pub-date[@publication-format='electronic'][@date-type=('publication','pub')]/year[1]"/>
<assert see="https://elifeproduction.slab.com/posts/licensing-and-copyright-rqdavyty#permissions-test-1" test="copyright-statement" role="error" id="permissions-test-1">permissions must contain copyright-statement in CC BY licensed articles.</assert>
</rule>
</pattern>
Expand Down
Loading

0 comments on commit fbc0c61

Please sign in to comment.