Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 68 additions & 30 deletions xslt/articles/xslt-article-OpenAire2.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,15 @@
<datacite:alternateIdentifiers>
<xsl:apply-templates select="root/links"/>
</datacite:alternateIdentifiers>

<datacite:creators>
<xsl:apply-templates select="root/contributors/authors"/>
</datacite:creators>

<datacite:titles>
<xsl:apply-templates select="root/title"/>
</datacite:titles>

<xsl:apply-templates select="root/editorial_contributions/text"/>
<datacite:rightsList>
<datacite:rights rightsURI="http://purl.org/coar/access_right/c_14cb">metadata only access</datacite:rights>
Expand All @@ -49,6 +52,8 @@ Content generated by zbMATH Open, such as reviews, classifications, software, or
</datacite:dates>
<xsl:apply-templates select="root/source/series/publisher"/>
<xsl:apply-templates select="root/document_type/description"/>


<datacite:relatedIdentifiers>

<!-- Process DOIs with values -->
Expand All @@ -59,6 +64,7 @@ Content generated by zbMATH Open, such as reviews, classifications, software, or
<!-- Process related identifiers (ISSN and apply-templates for DOIs and URLs) -->
<xsl:apply-templates select="root/source" mode="relatedIdentifiers"/>
</datacite:relatedIdentifiers>

<xsl:apply-templates select="root/source" mode="citation"/>
</resource>
</xsl:template>
Expand All @@ -70,6 +76,7 @@ Content generated by zbMATH Open, such as reviews, classifications, software, or
</xsl:template>

<xsl:template match="root/links">
<xsl:if test="normalize-space(.) != '' and . != 'None'and . != 'none'">
<xsl:choose>
<!-- Process the first 'links' node that has a 'doi' identifier -->
<xsl:when test="self::links[type = 'doi' and normalize-space(identifier) != ''][1]">
Expand All @@ -84,6 +91,7 @@ Content generated by zbMATH Open, such as reviews, classifications, software, or
</datacite:alternateIdentifier>
</xsl:when>
</xsl:choose>
</xsl:if>
</xsl:template>

<xsl:template match="authors">
Expand All @@ -110,14 +118,16 @@ Content generated by zbMATH Open, such as reviews, classifications, software, or
</xsl:template>

<xsl:template match="text">
<!-- Transformation of description text -->
<xsl:if test="normalize-space(.) != '' and . != 'None'and . != 'none'">
<dc:description descriptionType="Abstract">

<xsl:value-of select="normalize-space(.)"/>

</dc:description>
</xsl:if>
</xsl:template>
<xsl:template match="msc">
<xsl:if test="normalize-space(.) != '' and . != 'None'and . != 'none'">
<datacite:subject>
<xsl:attribute name="subjectScheme">
<xsl:value-of select="scheme"/>
Expand All @@ -127,15 +137,15 @@ Content generated by zbMATH Open, such as reviews, classifications, software, or
</xsl:attribute>
<xsl:value-of select="text"/>
</datacite:subject>
</xsl:if>
</xsl:template>
<!-- Template for processing keywords it is also under the subject section with MSC'S
with its own subjectscheme -->

<xsl:template match="keywords">
<!-- Transformation of keywords -->
<xsl:if test="normalize-space(.) != '' and . != 'None'and . != 'none'">
<datacite:subject subjectScheme="keyword">
<xsl:value-of select="."/>
</datacite:subject>
</xsl:if>
</xsl:template>

<xsl:template match="datestamp">
Expand Down Expand Up @@ -179,46 +189,74 @@ with its own subjectscheme -->
<xsl:value-of select="."/>
</oaire:resourceType>
</xsl:template>

<xsl:template match="doi[normalize-space()]">
<datacite:relatedIdentifier relatedIdentifierType="DOI" relationType="Cites" resourceTypeGeneral="Other"><xsl:value-of select="normalize-space(.)"/></datacite:relatedIdentifier>
<xsl:if test="normalize-space(.) != '' and . != 'None' and . != 'none'">
<datacite:relatedIdentifier relatedIdentifierType="DOI" relationType="Cites" resourceTypeGeneral="Other">
<xsl:value-of select="normalize-space(.)"/>
</datacite:relatedIdentifier>
</xsl:if>
</xsl:template>

<!-- Template to handle references with empty DOI elements and take the value of document_id also adding the url of zbmath to the result -->
<xsl:template match="references[not(doi[normalize-space()])]">
<datacite:relatedIdentifier relatedIdentifierType="URL" relationType="IsCitedBy"><xsl:value-of select="concat('https://zbmath.org/', zbmath/document_id)"/></datacite:relatedIdentifier>
<xsl:if test="normalize-space(zbmath/document_id) != '' and zbmath/document_id != 'None' and zbmath/document_id != 'none'">
<datacite:relatedIdentifier relatedIdentifierType="URL" relationType="IsCitedBy">
<xsl:value-of select="concat('https://zbmath.org/', zbmath/document_id)"/>
</datacite:relatedIdentifier>
</xsl:if>
</xsl:template>

<xsl:template match="root/source" mode="relatedIdentifiers">
<!-- ISSN with type 'print' -->
<datacite:relatedIdentifier relatedIdentifierType="ISSN" relationType="Cites">
<xsl:value-of select="descendant::issn[type='print']/number"/>
</datacite:relatedIdentifier>
</xsl:template>
<xsl:if test="normalize-space(descendant::issn[type='print']/number) != '' and descendant::issn[type='print']/number != 'None' and descendant::issn[type='print']/number != 'none'">
<datacite:relatedIdentifier relatedIdentifierType="ISSN" relationType="Cites">
<xsl:value-of select="descendant::issn[type='print']/number"/>
</datacite:relatedIdentifier>
</xsl:if>
</xsl:template>


<!-- Template for processing citation metadata -->
<xsl:template match="root/source" mode="citation">
<dc:source>
<xsl:value-of select="source"/>
</dc:source>
<oaire:citationTitle>
<xsl:value-of select="series/title"/>
</oaire:citationTitle>
<oaire:citationVolume>
<xsl:value-of select="series/volume"/>
</oaire:citationVolume>
<oaire:citationIssue>
<xsl:value-of select="series/issue"/>
</oaire:citationIssue>
<xsl:if test="normalize-space(source) != '' and . != 'None' and . != 'none'">
<dc:source>
<xsl:value-of select="source"/>
</dc:source>
</xsl:if>

<xsl:if test="normalize-space(series/title) != '' and series/title != 'None' and series/title != 'none'">
<oaire:citationTitle>
<xsl:value-of select="series/title"/>
</oaire:citationTitle>
</xsl:if>

<xsl:if test="normalize-space(series/volume) != '' and series/volume != 'None' and series/volume != 'none'">
<oaire:citationVolume>
<xsl:value-of select="series/volume"/>
</oaire:citationVolume>
</xsl:if>

<xsl:if test="normalize-space(series/issue) != '' and series/issue != 'None' and series/issue != 'none'">
<oaire:citationIssue>
<xsl:value-of select="series/issue"/>
</oaire:citationIssue>
</xsl:if>

<xsl:variable name="pagesText" select="normalize-space(pages)"/>
<xsl:variable name="firstPage" select="substring-before($pagesText, '-')"/>
<xsl:variable name="lastPage" select="substring-after($pagesText, '-')"/>
<oaire:citationStartPage>
<xsl:value-of select="$firstPage"/>
</oaire:citationStartPage>
<oaire:citationEndPage>
<xsl:value-of select="$lastPage"/>
</oaire:citationEndPage>

<xsl:if test="normalize-space($firstPage) != '' and $firstPage != 'None' and $firstPage != 'none'">
<oaire:citationStartPage>
<xsl:value-of select="$firstPage"/>
</oaire:citationStartPage>
</xsl:if>

<xsl:if test="normalize-space($lastPage) != '' and $lastPage != 'None' and $lastPage != 'none'">
<oaire:citationEndPage>
<xsl:value-of select="$lastPage"/>
</oaire:citationEndPage>
</xsl:if>
</xsl:template>


</xsl:stylesheet>
19 changes: 10 additions & 9 deletions xslt/software/xslt-software-OpenAire.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -110,31 +110,31 @@ Content generated by zbMATH Open, such as reviews, classifications, software, or
</xsl:template>

<xsl:template match="license_terms">
<xsl:if test="normalize-space(.) != '' and . != 'None'">
<xsl:if test="normalize-space(.) != '' and . != 'None'and . != 'none'">
<oaire:licenseCondition>
<xsl:value-of select="."/>
</oaire:licenseCondition>
</xsl:if>
</xsl:template>

<xsl:template match="description">
<xsl:if test="normalize-space(.) != '' and . != 'None'">
<xsl:if test="normalize-space(.) != '' and . != 'None'and . != 'none'">
<dc:description xml:lang="en" descriptionType="Abstract">
<xsl:value-of select="."/>
</dc:description>
</xsl:if>
</xsl:template>

<xsl:template match="classification">
<xsl:if test="normalize-space(.) != '' and . != 'None'">
<xsl:if test="normalize-space(.) != '' and . != 'None' and . != 'none'">
<datacite:subject subjectScheme="msc2020" >
<xsl:value-of select="."/>
</datacite:subject>
</xsl:if>
</xsl:template>

<xsl:template match="keywords">
<xsl:if test="normalize-space(.) != '' and . != 'None'">
<xsl:if test="normalize-space(.) != '' and . != 'None'and . != 'none'">
<!-- Transformation of keywords -->
<datacite:subject subjectScheme="keyword">
<xsl:value-of select="."/>
Expand All @@ -145,23 +145,23 @@ Content generated by zbMATH Open, such as reviews, classifications, software, or


<xsl:template match="source">
<xsl:if test="normalize-space(.) != '' and . != 'None'">
<xsl:if test="normalize-space(.) != '' and . != 'None'and . != 'none'">
<dc:source>
<xsl:value-of select="."/>
</dc:source>
</xsl:if>
</xsl:template>

<xsl:template match="title">
<xsl:if test="normalize-space(.) != '' and . != 'None'">
<xsl:if test="normalize-space(.) != '' and . != 'None'and . != 'none'">
<oaire:citationTitle>
<xsl:value-of select="."/>
</oaire:citationTitle>
</xsl:if>
</xsl:template>

<xsl:template match="standard_articles/id">
<xsl:if test="normalize-space(.) != '' and . != 'None'">
<xsl:if test="normalize-space(.) != '' and . != 'None'and . != 'none'">
<!-- If the id element is present and not empty -->
<datacite:relatedIdentifier relatedIdentifierType="URL" relationType="IsReferencedBy">
<xsl:value-of select="concat('https://zbmath.org/', normalize-space(.))"/>
Expand All @@ -170,7 +170,7 @@ Content generated by zbMATH Open, such as reviews, classifications, software, or
</xsl:template>

<xsl:template match="references">
<xsl:if test="normalize-space(.) != '' and . != 'None'">
<xsl:if test="normalize-space(.) != '' and . != 'None'and . != 'none'">
<!-- If the id element is present and not empty -->
<datacite:relatedIdentifier relatedIdentifierType="URL" relationType="IsCitedBy">
<xsl:value-of select="concat('https://api.zbmath.org/v1/document/', normalize-space(.))"/>
Expand All @@ -197,4 +197,5 @@ Content generated by zbMATH Open, such as reviews, classifications, software, or
</xsl:template>


</xsl:stylesheet>
</xsl:stylesheet>