mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
115693: Pass doi metadatafield with xsl parameters
(cherry picked from commit 9e11e1f9ae
)
This commit is contained in:

committed by
github-actions[bot]
![github-actions[bot]](/assets/img/avatar_default.png)
parent
d240a16b05
commit
c1be5f8e4e
@@ -70,7 +70,6 @@ public class DOIIdentifierProvider extends FilteredIdentifierProvider {
|
||||
static final char SLASH = '/';
|
||||
|
||||
// Metadata field name elements
|
||||
// Warning: If this metadata field is changed for whatever reason, DIM2DataCite.xsl's template needs to reflect this
|
||||
// TODO: move these to MetadataSchema or some such?
|
||||
public static final String MD_SCHEMA = "dc";
|
||||
public static final String DOI_ELEMENT = "identifier";
|
||||
|
@@ -7,6 +7,10 @@
|
||||
*/
|
||||
package org.dspace.identifier.doi;
|
||||
|
||||
import static org.dspace.identifier.DOIIdentifierProvider.DOI_ELEMENT;
|
||||
import static org.dspace.identifier.DOIIdentifierProvider.DOI_QUALIFIER;
|
||||
import static org.dspace.identifier.DOIIdentifierProvider.MD_SCHEMA;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
@@ -386,6 +390,10 @@ public class DataCiteConnector
|
||||
parameters.put("hostinginstitution",
|
||||
configurationService.getProperty(CFG_HOSTINGINSTITUTION));
|
||||
}
|
||||
parameters.put("mdSchema", MD_SCHEMA);
|
||||
parameters.put("mdElement", DOI_ELEMENT);
|
||||
// Pass an empty string for qualifier if the metadata field doesn't have any
|
||||
parameters.put("mdQualifier", DOI_QUALIFIER);
|
||||
|
||||
Element root = null;
|
||||
try {
|
||||
|
@@ -36,6 +36,10 @@
|
||||
<xsl:param name="hostinginstitution"><xsl:value-of select="$publisher" /></xsl:param>
|
||||
<!-- Please take a look into the DataCite schema documentation if you want to know how to use these elements.
|
||||
http://schema.datacite.org -->
|
||||
<!-- Metadata-field to retrieve DOI from items -->
|
||||
<xsl:param name="mdSchema">dc</xsl:param>
|
||||
<xsl:param name="mdElement">identifier</xsl:param>
|
||||
<xsl:param name="mdQualifier">uri</xsl:param>
|
||||
|
||||
<xsl:output method="xml" indent="yes" encoding="utf-8" />
|
||||
|
||||
@@ -333,16 +337,17 @@
|
||||
company as well. We have to ensure to use URIs of our prefix
|
||||
as primary identifiers only.
|
||||
-->
|
||||
<!-- Warning: If the metadata field changes for whatever reason, DOIIdentifierProvider needs to reflect this -->
|
||||
<xsl:template match="dspace:field[@mdschema='dc' and @element='identifier' and @qualifier='uri' and (contains(., $prefix))]">
|
||||
<identifier identifierType="DOI">
|
||||
<xsl:if test="starts-with(string(text()), 'https://doi.org/')">
|
||||
<xsl:value-of select="substring(., 17)"/>
|
||||
</xsl:if>
|
||||
<xsl:if test="starts-with(string(text()), 'http://dx.doi.org/')">
|
||||
<xsl:value-of select="substring(., 19)"/>
|
||||
</xsl:if>
|
||||
</identifier>
|
||||
<xsl:template match="dspace:field[@mdschema=$mdSchema and @element=$mdElement and (contains(., $prefix))]">
|
||||
<xsl:if test="(($mdQualifier and $mdQualifier != '') and @qualifier=$mdQualifier) or ((not($mdQualifier) or $mdQualifier = '') and not(@qualifier))">
|
||||
<identifier identifierType="DOI">
|
||||
<xsl:if test="starts-with(string(text()), 'https://doi.org/')">
|
||||
<xsl:value-of select="substring(., 17)"/>
|
||||
</xsl:if>
|
||||
<xsl:if test="starts-with(string(text()), 'http://dx.doi.org/')">
|
||||
<xsl:value-of select="substring(., 19)"/>
|
||||
</xsl:if>
|
||||
</identifier>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<!-- DataCite (2) :: Creator -->
|
||||
|
Reference in New Issue
Block a user