1
|
<RESOURCE_PROFILE>
|
2
|
<HEADER>
|
3
|
<RESOURCE_IDENTIFIER value="c65bf3ca-1a77-42c4-92a1-f902a4d752a7_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_openaire_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:dc="http://purl.org/dc/elements/1.1/" xmlns:date="http://exslt.org/dates-and-times"
|
20
|
extension-element-prefixes="date" exclude-result-prefixes="xsl">
|
21
|
|
22
|
<xsl:output indent="yes"/>
|
23
|
|
24
|
<xsl:template match="/">
|
25
|
<xsl:choose>
|
26
|
<xsl:when test="string-length(//*[local-name() ='objIdentifier']) = 46 and matches(//*[local-name() ='objIdentifier'], '\w{12}') and (//instance/webresource/url != '' or //pid[@classid = 'doi'] != '')">
|
27
|
<xsl:call-template name="createRecord"/>
|
28
|
</xsl:when>
|
29
|
<xsl:otherwise>
|
30
|
<xsl:call-template name="skipRecord"/>
|
31
|
</xsl:otherwise>
|
32
|
</xsl:choose>
|
33
|
|
34
|
</xsl:template>
|
35
|
|
36
|
<xsl:template name="skipRecord">
|
37
|
<oai:record>
|
38
|
<oai:header>
|
39
|
<xsl:copy-of select="//*[local-name() = 'header']/dri:dateOfCollection"
|
40
|
copy-namespaces="no"/>
|
41
|
<xsl:copy-of select="//*[local-name() = 'header']/oaf:datasourceprefix"
|
42
|
copy-namespaces="no"/>
|
43
|
<dri:recordIdentifier>
|
44
|
<xsl:value-of select="//*[local-name() = 'header']/dri:objIdentifier"/>
|
45
|
</dri:recordIdentifier>
|
46
|
<dr:dateOfTransformation>
|
47
|
<xsl:value-of select="date:date-time()"/>
|
48
|
</dr:dateOfTransformation>
|
49
|
</oai:header>
|
50
|
<oai:metadata>
|
51
|
<xsl:copy-of select="//*[local-name() = 'metadata']/*"/>
|
52
|
</oai:metadata>
|
53
|
</oai:record>
|
54
|
</xsl:template>
|
55
|
|
56
|
<xsl:template name="createRecord">
|
57
|
<oai:record>
|
58
|
<oai:header>
|
59
|
<xsl:copy-of select="//*[local-name() = 'header']/dri:objIdentifier"
|
60
|
copy-namespaces="no"/>
|
61
|
<xsl:copy-of select="//*[local-name() = 'header']/dri:dateOfCollection"
|
62
|
copy-namespaces="no"/>
|
63
|
<xsl:copy-of select="//*[local-name() = 'header']/oaf:datasourceprefix"
|
64
|
copy-namespaces="no"/>
|
65
|
<dr:dateOfTransformation>
|
66
|
<xsl:value-of select="date:date-time()"/>
|
67
|
</dr:dateOfTransformation>
|
68
|
</oai:header>
|
69
|
<oai:metadata>
|
70
|
<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
71
|
xsi:schemaLocation="http://datacite.org/schema/kernel-3 http://schema.datacite.org/meta/kernel-3/metadata.xsd"
|
72
|
xmlns="http://datacite.org/schema/kernel-3">
|
73
|
|
74
|
<xsl:choose>
|
75
|
<xsl:when test="//webresource/url != ''">
|
76
|
<identifier identifierType="URL">
|
77
|
<xsl:value-of select="./text()"/>
|
78
|
</identifier>
|
79
|
</xsl:when>
|
80
|
<xsl:otherwise>
|
81
|
<identifier identifierType="URL">
|
82
|
<xsl:value-of
|
83
|
select="concat('http://dx.doi.org', '/', //pid[@classid = 'doi'][1])"
|
84
|
/>
|
85
|
</identifier>
|
86
|
</xsl:otherwise>
|
87
|
</xsl:choose>
|
88
|
|
89
|
<alternateIdentifiers>
|
90
|
<xsl:for-each select="//oaf:result/pid[./text()]">
|
91
|
<alternateIdentifier alternateIdentifierType="{@classid}">
|
92
|
<xsl:value-of select="."/>
|
93
|
</alternateIdentifier>
|
94
|
</xsl:for-each>
|
95
|
<xsl:for-each select="//oaf:result/originalId">
|
96
|
<alternateIdentifier>
|
97
|
<xsl:value-of select="."/>
|
98
|
</alternateIdentifier>
|
99
|
</xsl:for-each>
|
100
|
</alternateIdentifiers>
|
101
|
<xsl:apply-templates/>
|
102
|
|
103
|
<titles>
|
104
|
<xsl:for-each select="//oaf:result/title/text()">
|
105
|
<title>
|
106
|
<xsl:value-of select="normalize-space(.)"/>
|
107
|
</title>
|
108
|
</xsl:for-each>
|
109
|
</titles>
|
110
|
<descriptions>
|
111
|
<xsl:for-each select="//oaf:result/description/text()">
|
112
|
<description descriptionType="Abstract">
|
113
|
<xsl:value-of select="normalize-space(.)"/>
|
114
|
</description>
|
115
|
</xsl:for-each>
|
116
|
</descriptions>
|
117
|
<subjects>
|
118
|
<xsl:for-each select="//oaf:result/subject[./text()]">
|
119
|
<xsl:choose>
|
120
|
<xsl:when test="@classname = 'keyword'">
|
121
|
<subject>
|
122
|
<xsl:value-of select="normalize-space(./text())"/>
|
123
|
</subject>
|
124
|
</xsl:when>
|
125
|
<xsl:otherwise>
|
126
|
<subject subjectScheme="{@classid}">
|
127
|
<xsl:value-of select="normalize-space(./text())"/>
|
128
|
</subject>
|
129
|
</xsl:otherwise>
|
130
|
</xsl:choose>
|
131
|
</xsl:for-each>
|
132
|
</subjects>
|
133
|
<!-- Size (O) -->
|
134
|
<sizes>
|
135
|
<xsl:for-each select="//oaf:result/size/text()">
|
136
|
<size>
|
137
|
<xsl:value-of select="."/>
|
138
|
</size>
|
139
|
</xsl:for-each>
|
140
|
</sizes>
|
141
|
</resource>
|
142
|
<xsl:call-template name="oafFields"/>
|
143
|
</oai:metadata>
|
144
|
<xsl:copy-of select="//*[local-name() = 'about']" copy-namespaces="no"/>
|
145
|
</oai:record>
|
146
|
</xsl:template>
|
147
|
|
148
|
<!-- Handling relationships -->
|
149
|
<xsl:template match="//oaf:result/rels">
|
150
|
<!-- Creators (M) -->
|
151
|
<creators>
|
152
|
<xsl:for-each select="./rel[./to/@class = 'hasAuthor']">
|
153
|
<xsl:sort select="ranking"/>
|
154
|
<creator>
|
155
|
<creatorName>
|
156
|
<xsl:value-of select="./fullname"/>
|
157
|
</creatorName>
|
158
|
</creator>
|
159
|
</xsl:for-each>
|
160
|
</creators>
|
161
|
<contributors>
|
162
|
<!-- person contributors: not yet available in openaire -->
|
163
|
<xsl:apply-templates select="./rel[./to/@class = 'hasContributor']"/>
|
164
|
</contributors>
|
165
|
<relatedIdentifiers>
|
166
|
<!-- Links to publications -->
|
167
|
<xsl:apply-templates select="./rel[./resulttype/@classid = 'publication']"/>
|
168
|
</relatedIdentifiers>
|
169
|
|
170
|
</xsl:template>
|
171
|
|
172
|
<!-- Person Contributor template -->
|
173
|
<xsl:template match="rel[./to/@class = 'hasContributor']">
|
174
|
<contributor>
|
175
|
<contributorName>
|
176
|
<xsl:value-of select="./fullname"/>
|
177
|
</contributorName>
|
178
|
</contributor>
|
179
|
</xsl:template>
|
180
|
|
181
|
|
182
|
<!--publisher (M) from publisher -->
|
183
|
<xsl:template match="//oaf:result/publisher/text()">
|
184
|
<publisher>
|
185
|
<xsl:value-of select="normalize-space(.)"/>
|
186
|
</publisher>
|
187
|
</xsl:template>
|
188
|
|
189
|
<!-- Publication year (M) -->
|
190
|
<xsl:template match="//oaf:result/dateofacceptance/text()">
|
191
|
<publicationYear>
|
192
|
<xsl:value-of select="normalize-space(substring-before(., '-'))"/>
|
193
|
</publicationYear>
|
194
|
</xsl:template>
|
195
|
|
196
|
<!-- Language (R) from language@classid -->
|
197
|
<xsl:template match="//oaf:result/language/@classid">
|
198
|
<language>
|
199
|
<xsl:value-of select="."/>
|
200
|
</language>
|
201
|
</xsl:template>
|
202
|
|
203
|
<!-- ResourceType (R) -->
|
204
|
<xsl:template
|
205
|
match="//oaf:result/children/instance/instancetype[./@classname != 'Unknown'] | //oaf:result/resourcetype[./@classname != '']">
|
206
|
<resourceType resourceTypeGeneral="{./@classname}"/>
|
207
|
</xsl:template>
|
208
|
|
209
|
<!-- Version (O) -->
|
210
|
<xsl:template match="//oaf:result/version/text()">
|
211
|
<version>
|
212
|
<xsl:value-of select="."/>
|
213
|
</version>
|
214
|
</xsl:template>
|
215
|
|
216
|
<!-- Oaf:fields -->
|
217
|
<xsl:template name="oafFields">
|
218
|
<dr:CobjCategory>0021</dr:CobjCategory>
|
219
|
<oaf:dateAccepted>
|
220
|
<xsl:value-of select="//oaf:result/dateofacceptance/text()"/>
|
221
|
</oaf:dateAccepted>
|
222
|
<oaf:accessrights>
|
223
|
<xsl:value-of select="//oaf:result/bestlicense/@classid"/>
|
224
|
</oaf:accessrights>
|
225
|
<oaf:language>
|
226
|
<xsl:value-of select="//oaf:result/language/@classid"/>
|
227
|
</oaf:language>
|
228
|
<xsl:for-each select="//instance/hostedby">
|
229
|
<xsl:copy-of select="." copy-namespaces="no"/>
|
230
|
</xsl:for-each>
|
231
|
<xsl:for-each select="//collectedfrom">
|
232
|
<xsl:copy-of select="." copy-namespaces="no"/>
|
233
|
</xsl:for-each>
|
234
|
</xsl:template>
|
235
|
|
236
|
<!-- Override default template -->
|
237
|
<xsl:template match="text() | @*"/>
|
238
|
</xsl:stylesheet>
|
239
|
|
240
|
|
241
|
|
242
|
]]></CODE>
|
243
|
</SCRIPT>
|
244
|
</CONFIGURATION>
|
245
|
<STATUS/>
|
246
|
<SECURITY_PARAMETERS/>
|
247
|
</BODY>
|
248
|
</RESOURCE_PROFILE>
|