All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 11s
- Updated doi_datacite.xslt to include conditional checks for empty values in creators, titles, subjects, contributors, dates, rights, sizes, formats, descriptions, and geoLocations to ensure only non-empty elements are rendered. - Enhanced the handling of TitleAbstract and TitleAbstractAdditional templates to only output descriptions if the Value attribute is not empty. - Modified the Doi.vue component to clean up the import statements and commented out unused warning display code for clarity.
470 lines
No EOL
20 KiB
HTML
470 lines
No EOL
20 KiB
HTML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!--
|
|
/**
|
|
* This file is part of TETHYS.
|
|
*
|
|
* LICENCE
|
|
* TETHYS is free software; you can redistribute it and/or modify it under the
|
|
* terms of the GNU General Public License as published by the Free Software
|
|
* Foundation; either version 2 of the Licence, or any later version.
|
|
* OPUS is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
* details. You should have received a copy of the GNU General Public License
|
|
* along with OPUS; if not, write to the Free Software Foundation, Inc., 51
|
|
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
*
|
|
* @category Application
|
|
* @package Module_Oai
|
|
* @author Arno Kaimbacher <arno.kaimbacher@geologie.ac.at>
|
|
* @copyright Copyright (c) 2018-2019, GBA TETHYS development team
|
|
* @license http://www.gnu.org/licenses/gpl.html General Public License
|
|
*/
|
|
-->
|
|
|
|
<!--
|
|
/**
|
|
* Transforms the xml representation of an TETHYS model dataset to datacite
|
|
* xml as required by the OAI-PMH protocol.
|
|
*/
|
|
-->
|
|
<xsl:stylesheet version="3.0"
|
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
|
xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
|
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
|
|
|
<xsl:output method="xml" encoding="utf-8" indent="yes" />
|
|
|
|
<xsl:param name="unixTimestamp" />
|
|
<xsl:param name="prefix" />
|
|
<xsl:param name="repIdentifier" />
|
|
|
|
<xsl:template match="Rdr_Dataset">
|
|
<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
xmlns="http://datacite.org/schema/kernel-4" xsi:schemaLocation="http://datacite.org/schema/kernel-4 http://schema.datacite.org/meta/kernel-4.3/metadata.xsd">
|
|
<!-- <isReferenceQuality>true</isReferenceQuality>
|
|
<schemaVersion>4.3</schemaVersion>
|
|
<datacentreSymbol>RDR.GBA</datacentreSymbol> -->
|
|
<xsl:choose>
|
|
<xsl:when test="Identifier">
|
|
<xsl:apply-templates select="Identifier" mode="oai_datacite" />
|
|
</xsl:when>
|
|
<xsl:otherwise>
|
|
<identifier identifierType="DOI">
|
|
<xsl:value-of select="$prefix" />
|
|
<xsl:text>/</xsl:text>
|
|
<xsl:value-of select="$repIdentifier" />
|
|
<xsl:text>.</xsl:text>
|
|
<xsl:value-of select="@PublishId" />
|
|
</identifier>
|
|
</xsl:otherwise>
|
|
</xsl:choose>
|
|
|
|
<!--<datacite:creator>-->
|
|
<xsl:if test="PersonAuthor[normalize-space(concat(@FirstName, @LastName)) != '']">
|
|
<creators>
|
|
<xsl:apply-templates select="PersonAuthor" mode="oai_datacite">
|
|
<xsl:sort select="@SortOrder"/>
|
|
</xsl:apply-templates>
|
|
</creators>
|
|
</xsl:if>
|
|
<xsl:if test="TitleMain[normalize-space(@Value) != ''] or TitleAdditional[normalize-space(@Value) != '']">
|
|
<titles>
|
|
<xsl:apply-templates select="TitleMain" mode="oai_datacite" />
|
|
<xsl:apply-templates select="TitleAdditional" mode="oai_datacite" />
|
|
</titles>
|
|
</xsl:if>
|
|
<publisher>
|
|
<!-- <xsl:value-of select="@PublisherName" /> -->
|
|
<xsl:value-of select="@CreatingCorporation" />
|
|
</publisher>
|
|
<publicationYear>
|
|
<xsl:value-of select="ServerDatePublished/@Year" />
|
|
</publicationYear>
|
|
<xsl:if test="Subject[normalize-space(@Value) != '']">
|
|
<subjects>
|
|
<xsl:apply-templates select="Subject" mode="oai_datacite" />
|
|
</subjects>
|
|
</xsl:if>
|
|
<language>
|
|
<xsl:value-of select="@Language" />
|
|
</language>
|
|
<xsl:if test="PersonContributor[normalize-space(concat(@FirstName, @LastName)) != '']">
|
|
<contributors>
|
|
<xsl:apply-templates select="PersonContributor" mode="oai_datacite">
|
|
<xsl:sort select="@SortOrder"/>
|
|
</xsl:apply-templates>
|
|
</contributors>
|
|
</xsl:if>
|
|
<xsl:if test="(EmbargoDate and ($unixTimestamp < EmbargoDate/@UnixTimestamp)) or CreatedAt">
|
|
<dates>
|
|
<xsl:call-template name="RdrDate2" />
|
|
</dates>
|
|
</xsl:if>
|
|
<version>
|
|
<xsl:choose>
|
|
<xsl:when test="@Version">
|
|
<xsl:value-of select="@Version" />
|
|
</xsl:when>
|
|
<xsl:otherwise>
|
|
<xsl:text>1</xsl:text>
|
|
</xsl:otherwise>
|
|
</xsl:choose>
|
|
</version>
|
|
<resourceType resourceTypeGeneral="Dataset">
|
|
<xsl:text>Dataset</xsl:text>
|
|
<!-- <xsl:value-of select="@Type" /> -->
|
|
</resourceType>
|
|
|
|
<xsl:if test="normalize-space(@landingpage) != ''">
|
|
<alternateIdentifiers>
|
|
<xsl:call-template name="AlternateIdentifier" />
|
|
</alternateIdentifiers>
|
|
</xsl:if>
|
|
|
|
<xsl:if test="Reference[normalize-space(@Type) != '' and normalize-space(@Relation) != '']">
|
|
<relatedIdentifiers>
|
|
<xsl:apply-templates select="Reference" mode="oai_datacite" />
|
|
</relatedIdentifiers>
|
|
</xsl:if>
|
|
<xsl:if test="Licence[normalize-space(@Name) != '' or normalize-space(@Url) != '']">
|
|
<rightsList>
|
|
<xsl:apply-templates select="Licence" mode="oai_datacite" />
|
|
</rightsList>
|
|
</xsl:if>
|
|
<xsl:if test="File">
|
|
<sizes>
|
|
<size>
|
|
<xsl:value-of select="count(File)" />
|
|
<xsl:text> datasets</xsl:text>
|
|
</size>
|
|
</sizes>
|
|
</xsl:if>
|
|
<xsl:if test="File[normalize-space(@MimeType) != '']">
|
|
<formats>
|
|
<xsl:apply-templates select="File/@MimeType" mode="oai_datacite" />
|
|
</formats>
|
|
</xsl:if>
|
|
<xsl:if test="TitleAbstract[normalize-space(@Value) != ''] or TitleAbstractAdditional[normalize-space(@Value) != '']">
|
|
<descriptions>
|
|
<xsl:apply-templates select="TitleAbstract" mode="oai_datacite" />
|
|
<xsl:apply-templates select="TitleAbstractAdditional" mode="oai_datacite" />
|
|
</descriptions>
|
|
</xsl:if>
|
|
<xsl:if test="Coverage[normalize-space(@XMin) != '' and normalize-space(@XMax) != '' and normalize-space(@YMin) != '' and normalize-space(@YMax) != '']">
|
|
<geoLocations>
|
|
<xsl:apply-templates select="Coverage" mode="oai_datacite" />
|
|
</geoLocations>
|
|
</xsl:if>
|
|
</resource>
|
|
</xsl:template>
|
|
|
|
<xsl:template name="RdrDate2"
|
|
xmlns="http://datacite.org/schema/kernel-4">
|
|
<xsl:if test="EmbargoDate and ($unixTimestamp < EmbargoDate/@UnixTimestamp)">
|
|
<date>
|
|
<xsl:attribute name="dateType">Available</xsl:attribute>
|
|
<xsl:variable name="embargoDate" select="concat(
|
|
EmbargoDate/@Year, '-',
|
|
format-number(number(EmbargoDate/@Month),'00'), '-',
|
|
format-number(number(EmbargoDate/@Day),'00')
|
|
)" />
|
|
<xsl:value-of select="$embargoDate" />
|
|
</date>
|
|
</xsl:if>
|
|
<xsl:if test="CreatedAt">
|
|
<date>
|
|
<xsl:attribute name="dateType">Created</xsl:attribute>
|
|
<xsl:variable name="createdAt" select="concat(
|
|
CreatedAt/@Year, '-',
|
|
format-number(number(CreatedAt/@Month),'00'), '-',
|
|
format-number(number(CreatedAt/@Day),'00')
|
|
)" />
|
|
<xsl:value-of select="$createdAt" />
|
|
</date>
|
|
</xsl:if>
|
|
</xsl:template>
|
|
|
|
<xsl:template match="Coverage" mode="oai_datacite"
|
|
xmlns="http://datacite.org/schema/kernel-4">
|
|
<xsl:if test="normalize-space(@XMin) != '' and normalize-space(@XMax) != '' and normalize-space(@YMin) != '' and normalize-space(@YMax) != ''">
|
|
<geoLocation>
|
|
<geoLocationBox>
|
|
<westBoundLongitude><xsl:value-of select="@XMin" /></westBoundLongitude>
|
|
<eastBoundLongitude><xsl:value-of select="@XMax" /></eastBoundLongitude>
|
|
<southBoundLatitude><xsl:value-of select="@YMin" /></southBoundLatitude>
|
|
<northBoundLatitude><xsl:value-of select="@YMax" /></northBoundLatitude>
|
|
</geoLocationBox>
|
|
</geoLocation>
|
|
</xsl:if>
|
|
</xsl:template>
|
|
|
|
<!-- TitleAbstract template -->
|
|
<xsl:template match="TitleAbstract" mode="oai_datacite"
|
|
xmlns="http://datacite.org/schema/kernel-4">
|
|
<xsl:if test="normalize-space(@Value) != ''">
|
|
<description>
|
|
<xsl:attribute name="xml:lang">
|
|
<xsl:value-of select="@Language" />
|
|
</xsl:attribute>
|
|
<xsl:if test="@Type != ''">
|
|
<xsl:attribute name="descriptionType">
|
|
<xsl:text>Abstract</xsl:text>
|
|
</xsl:attribute>
|
|
</xsl:if>
|
|
<xsl:value-of select="@Value" />
|
|
</description>
|
|
</xsl:if>
|
|
</xsl:template>
|
|
|
|
<!-- TitleAbstractAdditional template -->
|
|
<xsl:template match="TitleAbstractAdditional" mode="oai_datacite"
|
|
xmlns="http://datacite.org/schema/kernel-4">
|
|
<xsl:if test="normalize-space(@Value) != ''">
|
|
<description>
|
|
<xsl:attribute name="xml:lang">
|
|
<xsl:value-of select="@Language" />
|
|
</xsl:attribute>
|
|
<xsl:if test="@Type != ''">
|
|
<xsl:attribute name="descriptionType">
|
|
<xsl:call-template name="CamelCaseWord">
|
|
<xsl:with-param name="text" select="@Type" />
|
|
</xsl:call-template>
|
|
</xsl:attribute>
|
|
</xsl:if>
|
|
<xsl:value-of select="@Value" />
|
|
</description>
|
|
</xsl:if>
|
|
</xsl:template>
|
|
|
|
<xsl:template name="CamelCaseWord">
|
|
<xsl:param name="text" />
|
|
<xsl:param name="firstLower" select="true()" />
|
|
<xsl:variable name="Upper">ABCDEFGHIJKLMNOPQRSTUVQXYZ</xsl:variable>
|
|
<xsl:variable name="Lower">abcdefghijklmnopqrstuvwxyz</xsl:variable>
|
|
<xsl:for-each select="tokenize($text,'_')">
|
|
<xsl:choose>
|
|
<xsl:when test="position()=1 and $firstLower = true()">
|
|
<xsl:value-of select="substring(.,1,1)" />
|
|
</xsl:when>
|
|
<xsl:otherwise>
|
|
<xsl:value-of select="translate(substring(.,1,1),$Lower,$Upper)" />
|
|
</xsl:otherwise>
|
|
</xsl:choose>
|
|
<xsl:value-of select="substring(.,2,string-length(.))" />
|
|
</xsl:for-each>
|
|
</xsl:template>
|
|
|
|
<xsl:template match="Identifier" mode="oai_datacite"
|
|
xmlns="http://datacite.org/schema/kernel-4">
|
|
<identifier>
|
|
<xsl:attribute name="identifierType">
|
|
<xsl:text>DOI</xsl:text>
|
|
</xsl:attribute>
|
|
<xsl:value-of select="@Value" />
|
|
</identifier>
|
|
</xsl:template>
|
|
|
|
<xsl:template match="TitleMain" mode="oai_datacite"
|
|
xmlns="http://datacite.org/schema/kernel-4">
|
|
<xsl:if test="normalize-space(@Value) != ''">
|
|
<title>
|
|
<xsl:if test="@Language != ''">
|
|
<xsl:attribute name="xml:lang">
|
|
<xsl:value-of select="@Language" />
|
|
</xsl:attribute>
|
|
</xsl:if>
|
|
<xsl:if test="@Type != '' and @Type != 'Main'">
|
|
<xsl:attribute name="titleType">
|
|
<xsl:value-of select="@Type" />
|
|
</xsl:attribute>
|
|
</xsl:if>
|
|
<xsl:value-of select="@Value" />
|
|
</title>
|
|
</xsl:if>
|
|
</xsl:template>
|
|
|
|
<xsl:template match="TitleAdditional" mode="oai_datacite"
|
|
xmlns="http://datacite.org/schema/kernel-4">
|
|
<xsl:if test="normalize-space(@Value) != ''">
|
|
<title>
|
|
<xsl:if test="@Language != ''">
|
|
<xsl:attribute name="xml:lang">
|
|
<xsl:value-of select="@Language" />
|
|
</xsl:attribute>
|
|
</xsl:if>
|
|
<xsl:choose>
|
|
<xsl:when test="@Type != '' and @Type != 'Sub' and @Type != 'Main'">
|
|
<xsl:attribute name="titleType">
|
|
<xsl:value-of select="@Type" />
|
|
<xsl:text>Title</xsl:text>
|
|
</xsl:attribute>
|
|
</xsl:when>
|
|
<xsl:when test="@Type = 'Sub'">
|
|
<xsl:attribute name="titleType">
|
|
<xsl:value-of select="@Type" />
|
|
<xsl:text>title</xsl:text>
|
|
</xsl:attribute>
|
|
</xsl:when>
|
|
</xsl:choose>
|
|
<xsl:value-of select="@Value" />
|
|
</title>
|
|
</xsl:if>
|
|
</xsl:template>
|
|
|
|
<xsl:template match="Subject" mode="oai_datacite"
|
|
xmlns="http://datacite.org/schema/kernel-4">
|
|
<xsl:if test="normalize-space(@Value) != ''">
|
|
<subject>
|
|
<xsl:if test="@Language != ''">
|
|
<xsl:attribute name="xml:lang">
|
|
<xsl:value-of select="@Language" />
|
|
</xsl:attribute>
|
|
</xsl:if>
|
|
<xsl:value-of select="@Value" />
|
|
</subject>
|
|
</xsl:if>
|
|
</xsl:template>
|
|
|
|
<xsl:template name="AlternateIdentifier" match="AlternateIdentifier" mode="oai_datacite"
|
|
xmlns="http://datacite.org/schema/kernel-4">
|
|
<xsl:if test="normalize-space(@landingpage) != ''">
|
|
<alternateIdentifier>
|
|
<xsl:attribute name="alternateIdentifierType">
|
|
<xsl:text>url</xsl:text>
|
|
</xsl:attribute>
|
|
<xsl:value-of select="@landingpage" />
|
|
</alternateIdentifier>
|
|
</xsl:if>
|
|
</xsl:template>
|
|
|
|
<xsl:template match="Reference" mode="oai_datacite"
|
|
xmlns="http://datacite.org/schema/kernel-4">
|
|
<xsl:if test="normalize-space(@Type) != '' and normalize-space(@Relation) != ''">
|
|
<relatedIdentifier>
|
|
<xsl:attribute name="relatedIdentifierType">
|
|
<xsl:value-of select="@Type" />
|
|
</xsl:attribute>
|
|
<xsl:attribute name="relationType">
|
|
<xsl:value-of select="@Relation" />
|
|
</xsl:attribute>
|
|
<xsl:value-of select="@Value" />
|
|
</relatedIdentifier>
|
|
</xsl:if>
|
|
</xsl:template>
|
|
|
|
<!-- PersonContributor template -->
|
|
<xsl:template match="PersonContributor" mode="oai_datacite"
|
|
xmlns="http://datacite.org/schema/kernel-4">
|
|
<xsl:if test="normalize-space(concat(@FirstName, @LastName)) != ''">
|
|
<contributor>
|
|
<xsl:if test="@ContributorType != ''">
|
|
<xsl:attribute name="contributorType">
|
|
<xsl:value-of select="@ContributorType" />
|
|
</xsl:attribute>
|
|
</xsl:if>
|
|
<contributorName>
|
|
<!-- <xsl:if test="@NameType != ''">
|
|
<xsl:attribute name="nameType">
|
|
<xsl:value-of select="@NameType" />
|
|
</xsl:attribute>
|
|
</xsl:if> -->
|
|
<xsl:value-of select="concat(@FirstName, ' ', @LastName)" />
|
|
</contributorName>
|
|
</contributor>
|
|
</xsl:if>
|
|
</xsl:template>
|
|
|
|
<xsl:template match="PersonAuthor" mode="oai_datacite"
|
|
xmlns="http://datacite.org/schema/kernel-4">
|
|
<creator>
|
|
<creatorName>
|
|
<xsl:if test="@NameType != ''">
|
|
<xsl:attribute name="nameType">
|
|
<xsl:value-of select="@NameType" />
|
|
</xsl:attribute>
|
|
</xsl:if>
|
|
<xsl:value-of select="@LastName" />
|
|
<xsl:if test="@FirstName != ''">
|
|
<xsl:text>, </xsl:text>
|
|
</xsl:if>
|
|
<xsl:value-of select="@FirstName" />
|
|
<xsl:if test="@AcademicTitle != ''">
|
|
<xsl:text> (</xsl:text>
|
|
<xsl:value-of select="@AcademicTitle" />
|
|
<xsl:text>)</xsl:text>
|
|
</xsl:if>
|
|
</creatorName>
|
|
|
|
<xsl:if test="@NameType = 'Personal'">
|
|
<givenName>
|
|
<xsl:value-of select="@FirstName" />
|
|
</givenName>
|
|
<familyName>
|
|
<xsl:value-of select="@LastName" />
|
|
</familyName>
|
|
<xsl:if test="@IdentifierOrcid != ''">
|
|
<nameIdentifier schemeURI="http://orcid.org/" nameIdentifierScheme="ORCID">
|
|
<xsl:value-of select="@IdentifierOrcid" />
|
|
</nameIdentifier>
|
|
</xsl:if>
|
|
<affiliation>GBA</affiliation>
|
|
</xsl:if>
|
|
|
|
<xsl:if test="@NameType = 'Organizational'">
|
|
<xsl:if test="@IdentifierOrcid != ''">
|
|
<nameIdentifier schemeURI="http://orcid.org/" nameIdentifierScheme="ORCID">
|
|
<xsl:value-of select="@IdentifierOrcid" />
|
|
</nameIdentifier>
|
|
</xsl:if>
|
|
</xsl:if>
|
|
<!--
|
|
<nameType><xsl:value-of select="@NameType" /></nameType>
|
|
</xsl:if> -->
|
|
|
|
</creator>
|
|
</xsl:template>
|
|
|
|
<xsl:template match="File/@MimeType" mode="oai_datacite"
|
|
xmlns="http://datacite.org/schema/kernel-4">
|
|
<xsl:if test="normalize-space(.) != ''">
|
|
<format>
|
|
<xsl:value-of select="." />
|
|
</format>
|
|
</xsl:if>
|
|
</xsl:template>
|
|
|
|
<xsl:template match="Licence" mode="oai_datacite"
|
|
xmlns="http://datacite.org/schema/kernel-4">
|
|
<rights>
|
|
<xsl:attribute name="xml:lang">
|
|
<xsl:value-of select="@Language" />
|
|
</xsl:attribute>
|
|
<xsl:if test="@LinkLicence != ''">
|
|
<xsl:attribute name="rightsURI">
|
|
<xsl:value-of select="@LinkLicence" />
|
|
</xsl:attribute>
|
|
</xsl:if>
|
|
<xsl:attribute name="schemeURI">
|
|
<xsl:text>https://spdx.org/licenses/</xsl:text>
|
|
</xsl:attribute>
|
|
<xsl:attribute name="rightsIdentifierScheme">
|
|
<xsl:text>SPDX</xsl:text>
|
|
</xsl:attribute>
|
|
<xsl:attribute name="rightsIdentifier">
|
|
<xsl:value-of select="@Name" />
|
|
</xsl:attribute>
|
|
<xsl:value-of select="@NameLong" />
|
|
</rights>
|
|
<xsl:if test="@Name = 'CC-BY-4.0' or @Name = 'CC-BY-SA-4.0'">
|
|
<rights>
|
|
<xsl:attribute name="rightsURI">
|
|
<xsl:text>info:eu-repo/semantics/openAccess</xsl:text>
|
|
</xsl:attribute>
|
|
<xsl:text>Open Access</xsl:text>
|
|
</rights>
|
|
</xsl:if>
|
|
</xsl:template>
|
|
|
|
</xsl:stylesheet> |