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
9 changes: 4 additions & 5 deletions test/data/articles/reference-OpenAire2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ Content generated by zbMATH Open, such as reviews, classifications, software, or
<datacite:subject subjectScheme="keyword">symmetric matrix</datacite:subject>
</datacite:subjects>
<datacite:dates>
<datacite:date dateType="Issued">2015-01-06</datacite:date>
<datacite:date dateType="Available">2015</datacite:date>
</datacite:dates>
<dc:publisher>Princeton University, Mathematics Department, Princeton, NJ</dc:publisher>
<oaire:resourceType resourceTypeGeneral="literature" uri="http://purl.org/coar/resource_type/c_6501">journal article</oaire:resourceType>
<datacite:relatedIdentifiers>
<datacite:relatedIdentifier relatedIdentifierType="URL" relationType="IsCitedBy">https://zbmath.org/3377327</datacite:relatedIdentifier>
<datacite:relatedIdentifier relatedIdentifierType="DOI"
relationType="Cites"
resourceTypeGeneral="Other">10.2307/1971450</datacite:relatedIdentifier>
Expand All @@ -69,12 +69,11 @@ Content generated by zbMATH Open, such as reviews, classifications, software, or
<datacite:relatedIdentifier relatedIdentifierType="DOI"
relationType="Cites"
resourceTypeGeneral="Other">10.1112/plms/pdm010</datacite:relatedIdentifier>
<datacite:relatedIdentifier relatedIdentifierType="DOI"
relationType="Cites"
resourceTypeGeneral="Other">10.4007/annals.2014.179.3.7</datacite:relatedIdentifier>
<datacite:relatedIdentifier relatedIdentifierType="URL" relationType="IsCitedBy">https://zbmath.org/3377327</datacite:relatedIdentifier>
<datacite:relatedIdentifier relatedIdentifierType="URL" relationType="IsCitedBy">https://zbmath.org/6587992</datacite:relatedIdentifier>
<datacite:relatedIdentifier relatedIdentifierType="URL" relationType="IsCitedBy">https://zbmath.org/195021</datacite:relatedIdentifier>
<datacite:relatedIdentifier relatedIdentifierType="DOI"
relationType="Cites"
resourceTypeGeneral="Other">10.4007/annals.2014.179.3.7</datacite:relatedIdentifier>
<datacite:relatedIdentifier relatedIdentifierType="ISSN" relationType="Cites">0003-486X</datacite:relatedIdentifier>
</datacite:relatedIdentifiers>
<dc:source>Ann. Math. (2) 181, No. 1, 383-413 (2015).</dc:source>
Expand Down
178 changes: 132 additions & 46 deletions xslt/articles/xslt-article-OpenAire2.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -46,26 +46,71 @@ Content generated by zbMATH Open, such as reviews, classifications, software, or
<xsl:apply-templates select="root/msc"/>
<xsl:apply-templates select="root/keywords"/>
</datacite:subjects>
<datacite:dates>
<xsl:apply-templates select="root/datestamp"/>
<xsl:apply-templates select="root/year"/>
</datacite:dates>

<datacite:dates>
<xsl:choose>

<xsl:when test="root/year[normalize-space(.) != ''
and . != 'None'
and . != 'none'
and not(contains(., 'zbMATH Open Web Interface contents unavailable due to conflicting licenses'))]">
<datacite:date dateType="Available">
<xsl:value-of select="root/year"/>
</datacite:date>
</xsl:when>

<xsl:otherwise>
<xsl:if test="root/source/series/year[normalize-space(.) != ''
and . != 'None'
and . != 'none'
and not(contains(., 'zbMATH Open Web Interface contents unavailable due to conflicting licenses'))]">
<datacite:date dateType="Available">
<xsl:value-of select="root/source/series/year"/>
</datacite:date>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</datacite:dates>

<xsl:apply-templates select="root/source/series/publisher"/>
<xsl:apply-templates select="root/document_type/description"/>


<xsl:choose>
<xsl:when test="not(root/document_type) or not(root/document_type/*)">
<xsl:element name="resourceType">
<xsl:attribute name="resourceTypeGeneral">literature</xsl:attribute>
<xsl:attribute name="uri">http://purl.org/coar/resource_type/c_1843</xsl:attribute>
<xsl:text>other</xsl:text>
</xsl:element>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="root/document_type/description"/>
</xsl:otherwise>
</xsl:choose>


<datacite:relatedIdentifiers>
<xsl:if test="//references[
(doi[normalize-space() and
. != 'None' and . != 'none' and
not(contains(., 'zbMATH Open Web Interface contents unavailable due to conflicting licenses'))])
or
(zbmath/document_id[normalize-space() and
. != 'None' and . != 'none' and
not(contains(., 'zbMATH Open Web Interface contents unavailable due to conflicting licenses'))])
]">

<xsl:apply-templates select="//references"/>

<!-- Process DOIs with values -->
<xsl:apply-templates select="//references/doi[normalize-space()]"/>
</xsl:if>

<!-- Process references with URLs (zbmath) but no DOI -->
<xsl:apply-templates select="//references[doi[not(normalize-space())]]"/>
<!-- Process related identifiers (ISSN and apply-templates for DOIs and URLs) -->
<xsl:apply-templates select="root/source" mode="relatedIdentifiers"/>
<xsl:apply-templates select="root/source" mode="relatedIdentifiers"/>
</datacite:relatedIdentifiers>

<xsl:apply-templates select="root/source" mode="citation"/>
<xsl:if test="root/source[node()]">
<xsl:apply-templates select="root/source" mode="citation"/>
</xsl:if>

</resource>
</xsl:template>

Expand Down Expand Up @@ -100,10 +145,24 @@ Content generated by zbMATH Open, such as reviews, classifications, software, or
<xsl:value-of select="name"/>
</datacite:creatorName>
<datacite:givenName>
<xsl:value-of select="substring-before(name, ',')"/>
<xsl:choose>
<xsl:when test="contains(name, 'zbMATH Open Web Interface contents unavailable due to conflicting licenses.')">
zbMATH Open Web Interface contents unavailable due to conflicting licenses.
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="substring-before(name, ',')"/>
</xsl:otherwise>
</xsl:choose>
</datacite:givenName>
<datacite:familyName>
<xsl:value-of select="substring-after(name, ', ')"/>
<xsl:choose>
<xsl:when test="contains(name, 'zbMATH Open Web Interface contents unavailable due to conflicting licenses.')">
zbMATH Open Web Interface contents unavailable due to conflicting licenses.
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="substring-after(name, ', ')"/>
</xsl:otherwise>
</xsl:choose>
</datacite:familyName>
<datacite:nameIdentifier schemeURI="https://zbmath.org/" nameIdentifierScheme="zbMATH Author Code">
<xsl:value-of select="codes"/>
Expand Down Expand Up @@ -148,64 +207,91 @@ Content generated by zbMATH Open, such as reviews, classifications, software, or
</xsl:if>
</xsl:template>

<xsl:template match="datestamp">
<!-- Check if the year part does not start with '0' -->
<xsl:if test="not(starts-with(substring(., 1, 4), '0'))">
<datacite:date dateType="Issued">
<!-- Extract just the date part (YYYY-MM-DD) from the datestamp -->
<xsl:value-of select="substring-before(., 'T')" />
</datacite:date>
</xsl:if>
</xsl:template>

<xsl:template match="year">
<xsl:variable name="seriesYear" select="../../source/series/year"/>
<xsl:choose>

<xsl:when test="normalize-space(.) != ''
and . != 'None'
and . != 'none'
and not(contains(., 'zbMATH Open Web Interface contents unavailable due to conflicting licenses'))">
<datacite:date dateType="Available">
<xsl:value-of select="."/>
</datacite:date>
</xsl:when>
<xsl:otherwise>
<xsl:if test="normalize-space($seriesYear) != ''
and $seriesYear != 'None'
and $seriesYear != 'none'
and not(contains($seriesYear, 'zbMATH Open Web Interface contents unavailable due to conflicting licenses'))">
<datacite:date dateType="Available">
<xsl:value-of select="$seriesYear"/>
</datacite:date>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

<xsl:template match="year">
<datacite:date dateType="Available">
<xsl:value-of select="."/>
</datacite:date>
</xsl:template>

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

<xsl:template match="description">
<xsl:variable name="docTypeDesc" select="normalize-space(../document_type/description)"/>

<oaire:resourceType>
<xsl:choose>
<xsl:when test="contains(translate(., 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'), 'article')">
<xsl:attribute name="resourceTypeGeneral">literature</xsl:attribute>
<xsl:attribute name="uri">http://purl.org/coar/resource_type/c_6501</xsl:attribute>
<xsl:value-of select="."/>
</xsl:when>
<xsl:when test="contains(translate(., 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'), 'book')">
<xsl:attribute name="resourceTypeGeneral">literature</xsl:attribute>
<xsl:attribute name="uri">http://purl.org/coar/resource_type/c_2f33</xsl:attribute>
<xsl:value-of select="."/>
</xsl:when>
<xsl:when test="normalize-space(.) != ''">
<xsl:attribute name="resourceTypeGeneral">literature</xsl:attribute>
<xsl:attribute name="uri">http://purl.org/coar/resource_type/c_1843</xsl:attribute>
<xsl:value-of select="."/>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="resourceTypeGeneral">literature</xsl:attribute>
<xsl:attribute name="uri">http://purl.org/coar/resource_type/c_1843</xsl:attribute>
<xsl:text>other</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="."/>
</oaire:resourceType>
</xsl:template>

<xsl:template match="doi[normalize-space()]">
<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()])]">
<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="references">
<xsl:choose>
<xsl:when test="normalize-space(doi) != ''
and doi != 'None'
and doi != 'none'
and not(contains(doi, 'zbMATH Open Web Interface contents unavailable due to conflicting licenses'))">
<datacite:relatedIdentifier relatedIdentifierType="DOI" relationType="Cites" resourceTypeGeneral="Other">
<xsl:value-of select="normalize-space(doi)"/>
</datacite:relatedIdentifier>
</xsl:when>
<xsl:when test="zbmath/document_id[normalize-space()
and . != 'None'
and . != 'none'
and not(contains(., 'zbMATH Open Web Interface contents unavailable due to conflicting licenses'))]">
<datacite:relatedIdentifier relatedIdentifierType="URL" relationType="IsCitedBy">
<xsl:value-of select="concat('https://zbmath.org/', zbmath/document_id)"/>
</datacite:relatedIdentifier>
</xsl:when>
</xsl:choose>
</xsl:template>

<xsl:template match="root/source" mode="relatedIdentifiers">
<xsl:if test="normalize-space(descendant::issn[type='print']/number) != '' and descendant::issn[type='print']/number != 'None' and descendant::issn[type='print']/number != 'none'">
Expand Down