Skip to content

Instantly share code, notes, and snippets.

@jesusbagpuss
Created January 22, 2019 11:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jesusbagpuss/8520e899c0f93ab4945a41484203f45a to your computer and use it in GitHub Desktop.
Save jesusbagpuss/8520e899c0f93ab4945a41484203f45a to your computer and use it in GitHub Desktop.
Symplectic RT1 Exceptions mapping (Elements v5.1 and above)
<!-- ##################### oa-policy-exceptions ##################### -->
<!--
<pubs:oa-policy-exception>
<pubs:type>Access1</pubs:type>
<pubs:type-description>The output depends on the reproduction of
third party content for which open access rights could not be
granted (either within the specified timescales, or at all).</pubs:type-description>
<pubs:comment>This is a test exception</pubs:comment>
</pubs:oa-policy-exception>
<hoa_ex_acc>a</hoa_ex_acc>
<hoa_ex_acc_txt>...</
Access[1-3] -> hoa_ex_acc a-c
Deposit[1-7] -> hoa_ex_dep a-g
Other -> hoa_ex_oth T/F
Tech1 doesn't map to a hefce technical exception.
Tech[2-4] -> hoa_ex_tec a-c?
Unavailable -> ???
Waiver -> ???
The exception text needs to be mapped into hoa_ex_acc_txt / hoa_ex_dep_txt / hoa_ex_tech_txt / hoa_ex_oth_txt accordingly.
-->
<!-- Access exceptions -->
<xsl:template match="atom:feed/pubs:oa-policy-exception[starts-with(pubs:type, 'Access')]" mode="feed">
<xsl:element name="hoa_ex_acc">
<xsl:value-of select="translate(substring-after(pubs:type, 'Access'), '123', 'abc')"/>
</xsl:element>
<xsl:element name="hoa_ex_acc_txt">
<xsl:value-of select="pubs:comment"/>
</xsl:element>
</xsl:template>
<!-- Deposit exceptions -->
<xsl:template match="atom:feed/pubs:oa-policy-exception[starts-with(pubs:type, 'Deposit')]" mode="feed">
<xsl:element name="hoa_ex_dep">
<xsl:value-of select="translate(substring-after(pubs:type, 'Deposit'), '1234567', 'abcdefg')"/>
</xsl:element>
<xsl:element name="hoa_ex_dep_txt">
<xsl:value-of select="pubs:comment"/>
</xsl:element>
</xsl:template>
<!-- Technical exceptions 2,3,4 (map directly onto HEFCE descriptions) -->
<xsl:template match="atom:feed/pubs:oa-policy-exception[starts-with(pubs:type, 'Tech') and not(starts-with(pubs:type, 'Tech1'))]" mode="feed">
<xsl:element name="hoa_ex_dep">
<xsl:value-of select="translate(substring-after(pubs:type, 'Tech'), '234', 'abc')"/>
</xsl:element>
<xsl:element name="hoa_ex_tech_txt">
<xsl:value-of select="pubs:comment"/>
</xsl:element>
</xsl:template>
<!-- Other exceptions - if exception is actually 'other' set hoa_ex_oth = TRUE, otherwise just add details to hoa_ex_oth_txt noting Elements exception -->
<xsl:template match="atom:feed/pubs:oa-policy-exception" mode="feed" priority="0.4">
<xsl:if test="pubs:type = 'Other'">
<xsl:element name="hoa_ex_oth">TRUE</xsl:element>
</xsl:if>
<xsl:element name="hoa_ex_oth_txt">
<xsl:if test="pubs:type != 'Other'">
<xsl:text>Elements OA-Exception: </xsl:text>
<xsl:value-of select="pubs:type" />
<xsl:text>&#10;</xsl:text>
</xsl:if>
<xsl:value-of select="pubs:comment"/>
</xsl:element>
</xsl:template>
<!-- ##################### oa-policy-exceptions ##################### -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment