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
1 change: 1 addition & 0 deletions test/data/articles/Test_Reference-Datacite.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
<relatedIdentifier relatedIdentifierType="URL" relationType="IsCitedBy">https://zbmath.org/6587992</relatedIdentifier>
<relatedIdentifier relatedIdentifierType="URL" relationType="IsCitedBy">https://zbmath.org/195021</relatedIdentifier>
<relatedIdentifier relatedIdentifierType="DOI" relationType="Cites" resourceTypeGeneral="JournalArticle">10.4007/annals.2014.179.3.7</relatedIdentifier>
<relatedIdentifier relatedIdentifierType="ARXIV" relationType="IsPartOf" resourceTypeGeneral="JournalArticle">1311.4600</relatedIdentifier>
</relatedIdentifiers>
<rightsList>
<rights xml:lang="en" schemeURI="https://api.zbmath.org/v1/" rightsIdentifierScheme="zbMATH" rightsIdentifier="CC-BY-SA 4.0" rightsURI="https://creativecommons.org/licenses/by-sa/4.0/">
Expand Down
Empty file removed test/data/software/real.xml
Empty file.
106 changes: 76 additions & 30 deletions xslt/articles/xslt-article-Datacite.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,23 @@ Made by Shiraz Malla Mohamad member of zbmath Team-->
<xsl:apply-templates select="root/editorial_contributions/text"/>
</descriptions>
</xsl:if>
<xsl:apply-templates select="root/title"/>

<xsl:if test="root/title[
normalize-space(.) != ''
and . != 'None'
and . != 'none'
and not(contains(., 'zbMATH Open Web Interface contents unavailable due to conflicting licenses'))]">
<xsl:apply-templates select="root/title"/>
</xsl:if>
<xsl:if test="not(root/title[
normalize-space(.) != ''
and . != 'None'
and . != 'none'
and not(contains(., 'zbMATH Open Web Interface contents unavailable due to conflicting licenses')) ])">
<titles>
<title>:unav</title>
</titles>
</xsl:if>
<xsl:apply-templates select="root/source/series/publisher"/>
<xsl:apply-templates select="root/year"/>
<xsl:if test="root/msc[normalize-space(.) != '' and normalize-space(.) != 'None' and normalize-space(.) != 'none' and not(contains(., 'zbMATH Open Web Interface contents unavailable due to conflicting licenses'))]
Expand All @@ -54,7 +70,8 @@ Made by Shiraz Malla Mohamad member of zbmath Team-->
not(contains(., 'zbMATH Open Web Interface contents unavailable due to conflicting licenses'))])
]">
<relatedIdentifiers>
<xsl:apply-templates select="//references"/>
<xsl:apply-templates select="//references"/>
<xsl:apply-templates select="root/links" mode="relatedIdentifiers"/>
</relatedIdentifiers>
</xsl:if>
<!-- Wrap the rights element inside a rightsList element -->
Expand All @@ -76,22 +93,25 @@ Content generated by zbMATH Open, such as reviews, classifications, software, or
</xsl:template>
<!-- Template for processing identifiers -->
<xsl:template match="root/links">
<xsl:choose>
<!-- Process the first 'links' node that has a 'doi' identifier -->
<xsl:when test="self::links[type = 'doi' and normalize-space(identifier) != ''][1]">
<identifier identifierType="DOI">
<xsl:value-of select="identifier"/>
</identifier>
</xsl:when>
<!-- If no 'doi' identifier is present, consider 'arxiv' -->
<xsl:when
test="self::links[type = 'arxiv' and normalize-space(identifier) != ''][1] and not(preceding-sibling::links[type = 'doi' and normalize-space(identifier) != ''])">
<identifier identifierType="ARXIV">
<xsl:value-of select="identifier"/>
</identifier>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:variable name="allDOIs" select="//links[type = 'doi' and normalize-space(identifier) != '']" />
<xsl:variable name="firstDOI" select="$allDOIs[1]" />
<xsl:variable name="allArXiv" select="//links[type = 'arxiv' and normalize-space(identifier) != '']" />
<xsl:variable name="firstArXiv" select="$allArXiv[1]" />
<xsl:choose>
<xsl:when test="self::node()[generate-id() = generate-id($firstDOI)]">
<identifier identifierType="DOI">
<xsl:value-of select="identifier"/>
</identifier>
</xsl:when>
<xsl:when test="not($allDOIs) and self::node()[generate-id() = generate-id($firstArXiv)]">
<identifier identifierType="ARXIV">
<xsl:value-of select="identifier"/>
</identifier>
</xsl:when>
</xsl:choose>
<xsl:apply-templates select="root/links" mode="relatedIdentifiers"/>
</xsl:template>

<!-- Template for processing the rest of the identifiers of our Metadata and considered as alternative identifiers-->
<xsl:template match="identifier">
<xsl:if test="normalize-space(.) != '' and . != 'None' and . != 'none'">
Expand Down Expand Up @@ -157,19 +177,25 @@ Content generated by zbMATH Open, such as reviews, classifications, software, or
</xsl:template>


<!-- Template for processing titles -->
<xsl:template match="title">
<titles>
<title xml:lang="en">
<xsl:choose>
<xsl:when test="normalize-space(.) = '' or normalize-space(.) = 'None' or normalize-space(.) = 'none' or contains(., 'zbMATH Open Web Interface contents unavailable due to conflicting licenses')">:unav</xsl:when>
<xsl:otherwise>
<xsl:value-of select="normalize-space(.)"/>
</xsl:otherwise>
</xsl:choose>
</title>
<xsl:template match="title">
<titles>
<title xml:lang="en">
<xsl:choose>
<xsl:when test="not(title) or

normalize-space(title) = '' or
title = 'None' or
title = 'none' or
contains(title, 'zbMATH Open Web Interface contents unavailable due to conflicting licenses')">
:unav
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="normalize-space(title)"/>
</xsl:otherwise>
</xsl:choose>
</title>
</titles>
</xsl:template>
</xsl:template>


<xsl:template match="publisher">
Expand Down Expand Up @@ -371,6 +397,26 @@ Content generated by zbMATH Open, such as reviews, classifications, software, or
</xsl:choose>
</xsl:template>

<xsl:template match="root/links" mode="relatedIdentifiers">
<xsl:variable name="allDOIs" select="//links[type = 'doi' and normalize-space(identifier) != '']" />
<xsl:variable name="firstDOI" select="$allDOIs[1]" />
<xsl:variable name="allArXiv" select="//links[type = 'arxiv' and normalize-space(identifier) != '']" />
<xsl:variable name="firstArXiv" select="$allArXiv[1]" />

<xsl:if test="type = 'doi' and normalize-space(identifier) != '' and not(generate-id() = generate-id($firstDOI))">
<relatedIdentifier relatedIdentifierType="DOI" relationType="IsPartOf" resourceTypeGeneral="JournalArticle">
<xsl:value-of select="identifier"/>
</relatedIdentifier>
</xsl:if>

<xsl:if test="type = 'arxiv' and normalize-space(identifier) != '' and
(not(generate-id() = generate-id($firstArXiv)) or $allDOIs)">
<relatedIdentifier relatedIdentifierType="ARXIV" relationType="IsPartOf" resourceTypeGeneral="JournalArticle">
<xsl:value-of select="identifier"/>
</relatedIdentifier>
</xsl:if>
</xsl:template>


<!-- Template to match references and transform into relatedItems
each reference has its own relatedItem node and all of its values goes under this node -->
Expand Down