Skip to content

Commit f3d8c8c

Browse files
Add correct doi placeholder, add xslt stylesheet example, add doi prefix documentation in config.TEMPLATE.js
1 parent 9b758ed commit f3d8c8c

File tree

3 files changed

+95
-3
lines changed

3 files changed

+95
-3
lines changed

build/webhooks/register-doi.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ async function registerDoiForObject(dbObject, easyDbOpts, dataciteOpts) {
8585
let metadataXml = await fetch(metadataUrl).then(resp => resp.text());
8686
log(`Got metadata for ${dbObject._uuid}`);
8787
//TODO find better placeholder string
88-
metadataXml = metadataXml.replace('10.xxx', doiPrefix);
88+
metadataXml = metadataXml.replace('___DOI_PLACEHOLDER___', doi);
8989

9090
const dataciteMetadataUrl = dataciteEndpoint + '/metadata/' + doi;
9191
log(`PUT metadata to ${dataciteMetadataUrl}`);

config.TEMPLATE.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,16 @@ module.exports = {
1515
username: 'datacite-api-user',
1616
password: 'anotherpassword',
1717
endpoint: 'https://mds.test.datacite.org',
18-
doiPrefix: '10.5072/'
18+
// Doi will be built like this "<doiPrefix><systemObjectID>", e.g.,
19+
// given the following prefix and systemObjectID = 1234:
20+
// 10.5072/abc.1234
21+
doiPrefix: '10.5072/abc.'
1922
},
2023
ubhd: {
2124
username: 'another-datacite-api-user',
2225
password: 'onemorepassword',
2326
endpoint: 'https://mds.datacite.org',
24-
doiPrefix: '10.xxxx/abc'
27+
doiPrefix: '10.xxxx/abc.'
2528
}
2629
}
2730
}

xslt/heidicon2datacite.xsl

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://datacite.org/schema/kernel-4">
3+
<xsl:output method="xml" encoding="utf-8"/>
4+
5+
<xsl:template match="/">
6+
<resource
7+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
8+
xsi:schemaLocation="http://datacite.org/schema/kernel-4 http://schema.datacite.org/meta/kernel-4.1/metadata.xsd">
9+
<xsl:apply-templates select="//objects/objekte" />
10+
</resource>
11+
</xsl:template>
12+
13+
<xsl:template match="objekte">
14+
<identifier identifierType="DOI">___DOI_PLACEHOLDER___</identifier>
15+
<xsl:if test="count(_nested__objekte__obj_autoren/objekte__obj_autoren) or count(_nested__objekte__obj_autoren_lok/objekte__obj_autoren_lok)">
16+
<creators>
17+
<xsl:for-each select="_nested__objekte__obj_autoren/objekte__obj_autoren">
18+
<creator>
19+
<creatorName nameType="Personal"><xsl:value-of select="custom/string[@name='conceptName']" /></creatorName>
20+
</creator>
21+
</xsl:for-each>
22+
<xsl:for-each select="_nested__objekte__obj_autoren_lok/objekte__obj_autoren_lok">
23+
<creator>
24+
<xsl:choose>
25+
<!-- TODO: Bessere Unterstützung Mehrsprachigkeit -->
26+
<xsl:when test="obj_autor_lok/lokal_klass_person/_standard/de-DE">
27+
<creatorName nameType="Personal"><xsl:value-of select="obj_autor_lok/lokal_klass_person/_standard/de-DE" /></creatorName>
28+
</xsl:when>
29+
<xsl:otherwise>
30+
<creatorName nameType="Personal"><xsl:value-of select="obj_autor_lok/lokal_klass_person/_standard/en-US" /></creatorName>
31+
</xsl:otherwise>
32+
</xsl:choose>
33+
</creator>
34+
</xsl:for-each>
35+
</creators>
36+
</xsl:if>
37+
<titles>
38+
<xsl:if test="obj_titel/de-DE and string-length(obj_titel/de-DE)"><title xml:lang="de-DE"><xsl:value-of select="obj_titel/de-DE" /></title></xsl:if>
39+
<xsl:if test="obj_titel/en-US and string-length(obj_titel/en-US)"><title xml:lang="en-US"><xsl:value-of select="obj_titel/en-US" /></title></xsl:if>
40+
<!-- TODO: Weitere Titel -->
41+
</titles>
42+
<publisher>heidICON, Heidelberg University Library</publisher>
43+
<publicationYear><xsl:value-of select="substring(_last_modified,1,4)" /></publicationYear>
44+
<xsl:if test="count(_nested__objekte__obj_schlagworte/objekte__obj_schlagworte) or count(_nested__objekte__obj_schlagworte_lok/objekte__obj_schlagworte_lok)">
45+
<subjects>
46+
<xsl:for-each select="_nested__objekte__obj_schlagworte/objekte__obj_schlagworte">
47+
<subject xml:lang="de-DE"><xsl:value-of select="custom/string[@name='conceptName']" /></subject>
48+
</xsl:for-each>
49+
<xsl:for-each select="_nested__objekte__obj_schlagworte_lok/objekte__obj_schlagworte_lok">
50+
<xsl:if test="obj_schlagwort_lok/lokal_klass_sach/_standard/de-DE and string-length(obj_schlagwort_lok/lokal_klass_sach/_standard/de-DE)"><subject><xsl:value-of select="obj_schlagwort_lok/lokal_klass_sach/_standard/de-DE" /></subject></xsl:if>
51+
<xsl:if test="obj_schlagwort_lok/lokal_klass_sach/_standard/en-US and string-length(obj_schlagwort_lok/lokal_klass_sach/_standard/en-US)"><subject><xsl:value-of select="obj_schlagwort_lok/lokal_klass_sach/_standard/en-US" /></subject></xsl:if>
52+
</xsl:for-each>
53+
</subjects>
54+
</xsl:if>
55+
<xsl:call-template name="asset">
56+
<xsl:with-param name="assetnode" select="_reverse_nested__ressourcen__lk_objekt_id/*[local-name()='ressourcen'][1]/asset" />
57+
</xsl:call-template>
58+
<xsl:if test="obj_beschreibung and string-length(obj_beschreibung)">
59+
<descriptions>
60+
<xsl:if test="obj_beschreibung/de-DE and string-length(obj_beschreibung/de-DE)"><description xml:lang="de-DE" descriptionType="Abstract"><xsl:value-of select="obj_beschreibung/de-DE" /></description></xsl:if>
61+
<xsl:if test="obj_beschreibung/en-US and string-length(obj_beschreibung/en-US)"><description xml:lang="en-US" descriptionType="Abstract"><xsl:value-of select="obj_beschreibung/en-US" /></description></xsl:if>
62+
</descriptions>
63+
</xsl:if>
64+
</xsl:template>
65+
66+
<xsl:template match="ressourcen">
67+
<titles>
68+
<xsl:if test="lk_objekt_id/objekte/_standard/de-DE and string-length(lk_objekt_id/objekte/_standard/de-DE)"><title xml:lang="de-DE"><xsl:value-of select="lk_objekt_id/objekte/_standard/de-DE" /></title></xsl:if>
69+
<xsl:if test="lk_objekt_id/objekte/_standard/en-US and string-length(lk_objekt_id/objekte/_standard/en-US)"><title xml:lang="en-US"><xsl:value-of select="lk_objekt_id/objekte/_standard/en-US" /></title></xsl:if>
70+
<!-- TODO: Weitere Titel -->
71+
</titles>
72+
<xsl:call-template name="asset">
73+
<xsl:with-param name="assetnode" select="asset" />
74+
</xsl:call-template>
75+
</xsl:template>
76+
77+
<xsl:template name="asset">
78+
<xsl:param name="assetnode" />
79+
<resourceType>
80+
<xsl:choose>
81+
<xsl:when test="$assetnode/files/*[local-name()='file'][1]/class='image'"><xsl:attribute name="resourceTypeGeneral">Image</xsl:attribute>Image</xsl:when>
82+
<xsl:when test="$assetnode/files/*[local-name()='file'][1]/class='audio'"><xsl:attribute name="resourceTypeGeneral">Sound</xsl:attribute>Audio</xsl:when>
83+
<xsl:when test="$assetnode/files/*[local-name()='file'][1]/class='video'"><xsl:attribute name="resourceTypeGeneral">Audiovisual</xsl:attribute>Video</xsl:when>
84+
<xsl:when test="$assetnode/files/*[local-name()='file'][1]/class='office'"><xsl:attribute name="resourceTypeGeneral">Text</xsl:attribute>Text/Office</xsl:when>
85+
<xsl:otherwise><xsl:attribute name="resourceTypeGeneral">Other</xsl:attribute>Other</xsl:otherwise>
86+
</xsl:choose>
87+
</resourceType>
88+
</xsl:template>
89+
</xsl:stylesheet>

0 commit comments

Comments
 (0)