1
|
<RESOURCE_PROFILE>
|
2
|
<HEADER>
|
3
|
<RESOURCE_IDENTIFIER value="42569418-ac28-4e77-a38f-78b168def51a_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
|
4
|
<RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
|
5
|
<RESOURCE_KIND value="TransformationRuleDSResources"/>
|
6
|
<RESOURCE_URI value=""/>
|
7
|
<DATE_OF_CREATION value="2017-06-30T17:01:32+02:00"/>
|
8
|
</HEADER>
|
9
|
<BODY>
|
10
|
<CONFIGURATION>
|
11
|
<IMPORTED/>
|
12
|
<SCRIPT>
|
13
|
<TITLE>claims_datacite_2_ODF</TITLE>
|
14
|
<CODE><![CDATA[
|
15
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
|
16
|
xmlns:oai="http://www.openarchives.org/OAI/2.0/" xmlns:oaf="http://namespace.openaire.eu/oaf"
|
17
|
xmlns:dri="http://www.driver-repository.eu/namespace/dri"
|
18
|
xmlns:dr="http://www.driver-repository.eu/namespace/dr"
|
19
|
xmlns:TransformationFunction="eu.dnetlib.data.collective.transformation.core.xsl.ext.TransformationFunctionProxy"
|
20
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
21
|
xmlns:date="http://exslt.org/dates-and-times" extension-element-prefixes="date TransformationFunction"
|
22
|
exclude-result-prefixes="xsl TransformationFunction">
|
23
|
|
24
|
<xsl:output indent="yes"/>
|
25
|
|
26
|
<xsl:variable name="tf" select="TransformationFunction:getInstance()"/>
|
27
|
<xsl:template match="/">
|
28
|
<xsl:choose>
|
29
|
<xsl:when test="string-length(//*[local-name() ='objIdentifier']) = 46 and matches(//*[local-name() ='objIdentifier'], '\w{12}')">
|
30
|
<xsl:call-template name="createRecord"/>
|
31
|
</xsl:when>
|
32
|
<xsl:otherwise>
|
33
|
<xsl:call-template name="skipRecord"/>
|
34
|
</xsl:otherwise>
|
35
|
</xsl:choose>
|
36
|
|
37
|
</xsl:template>
|
38
|
|
39
|
<xsl:template name="skipRecord">
|
40
|
<oai:record>
|
41
|
<oai:header>
|
42
|
<xsl:copy-of select="//*[local-name() = 'header']/dri:dateOfCollection"
|
43
|
copy-namespaces="no"/>
|
44
|
<xsl:copy-of select="//*[local-name() = 'header']/oaf:datasourceprefix"
|
45
|
copy-namespaces="no"/>
|
46
|
<dri:recordIdentifier>
|
47
|
<xsl:value-of select="//*[local-name() = 'header']/dri:objIdentifier"/>
|
48
|
</dri:recordIdentifier>
|
49
|
<dr:dateOfTransformation>
|
50
|
<xsl:value-of select="date:date-time()"/>
|
51
|
</dr:dateOfTransformation>
|
52
|
</oai:header>
|
53
|
<oai:metadata>
|
54
|
<xsl:copy-of select="//*[local-name() = 'metadata']/*"/>
|
55
|
</oai:metadata>
|
56
|
</oai:record>
|
57
|
</xsl:template>
|
58
|
|
59
|
<xsl:template name="createRecord">
|
60
|
<oai:record>
|
61
|
<oai:header>
|
62
|
<xsl:copy-of select="//*[local-name() = 'header']/dri:recordIdentifier" copy-namespaces="no"/>
|
63
|
<xsl:copy-of select="//*[local-name() = 'header']/dri:dateOfCollection" copy-namespaces="no"/>
|
64
|
<xsl:copy-of select="//*[local-name() = 'header']/oaf:datasourceprefix" copy-namespaces="no"/>
|
65
|
<dri:objIdentifier><xsl:value-of select="//*[local-name() = 'header']/*[local-name() ='objIdentifier']"/></dri:objIdentifier>
|
66
|
<dr:dateOfTransformation>
|
67
|
<xsl:value-of select="date:date-time()"/>
|
68
|
</dr:dateOfTransformation>
|
69
|
</oai:header>
|
70
|
<oai:metadata>
|
71
|
<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
72
|
xsi:schemaLocation="http://datacite.org/schema/kernel-3 http://schema.datacite.org/meta/kernel-3/metadata.xsd"
|
73
|
xmlns="http://datacite.org/schema/kernel-3">
|
74
|
<identifier identifierType="URL">
|
75
|
<xsl:value-of select="//metadata/data/id"/>
|
76
|
</identifier>
|
77
|
<alternateIdentifiers>
|
78
|
<alternateIdentifier alternateIdentifierType="doi">
|
79
|
<xsl:value-of select="//metadata/data/attributes/doi"/>
|
80
|
</alternateIdentifier>
|
81
|
</alternateIdentifiers>
|
82
|
<creators>
|
83
|
<xsl:for-each select="//metadata/data/attributes/author">
|
84
|
<xsl:choose>
|
85
|
<xsl:when test="string-length(concat(./family, ./given)) > 0">
|
86
|
<creator>
|
87
|
<creatorName>
|
88
|
<xsl:value-of select="concat(./family, ', ', ./given)"/>
|
89
|
</creatorName>
|
90
|
</creator>
|
91
|
</xsl:when>
|
92
|
<xsl:otherwise>
|
93
|
<xsl:for-each select="tokenize(./literal,';')">
|
94
|
<creator>
|
95
|
<creatorName><xsl:value-of select="normalize-space(.)"/></creatorName>
|
96
|
</creator>
|
97
|
</xsl:for-each>
|
98
|
</xsl:otherwise>
|
99
|
</xsl:choose>
|
100
|
</xsl:for-each>
|
101
|
</creators>
|
102
|
<titles>
|
103
|
<xsl:for-each select="//metadata/data/attributes/title">
|
104
|
<title><xsl:value-of select="./text()"/></title>
|
105
|
</xsl:for-each>
|
106
|
</titles>
|
107
|
<publisher><xsl:value-of select="//metadata/data/attributes/container-title"/></publisher>
|
108
|
<dates>
|
109
|
<date dateType="Accepted"><xsl:value-of select="//metadata/data/attributes/deposited"/></date>
|
110
|
<date dateType="Issued"><xsl:value-of select="//metadata/data/attributes/published"/></date>
|
111
|
</dates>
|
112
|
<resourceType resourceTypeGeneral="{//metadata/data/attributes/resource-type-id}">
|
113
|
<xsl:value-of select="//metadata/data/attributes/resource-type-subtype"/>
|
114
|
</resourceType>
|
115
|
<descriptions>
|
116
|
<xsl:for-each select="//metadata/data/attributes/description">
|
117
|
<description descriptionType="Abstract"><xsl:value-of select="./text()"/></description>
|
118
|
</xsl:for-each>
|
119
|
</descriptions>
|
120
|
</resource>
|
121
|
<xsl:variable name="subType">
|
122
|
<xsl:choose>
|
123
|
<xsl:when test="//metadata/data/attributes/resource-type-subtype = 'null'">
|
124
|
<xsl:value-of select="TransformationFunction:convertString($tf, //metadata/data/attributes/resource-type-id, 'TextTypologies')"/>
|
125
|
</xsl:when>
|
126
|
<xsl:otherwise>
|
127
|
<xsl:value-of select="TransformationFunction:convertString($tf, //metadata/data/attributes/resource-type-subtype, 'TextTypologies')"/>
|
128
|
</xsl:otherwise>
|
129
|
</xsl:choose>
|
130
|
</xsl:variable>
|
131
|
<xsl:variable name="superType" select="TransformationFunction:convertString($tf, $subType, 'SuperTypes')" />
|
132
|
<dr:CobjCategory type="{$superType}">
|
133
|
<xsl:value-of select="$subType"/>
|
134
|
</dr:CobjCategory>
|
135
|
<oaf:hostedBy id="openaire____::1256f046-bf1f-4afc-8b47-d0b147148b18" name="Unknown Repository"/>
|
136
|
<oaf:collectedFrom id="openaire____::datacite" name="Datacite"/>
|
137
|
<xsl:variable name="thelicense" select="//metadata/data/attributes/license"/>
|
138
|
<oaf:accessrights>
|
139
|
<xsl:choose>
|
140
|
<xsl:when test="starts-with($thelicense, 'info:eu-repo/semantics/')">
|
141
|
<xsl:value-of select="TransformationFunction:convertString($tf, $thelicense, 'AccessRights')" />
|
142
|
</xsl:when>
|
143
|
<xsl:when test="//*[local-name() = 'metadata']/oaf:accessrights/text() != ''"><xsl:value-of select="//*[local-name() = 'metadata']/oaf:accessrights/text()"/></xsl:when>
|
144
|
<xsl:when test="contains(//metadata/data/attributes/license, 'creativecommons.org')"><xsl:value-of select="string('OPEN')"/></xsl:when>
|
145
|
<xsl:otherwise><xsl:value-of select="string('UNKNOWN')"/></xsl:otherwise>
|
146
|
</xsl:choose>
|
147
|
</oaf:accessrights>
|
148
|
<oaf:license><xsl:value-of select="$thelicense"/></oaf:license>
|
149
|
<xsl:copy-of select="//*[local-name() = 'metadata']/oaf:*" copy-namespaces="no"></xsl:copy-of>
|
150
|
</oai:metadata>
|
151
|
<xsl:copy-of select="//*[local-name() = 'about']" copy-namespaces="no"/>
|
152
|
</oai:record>
|
153
|
</xsl:template>
|
154
|
</xsl:stylesheet>
|
155
|
]]></CODE>
|
156
|
</SCRIPT>
|
157
|
</CONFIGURATION>
|
158
|
<STATUS/>
|
159
|
<SECURITY_PARAMETERS/>
|
160
|
</BODY>
|
161
|
</RESOURCE_PROFILE>
|