1
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
2
|
xmlns:datacite="http://datacite.org/schema/kernel-3"
|
3
|
xmlns:datetime="http://exslt.org/dates-and-times" xmlns:exslt="http://exslt.org/common"
|
4
|
xmlns:oai="http://www.openarchives.org/OAI/2.0/"
|
5
|
xmlns:dri="http://www.driver-repository.eu/namespace/dri"
|
6
|
xmlns:dnet="eu.dnetlib.miscutils.functional.xml.DnetXsltFunctions"
|
7
|
xmlns:oaf="http://namespace.dnet.eu/oaf"
|
8
|
exclude-result-prefixes="xsl datetime exslt dnet"
|
9
|
version="2.0">
|
10
|
|
11
|
<xsl:output method="xml" indent="yes"/>
|
12
|
<xsl:variable name="namespacePrefix">
|
13
|
<xsl:value-of select="string('dli_resolver')"/>
|
14
|
</xsl:variable>
|
15
|
<xsl:template match="/">
|
16
|
<xsl:choose>
|
17
|
<xsl:when test="//datacite:resource">
|
18
|
<xsl:call-template name="dataset">
|
19
|
<xsl:with-param name="metadata">
|
20
|
<xsl:value-of select="//*[local-name()='metadata']"/>
|
21
|
</xsl:with-param>
|
22
|
</xsl:call-template>
|
23
|
</xsl:when>
|
24
|
<xsl:when test="//oaf:pid">
|
25
|
<xsl:call-template name="publication">
|
26
|
<xsl:with-param name="metadata">
|
27
|
<xsl:value-of select="//*[local-name()='metadata']"/>
|
28
|
</xsl:with-param>
|
29
|
</xsl:call-template>
|
30
|
</xsl:when>
|
31
|
<xsl:otherwise>
|
32
|
<JUNK/>
|
33
|
</xsl:otherwise>
|
34
|
</xsl:choose>
|
35
|
</xsl:template>
|
36
|
<xsl:template name="dataset">
|
37
|
<xsl:param name="metadata"/>
|
38
|
<xsl:variable name="datestamp" select="datetime:dateTime()"/>
|
39
|
<xsl:variable name="evaluatedId" select="normalize-space(//datacite:identifier/text())"/>
|
40
|
<xsl:variable name="evaluatedIdType" select="normalize-space(//datacite:identifier/@identifierType)"/>
|
41
|
<xsl:variable name="generatedIDataset" select="concat($evaluatedId, '::', $evaluatedIdType)"/>
|
42
|
|
43
|
<oai:record xmlns:oai="http://www.openarchives.org/OAI/2.0/"
|
44
|
xmlns:dri="http://www.driver-repository.eu/namespace/dri">
|
45
|
<oai:header>
|
46
|
<dri:objIdentifier>
|
47
|
<xsl:value-of select="concat($namespacePrefix,'::', dnet:md5($generatedIDataset))"/>
|
48
|
</dri:objIdentifier>
|
49
|
<dri:recordIdentifier>
|
50
|
<xsl:value-of select="$generatedIDataset"/>
|
51
|
</dri:recordIdentifier>
|
52
|
<dri:dateOfCollection>
|
53
|
<xsl:value-of select="$datestamp"/>
|
54
|
</dri:dateOfCollection>
|
55
|
<dri:repositoryId>
|
56
|
<xsl:value-of select="$namespacePrefix"/>
|
57
|
</dri:repositoryId>
|
58
|
<dri:datasourceprefix>
|
59
|
<xsl:value-of select="$namespacePrefix"/>
|
60
|
</dri:datasourceprefix>
|
61
|
</oai:header>
|
62
|
<xsl:copy-of select=".//*[local-name()='metadata']"/>
|
63
|
<xsl:copy-of select=".//oaf:about"/>
|
64
|
|
65
|
</oai:record>
|
66
|
</xsl:template>
|
67
|
|
68
|
<xsl:template name="publication">
|
69
|
<xsl:param name="metadata"/>
|
70
|
<xsl:variable name="datestamp" select="datetime:dateTime()"/>
|
71
|
<xsl:variable name="evaluatedId" select="normalize-space(//oaf:pid)"/>
|
72
|
<xsl:variable name="evaluatedIdType" select="normalize-space(//oaf:pid/@type)"/>
|
73
|
<xsl:variable name="generatedIDPublication" select="concat($evaluatedId, '::', $evaluatedIdType)"/>
|
74
|
|
75
|
<oai:record xmlns:oai="http://www.openarchives.org/OAI/2.0/"
|
76
|
xmlns:dri="http://www.driver-repository.eu/namespace/dri">
|
77
|
<oai:header>
|
78
|
<dri:objIdentifier>
|
79
|
<xsl:value-of select="concat($namespacePrefix,'::', dnet:md5($generatedIDPublication))"/>
|
80
|
</dri:objIdentifier>
|
81
|
<dri:recordIdentifier>
|
82
|
<xsl:value-of select="$generatedIDPublication"/>
|
83
|
</dri:recordIdentifier>
|
84
|
<dri:dateOfCollection>
|
85
|
<xsl:value-of select="$datestamp"/>
|
86
|
</dri:dateOfCollection>
|
87
|
<dri:repositoryId>
|
88
|
<xsl:value-of select="$namespacePrefix"/>
|
89
|
</dri:repositoryId>
|
90
|
<dri:datasourceprefix>
|
91
|
<xsl:value-of select="$namespacePrefix"/>
|
92
|
</dri:datasourceprefix>
|
93
|
</oai:header>
|
94
|
<xsl:copy-of select=".//*[local-name()='metadata']"/>
|
95
|
<xsl:copy-of select=".//oaf:about"/>
|
96
|
</oai:record>
|
97
|
</xsl:template>
|
98
|
|
99
|
|
100
|
</xsl:stylesheet>
|