Project

General

Profile

« Previous | Next » 

Revision 61310

Datacite JSON 2 ODF rules as defined in production

View differences:

modules/dnet-openaireplus-profiles/trunk/src/main/resources/eu/dnetlib/test/profiles/TransformationRuleDSResources/TransformationRuleDSResourceType/noncompliant/xslt_cleaning_datacite_json.xml
1
<RESOURCE_PROFILE>
2
    <HEADER>
3
        <RESOURCE_IDENTIFIER
4
                value="453d7902-85bf-4130-8773-e46c8c7199ee_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
5
        <RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
6
        <RESOURCE_KIND value="TransformationRuleDSResources"/>
7
        <RESOURCE_URI value=""/>
8
        <DATE_OF_CREATION value="2021-05-19T09:30:56+00:00"/>
9
    </HEADER>
10
    <BODY>
11
        <CONFIGURATION>
12
            <IMPORTED/>
13
            <SCRIPT>
14
                <TITLE>Datacite JSON 2 ODF</TITLE>
15
                <CODE>
16
                    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2"
17
                                    xmlns:oaf="http://namespace.openaire.eu/oaf"
18
                                    xmlns:dr="http://www.driver-repository.eu/namespace/dr"
19
                                    xmlns:TransformationFunction="eu.dnetlib.data.collective.transformation.core.xsl.ext.TransformationFunctionProxy"
20
                                    extension-element-prefixes="TransformationFunction"
21
                                    exclude-result-prefixes="TransformationFunction">
22
                        <xsl:param name="varOfficialName"/>
23
                        <xsl:param name="varDsType"/>
24
                        <xsl:param name="varDataSourceId"/>
25
                        <xsl:param name="varFP7" select="'corda_______::'"/>
26
                        <xsl:param name="varH2020" select="'corda__h2020::'"/>
27
                        <xsl:param name="varHostedByOfficialName" select="'Unknown Repository'"/>
28
                        <xsl:param name="varHostedByDataSourceId"
29
                                   select="'openaire____::1256f046-bf1f-4afc-8b47-d0b147148b18'"/>
30

  
31
                        <xsl:param name="index" select="0"/>
32
                        <xsl:variable name="tf" select="TransformationFunction:getInstance()"/>
33

  
34
                        <xsl:variable name="validationDate">
35
                            <xsl:value-of select="//*[local-name()='dateOfCollection']"/>
36
                        </xsl:variable>
37
                        <xsl:variable name="identifier" select="//attributes/doi"/>
38
                        <xsl:variable name="creators" select="//attributes/creators"/>
39
                        <xsl:variable name="titles" select="//attributes/titles"/>
40
                        <xsl:variable name="publisher" select="//attributes/publisher"/>
41
                        <xsl:variable name="publicationYear" select="//attributes/publicationYear"/>
42
                        <xsl:variable name="subjects" select="//attributes/subjects"/>
43
                        <xsl:variable name="contributors" select="//attributes/contributors"/>
44
                        <xsl:variable name="dates" select="//attributes/dates"/>
45
                        <xsl:variable name="language" select="//attributes/language"/>
46
                        <xsl:variable name="types" select="//attributes/types"/>
47
                        <xsl:variable name="alternateIdentifiers" select="//attributes/alternateIdentifiers"/>
48
                        <xsl:variable name="relatedIdentifiers" select="//attributes/relatedIdentifiers"/>
49
                        <xsl:variable name="sizes" select="//attributes/sizes"/>
50
                        <xsl:variable name="formats" select="//attributes/formats"/>
51
                        <xsl:variable name="version" select="//attributes/version"/>
52
                        <xsl:variable name="rights" select="//attributes/rightsList"/>
53
                        <xsl:variable name="descriptions" select="//attributes/descriptions"/>
54
                        <xsl:variable name="geolocation" select="//metaattributesdata/geoLocations"/>
55

  
56
                        <xsl:variable name="publicationDate">
57
                            <xsl:choose>
58
                                <xsl:when test=".//dates[./dateType = 'Issued']">
59
                                    <xsl:value-of select=".//dates[./dateType = 'Issued']/date"/>
60
                                </xsl:when>
61
                                <xsl:otherwise>
62
                                    <xsl:value-of select="$publicationYear"/>
63
                                </xsl:otherwise>
64
                            </xsl:choose>
65
                        </xsl:variable>
66

  
67

  
68
                        <xsl:template match="/">
69
                            <xsl:variable name="datasourcePrefix" select="normalize-space(//oaf:datasourceprefix)"/>
70
                            <xsl:call-template name="validRecord"/>
71
                        </xsl:template>
72

  
73
                        <xsl:template name="terminate">
74
                            <xsl:message terminate="yes">record is not compliant, transformation is interrupted.
75
                            </xsl:message>
76
                        </xsl:template>
77

  
78

  
79
                        <xsl:template name="validRecord">
80
                            <record xmlns="http://datacite.org/schema/kernel-4">
81
                                <xsl:copy-of select="//*[local-name() = 'header']"/>
82

  
83
                                <metadata>
84
                                    <resource>
85
                                        <xsl:choose>
86
                                            <xsl:when
87
                                                    test="not($identifier) or count($creators) = 0 or count($titles) = 0 or not($publisher) or not($publicationDate) or count($dates) = 0">
88
                                                <xsl:call-template name="terminate"/>
89
                                            </xsl:when>
90
                                            <xsl:otherwise>
91

  
92
                                                <identifier identifierType="DOI">
93
                                                    <xsl:value-of select="$identifier"/>
94
                                                </identifier>
95

  
96
                                                <creators>
97
                                                    <xsl:for-each select="$creators">
98
                                                        <creator>
99
                                                            <xsl:if test="./name">
100
                                                                <creatorName>
101
                                                                    <xsl:value-of select="./name"/>
102
                                                                </creatorName>
103
                                                            </xsl:if>
104
                                                            <xsl:if test="./affiliation">
105
                                                                <affiliation>
106
                                                                    <xsl:value-of select="./affiliation"/>
107
                                                                </affiliation>
108
                                                            </xsl:if>
109
                                                            <xsl:for-each select="./nameIdentifiers">
110
                                                                <nameIdentifier>
111
                                                                    <xsl:attribute name="nameIdentifierSchema">
112
                                                                        <xsl:value-of select="./nameIdentifierSchema"/>
113
                                                                    </xsl:attribute>
114
                                                                    <xsl:if test="./schemeURI">
115
                                                                        <xsl:attribute name="schemaURI">
116
                                                                            <xsl:value-of select="./schemaURI"/>
117
                                                                        </xsl:attribute>
118
                                                                    </xsl:if>
119
                                                                    <xsl:value-of select="./nameIdentifier"/>
120
                                                                </nameIdentifier>
121
                                                            </xsl:for-each>
122
                                                        </creator>
123
                                                    </xsl:for-each>
124
                                                </creators>
125

  
126
                                                <titles>
127
                                                    <xsl:for-each select="$titles">
128
                                                        <title>
129
                                                            <xsl:if test="./lang">
130
                                                                <xsl:attribute name="xml:lang" select="./lang"/>
131
                                                            </xsl:if>
132
                                                            <xsl:value-of select="."/>
133

  
134
                                                        </title>
135
                                                    </xsl:for-each>
136
                                                </titles>
137

  
138
                                                <publisher>
139
                                                    <xsl:value-of select="$publisher"/>
140
                                                </publisher>
141

  
142
                                                <publicationYear>
143
                                                    <xsl:value-of select="$publicationYear"/>
144
                                                </publicationYear>
145

  
146
                                                <xsl:if test="count($subjects) > 0">
147
                                                    <subjects>
148
                                                        <xsl:for-each select="$subjects">
149
                                                            <subject>
150
                                                                <xsl:if test="./subjectScheme">
151
                                                                    <xsl:attribute name="subjectScheme">
152
                                                                        <xsl:value-of select="./subjectScheme"/>
153
                                                                    </xsl:attribute>
154
                                                                </xsl:if>
155
                                                                <xsl:if test="./schemeURI">
156
                                                                    <xsl:attribute name="schemeURI">
157
                                                                        <xsl:value-of select="./schemeURI"/>
158
                                                                    </xsl:attribute>
159
                                                                </xsl:if>
160
                                                                <xsl:value-of select="./subject"/>
161
                                                            </subject>
162
                                                        </xsl:for-each>
163

  
164
                                                    </subjects>
165
                                                </xsl:if>
166

  
167
                                                <xsl:if test="count($contributors) > 0">
168
                                                    <contributors>
169
                                                        <xsl:for-each select="$contributors">
170
                                                            <contributor>
171
                                                                <xsl:if test="./contributorType">
172
                                                                    <xsl:attribute name="contributorType">
173
                                                                        <xsl:value-of select="./contributorType"/>
174
                                                                    </xsl:attribute>
175
                                                                </xsl:if>
176
                                                                <contributorName>
177
                                                                    <xsl:value-of select="./name"/>
178
                                                                </contributorName>
179
                                                            </contributor>
180
                                                        </xsl:for-each>
181
                                                    </contributors>
182
                                                </xsl:if>
183

  
184
                                                <dates>
185
                                                    <xsl:for-each select="$dates">
186
                                                        <date>
187
                                                            <xsl:attribute name="dateType" select="./dateType"/>
188
                                                            <xsl:value-of select="./date"/>
189
                                                        </date>
190
                                                    </xsl:for-each>
191
                                                </dates>
192

  
193
                                                <xsl:if test="$language">
194
                                                    <language>
195
                                                        <xsl:value-of select="$language"/>
196
                                                    </language>
197
                                                </xsl:if>
198

  
199
                                                <xsl:if test="$types">
200
                                                    <resourceType>
201
                                                        <xsl:choose>
202
                                                            <xsl:when test="$types/resourceTypeGeneral">
203
                                                                <xsl:attribute name="resourceTypeGeneral"
204
                                                                               select="$types/resourceTypeGeneral"/>
205
                                                            </xsl:when>
206
                                                            <xsl:otherwise>
207
                                                                <xsl:attribute name="resourceTypeGeneral"
208
                                                                               select="Dataset"/>
209
                                                            </xsl:otherwise>
210
                                                        </xsl:choose>
211
                                                        <xsl:if test="$types/resourceType">
212
                                                            <xsl:value-of select="$types/resourceType"/>
213
                                                        </xsl:if>
214
                                                    </resourceType>
215
                                                </xsl:if>
216

  
217
                                                <xsl:if test="$alternateIdentifiers">
218
                                                    <alternateIdentifiers>
219
                                                        <xsl:for-each select="$alternateIdentifiers">
220
                                                            <alternateIdentifier>
221
                                                                <xsl:attribute name="alternateIdentifierType">
222
                                                                    <xsl:value-of select="./identifierType"/>
223
                                                                </xsl:attribute>
224
                                                                <xsl:value-of select="./identifier"/>
225
                                                            </alternateIdentifier>
226
                                                        </xsl:for-each>
227
                                                    </alternateIdentifiers>
228
                                                </xsl:if>
229

  
230
                                                <xsl:if test="$relatedIdentifiers or //relatedPubs/doi">
231
                                                    <relatedIdentifiers>
232
                                                        <xsl:for-each select="$relatedIdentifiers">
233
                                                            <relatedIdentifier>
234
                                                                <xsl:attribute name="relatedIdentifierType">
235
                                                                    <xsl:value-of select="./relatedIdentifierType"/>
236
                                                                </xsl:attribute>
237
                                                                <xsl:if test="./relatedMetadataScheme">
238
                                                                    <xsl:attribute name="relatedMetadataScheme">
239
                                                                        <xsl:value-of select="./relatedMetadataScheme"/>
240
                                                                    </xsl:attribute>
241
                                                                </xsl:if>
242
                                                                <xsl:attribute name="relationType">
243
                                                                    <xsl:value-of select="./relationType"/>
244
                                                                </xsl:attribute>
245
                                                                <xsl:if test="./schemeType">
246
                                                                    <xsl:attribute name="schemeType">
247
                                                                        <xsl:value-of select="./schemeType"/>
248
                                                                    </xsl:attribute>
249
                                                                </xsl:if>
250
                                                                <xsl:if test="./schemeURI">
251
                                                                    <xsl:attribute name="schemeURI">
252
                                                                        <xsl:value-of select="./schemeURI"/>
253
                                                                    </xsl:attribute>
254
                                                                </xsl:if>
255
                                                                <xsl:value-of select="./relatedIdentifier"/>
256
                                                            </relatedIdentifier>
257
                                                        </xsl:for-each>
258
                                                        <xsl:for-each select="//relatedPubs/doi">
259
                                                            <relatedIdentifier>
260
                                                                <xsl:attribute name="relatedIdentifierType">
261
                                                                    <xsl:value-of select="string('DOI')"/>
262
                                                                </xsl:attribute>
263

  
264
                                                                <xsl:attribute name="relationType">
265
                                                                    <xsl:value-of select="string('IsSupplementTo')"/>
266
                                                                </xsl:attribute>
267

  
268
                                                                <xsl:value-of select="."/>
269

  
270
                                                            </relatedIdentifier>
271
                                                        </xsl:for-each>
272
                                                    </relatedIdentifiers>
273
                                                </xsl:if>
274

  
275
                                                <xsl:if test="$sizes">
276
                                                    <sizes>
277
                                                        <xsl:for-each select="$sizes">
278
                                                            <size>
279
                                                                <xsl:value-of select="."/>
280
                                                            </size>
281
                                                        </xsl:for-each>
282
                                                    </sizes>
283
                                                </xsl:if>
284

  
285
                                                <xsl:if test="$formats">
286
                                                    <formats>
287
                                                        <xsl:for-each select="$formats">
288
                                                            <format>
289
                                                                <xsl:value-of select="."/>
290
                                                            </format>
291
                                                        </xsl:for-each>
292
                                                    </formats>
293
                                                </xsl:if>
294

  
295
                                                <xsl:if test="$version">
296
                                                    <version>
297
                                                        <xsl:value-of select="$version"/>
298
                                                    </version>
299
                                                </xsl:if>
300

  
301
                                                <xsl:if test="$rights">
302
                                                    <rightsList>
303
                                                        <xsl:for-each select="$rights">
304
                                                            <rights>
305
                                                                <xsl:if test="./rightsUri">
306
                                                                    <xsl:attribute name="rightsURI">
307
                                                                        <xsl:value-of select="./rightsUri"/>
308
                                                                    </xsl:attribute>
309
                                                                </xsl:if>
310
                                                                <xsl:if test="./rights">
311
                                                                    <xsl:value-of select="./rights"/>
312
                                                                </xsl:if>
313
                                                            </rights>
314
                                                        </xsl:for-each>
315
                                                    </rightsList>
316
                                                </xsl:if>
317

  
318
                                                <xsl:if test="$descriptions">
319
                                                    <descriptions>
320
                                                        <xsl:for-each select="$descriptions">
321
                                                            <description>
322
                                                                <xsl:if test="./descriptionType">
323
                                                                    <xsl:attribute name="descriptionType">
324
                                                                        <xsl:value-of select="./descriptionType"/>
325
                                                                    </xsl:attribute>
326
                                                                </xsl:if>
327
                                                                <xsl:if test="./lang">
328
                                                                    <xsl:attribute name="xml:lang">
329
                                                                        <xsl:value-of select="./lang"/>
330
                                                                    </xsl:attribute>
331
                                                                </xsl:if>
332
                                                                <xsl:if test="./description">
333
                                                                    <xsl:value-of select="./description"/>
334
                                                                </xsl:if>
335
                                                            </description>
336
                                                        </xsl:for-each>
337
                                                    </descriptions>
338
                                                </xsl:if>
339

  
340
                                                <xsl:if test="$geolocation">
341
                                                    <geoLocations>
342
                                                        <xsl:for-each select="$geolocation">
343
                                                            <xsl:copy-of select="."/>
344
                                                        </xsl:for-each>
345
                                                    </geoLocations>
346
                                                </xsl:if>
347

  
348

  
349
                                                <xsl:for-each select="$dates">
350
                                                    <xsl:if test="./dateType = 'Available'">
351
                                                        <xsl:variable name="varEmbargoEndDate"
352
                                                                      select="TransformationFunction:convertString($tf, normalize-space(./date), 'DateISO8601')"/>
353
                                                        <xsl:if test="string-length($varEmbargoEndDate) > 0">
354
                                                            <oaf:embargoenddate>
355
                                                                <xsl:value-of select="$varEmbargoEndDate"/>
356
                                                            </oaf:embargoenddate>
357
                                                        </xsl:if>
358
                                                    </xsl:if>
359
                                                </xsl:for-each>
360

  
361
                                                <dr:CobjCategory>
362
                                                    <xsl:choose>
363
                                                        <xsl:when test="$types">
364
                                                            <xsl:choose>
365
                                                                <xsl:when
366
                                                                        test="$types/schemaOrg = 'ScholarlyArticle' or $types/schemaOrg = 'Book' or $types/schemaOrg = 'Thesis' or $types/schemaOrg = 'Chapter' or $types/schemaOrg = 'PublicationIssue' or $types/schemaOrg = 'PublicationVolume'">
367
                                                                    <xsl:attribute name="type">
368
                                                                        <xsl:value-of select="string('publication')"/>
369
                                                                    </xsl:attribute>
370
                                                                    <xsl:choose>
371
                                                                        <xsl:when test="$types/bibtex = 'techreport'">
372
                                                                            <xsl:value-of select="string('0017')"/>
373
                                                                        </xsl:when>
374
                                                                        <xsl:when
375
                                                                                test="$types/schemaOrg = 'ScholarlyArticle'">
376
                                                                            <xsl:value-of select="string('0001')"/>
377
                                                                        </xsl:when>
378
                                                                        <xsl:when test="$types/schemaOrg = 'Book'">
379
                                                                            <xsl:value-of select="string('0002')"/>
380
                                                                        </xsl:when>
381
                                                                        <xsl:when test="$types/schemaOrg = 'Thesis'">
382
                                                                            <xsl:value-of select="string('0041')"/>
383
                                                                        </xsl:when>
384
                                                                        <xsl:when test="$types/schemaOrg = 'Chapter'">
385
                                                                            <xsl:value-of select="string('0013')"/>
386
                                                                        </xsl:when>
387
                                                                        <xsl:otherwise>
388
                                                                            <xsl:value-of select="string('0038')"/>
389
                                                                        </xsl:otherwise>
390
                                                                    </xsl:choose>
391
                                                                </xsl:when>
392
                                                                <xsl:when
393
                                                                        test="$types/schemaOrg = 'ImageObject' or $types/schemaOrg = 'MediaObject' or $types/schemaOrg = 'AudioObject' or $types/resourceTypeGeneral = 'Film' or $types/schemaOrg = 'Dataset'">
394
                                                                    <xsl:attribute name="type">
395
                                                                        <xsl:value-of select="string('dataset')"/>
396
                                                                    </xsl:attribute>
397
                                                                    <xsl:choose>
398
                                                                        <xsl:when
399
                                                                                test="$types/schemaOrg = 'ImageObject'">
400
                                                                            <xsl:value-of select="string('0025')"/>
401
                                                                        </xsl:when>
402
                                                                        <xsl:when
403
                                                                                test="$types/schemaOrg = 'MediaObject'">
404
                                                                            <xsl:value-of select="string('0033')"/>
405
                                                                        </xsl:when>
406
                                                                        <xsl:when
407
                                                                                test="$types/schemaOrg = 'AudioObject'">
408
                                                                            <xsl:value-of select="string('0030')"/>
409
                                                                        </xsl:when>
410
                                                                        <xsl:when
411
                                                                                test="$types/resourceTypeGeneral = 'Film'">
412
                                                                            <xsl:value-of select="string('0024')"/>
413
                                                                        </xsl:when>
414
                                                                        <xsl:when test="$types/schemaOrg = 'Dataset'">
415
                                                                            <xsl:value-of select="string('0021')"/>
416
                                                                        </xsl:when>
417
                                                                    </xsl:choose>
418
                                                                </xsl:when>
419
                                                                <xsl:when
420
                                                                        test="$types/schemaOrg = 'SoftwareSourceCode'">
421
                                                                    <xsl:attribute name="type">
422
                                                                        <xsl:value-of select="software"/>
423
                                                                    </xsl:attribute>
424
                                                                    <xsl:value-of select="string('0029')"/>
425
                                                                </xsl:when>
426
                                                                <xsl:when
427
                                                                        test="$types/schemaOrg = 'Event' or $types/resourceTypeGeneral = 'Model' or $types/schemaOrg = 'Collection'">
428
                                                                    <xsl:attribute name="type">
429
                                                                        <xsl:value-of select="other"/>
430
                                                                    </xsl:attribute>
431
                                                                    <xsl:choose>
432
                                                                        <xsl:when test="$types/schemaOrg = 'Event'">
433
                                                                            <xsl:value-of select="string('0023')"/>
434
                                                                        </xsl:when>
435
                                                                        <xsl:when
436
                                                                                test="$types/resourceTypeGeneral = 'Model'">
437
                                                                            <xsl:value-of select="string('0027')"/>
438
                                                                        </xsl:when>
439
                                                                        <xsl:when
440
                                                                                test="$types/schemaOrg = 'Collection'">
441
                                                                            <xsl:value-of select="string('0022')"/>
442
                                                                        </xsl:when>
443
                                                                    </xsl:choose>
444
                                                                </xsl:when>
445
                                                                <xsl:otherwise>
446
                                                                    <xsl:attribute name="type">
447
                                                                        <xsl:value-of select="'other'"/>
448
                                                                    </xsl:attribute>
449
                                                                    <xsl:value-of select="string('0020')"/>
450
                                                                </xsl:otherwise>
451
                                                            </xsl:choose>
452
                                                        </xsl:when>
453
                                                        <xsl:otherwise>
454
                                                            <xsl:attribute name="type">
455
                                                                <xsl:value-of select="string('dataset')"/>
456
                                                            </xsl:attribute>
457
                                                            <xsl:value-of select="string('0021')"/>
458
                                                        </xsl:otherwise>
459
                                                    </xsl:choose>
460
                                                </dr:CobjCategory>
461

  
462
                                                <xsl:variable name="varRefereed"
463
                                                              select="for $i in $types/*[local-name() = ('resourceTypeGeneral', 'schemaOrg', 'citeproc', 'bibtex', 'ris')] return TransformationFunction:convertString($tf, normalize-space($i), 'ReviewLevels')"/>
464
                                                <xsl:choose>
465
                                                    <xsl:when test="count($varRefereed[. = '0001']) > 0">
466
                                                        <oaf:refereed>
467
                                                            <xsl:value-of select="'0001'"/>
468
                                                        </oaf:refereed>
469
                                                    </xsl:when>
470
                                                    <xsl:when test="count($varRefereed[. = '0002']) > 0">
471
                                                        <oaf:refereed>
472
                                                            <xsl:value-of select="'0002'"/>
473
                                                        </oaf:refereed>
474
                                                    </xsl:when>
475
                                                </xsl:choose>
476

  
477

  
478
                                                <oaf:dateAccepted>
479
                                                    <xsl:value-of
480
                                                            select="TransformationFunction:convertString($tf, normalize-space($publicationDate), 'DateISO8601')"
481
                                                    />
482
                                                </oaf:dateAccepted>
483

  
484

  
485
                                                <!-- avoiding to check access rights 'synonyms' which are listed in dnet:access_modes  -->
486
                                                <xsl:choose>
487
                                                    <xsl:when test="//awards/awardUri">
488
                                                        <oaf:accessrights>OPEN</oaf:accessrights>
489
                                                    </xsl:when>
490
                                                    <xsl:otherwise>
491
                                                        <oaf:accessrights>
492
                                                            <xsl:choose>
493
                                                                <xsl:when
494
                                                                        test="//rights/(., ../rightsUri)[TransformationFunction:convertString($tf, ., 'AccessRights') = ('OPEN', 'OPEN SOURCE')]">
495
                                                                    <xsl:value-of
496
                                                                            select="TransformationFunction:convertString($tf, subsequence(//rights/(., ../rightsUri)[TransformationFunction:convertString($tf, ., 'AccessRights') = ('OPEN', 'OPEN SOURCE')], 1, 1), 'AccessRights')"
497
                                                                    />
498
                                                                </xsl:when>
499
                                                                <xsl:when
500
                                                                        test="//rights/(., ../rightsUri)[TransformationFunction:convertString($tf, ., 'AccessRights') = ('EMBARGO', '6MONTHS', '12MONTHS')]">
501
                                                                    <xsl:value-of
502
                                                                            select="TransformationFunction:convertString($tf, subsequence(//rights/(., ../rightsUri)[TransformationFunction:convertString($tf, ., 'AccessRights') = ('EMBARGO', '6MONTHS', '12MONTHS')], 1, 1), 'AccessRights')"
503
                                                                    />
504
                                                                </xsl:when>
505
                                                                <xsl:when
506
                                                                        test="//rights/(., ../rightsUri)[TransformationFunction:convertString($tf, ., 'AccessRights') = ('RESTRICTED')]">
507
                                                                    <xsl:value-of
508
                                                                            select="TransformationFunction:convertString($tf, subsequence(//rights/(., ../rightsUri)[TransformationFunction:convertString($tf, ., 'AccessRights') = ('RESTRICTED')], 1, 1), 'AccessRights')"
509
                                                                    />
510
                                                                </xsl:when>
511
                                                                <xsl:when
512
                                                                        test="//rights/(., ../rightsUri)[TransformationFunction:convertString($tf, ., 'AccessRights') = ('CLOSED', 'OTHER')]">
513
                                                                    <xsl:value-of
514
                                                                            select="TransformationFunction:convertString($tf, subsequence(//rights/(., ../rightsUri)[TransformationFunction:convertString($tf, ., 'AccessRights') = ('CLOSED', 'OTHER')], 1, 1), 'AccessRights')"
515
                                                                    />
516
                                                                </xsl:when>
517
                                                                <xsl:otherwise>
518
                                                                    <xsl:value-of
519
                                                                            select="TransformationFunction:convertString($tf, subsequence(//rights/(., ../rightsUri), 1, 1), 'AccessRights')"
520
                                                                    />
521
                                                                </xsl:otherwise>
522
                                                            </xsl:choose>
523

  
524
                                                        </oaf:accessrights>
525
                                                    </xsl:otherwise>
526
                                                </xsl:choose>
527

  
528
                                                <xsl:for-each
529
                                                        select="//rightsUri[starts-with(normalize-space(.), 'http') and matches(., '.*(/licenses|/publicdomain|unlicense.org/|/legal-and-data-protection-notices|/download/license|/open-government-licence).*')]">
530
                                                    <oaf:license>
531
                                                        <xsl:copy-of select="normalize-space(.)"/>
532
                                                    </oaf:license>
533
                                                </xsl:for-each>
534

  
535
                                                <oaf:language>
536
                                                    <xsl:value-of
537
                                                            select="TransformationFunction:convert($tf, $language, 'Languages')"
538
                                                    />
539
                                                </oaf:language>
540

  
541

  
542
                                                <xsl:variable name="awards" select="//metadata/awards/award"/>
543
                                                <xsl:variable name="varAKA" select="'aka_________::'"/>
544
                                                <xsl:variable name="varARC" select="'arc_________::'"/>
545
                                                <xsl:variable name="varCONICYT" select="'conicytf____::'"/>
546
                                                <xsl:variable name="varDFG" select="'dfgf________::'"/>
547
                                                <xsl:variable name="varFCT" select="'fct_________::'"/>
548
                                                <xsl:variable name="varFWF" select="'fwf_________::'"/>
549
                                                <xsl:variable name="varHRZZ" select="'irb_hr______::'"/>
550
                                                <xsl:variable name="varMESTD" select="'mestd_______::'"/>
551
                                                <xsl:variable name="varMIUR" select="'miur________::'"/>
552
                                                <xsl:variable name="varMZOS" select="'irb_hr______::'"/>
553
                                                <xsl:variable name="varNHMRC" select="'nhmrc_______::'"/>
554
                                                <xsl:variable name="varNIH" select="'nih_________::'"/>
555
                                                <xsl:variable name="varNSF" select="'nsf_________::'"/>
556
                                                <xsl:variable name="varNWO" select="'nwo_________::'"/>
557
                                                <xsl:variable name="varRCUK" select="'rcuk________::'"/>
558
                                                <xsl:variable name="varSFI" select="'sfi_________::'"/>
559
                                                <xsl:variable name="varSGOV" select="'sgov________::'"/>
560
                                                <xsl:variable name="varSNSF" select="'snsf________::'"/>
561
                                                <xsl:variable name="varTARA" select="'taraexp_____::'"/>
562
                                                <xsl:variable name="varTUBITAK" select="'tubitakf____::'"/>
563
                                                <xsl:variable name="varWT" select="'wt__________::'"/>
564
                                                <xsl:for-each select="//attributes/fundingReferences">
565
                                                    <xsl:choose>
566
                                                        <xsl:when
567
                                                                test="ends-with(./funderIdentifier,'10.13039/501100000780') or starts-with(normalize-space(./awardUri),'info:eu-repo/grantAgreement/EC/H2020')">
568
                                                            <!--H2020-->
569

  
570

  
571
                                                            <oaf:projectid>
572
                                                                <xsl:value-of
573
                                                                        select="concat($varH2020, ./awardNumber)"/>
574
                                                            </oaf:projectid>
575

  
576
                                                        </xsl:when>
577
                                                        <xsl:when
578
                                                                test="ends-with(./funderIdentifier,'10.13039/100011102') or starts-with(normalize-space(./awardUri),'info:eu-repo/grantAgreement/EC/FP7')">
579
                                                            <!-- FP7 -->
580

  
581
                                                            <oaf:projectid>
582
                                                                <xsl:value-of select="concat($varFP7, ./awardNumber)"/>
583
                                                            </oaf:projectid>
584

  
585

  
586
                                                        </xsl:when>
587
                                                        <xsl:when
588
                                                                test="ends-with(./funderIdentifier, '10.13039/501100002341') or contains(./funderName, 'Suomen Akatemia') or contains(./funderName, 'Academy of Finland')">
589
                                                            <!-- AKA -->
590
                                                            <oaf:projectId>
591
                                                                <xsl:value-of select="concat($varAKA, ./awardNumber)"/>
592
                                                            </oaf:projectId>
593
                                                        </xsl:when>
594
                                                        <xsl:when
595
                                                                test="ends-with(./funderIdentifier, '10.13039/501100000923') or contains(./funderName, 'Australian Research Council')">
596
                                                            <!-- ARC -->
597
                                                            <oaf:projectId>
598
                                                                <xsl:value-of select="concat($varARC, ./awardNumber)"/>
599
                                                            </oaf:projectId>
600
                                                        </xsl:when>
601
                                                        <xsl:when
602
                                                                test="ends-with(./funderIdentifier,'10.13039/501100002848') or contains(./funderName,'Comisión Nacional de Investigación Científica y Tecnológica') or contains(./funderName,'CONICYT')">
603
                                                            <!-- CONICYT -->
604
                                                            <oaf:projectId>
605
                                                                <xsl:value-of
606
                                                                        select="concat($varCONICYT, ./awardNumber)"/>
607
                                                            </oaf:projectId>
608
                                                        </xsl:when>
609
                                                        <xsl:when
610
                                                                test="ends-with(./funderIdentifier, '10.13039/501100001659') or contains(./funderName, 'Deutsche Forschungsgemeinschaft') or contains(./funderName, 'DFGH')">
611
                                                            <!-- DFG -->
612
                                                            <oaf:projectId>
613
                                                                <xsl:value-of select="concat($varDFG, ./awardNumber)"/>
614
                                                            </oaf:projectId>
615
                                                        </xsl:when>
616
                                                        <xsl:when
617
                                                                test="ends-with(./funderIdentifier, '10.13039/501100000690') or contains(./funderName, 'Research Councils UK') or contains(./funderName, 'RCUK')">
618
                                                            <!-- RCUK -->
619
                                                            <oaf:projectId>
620
                                                                <xsl:value-of select="concat($varRCUK, ./awardNumber)"/>
621
                                                            </oaf:projectId>
622
                                                        </xsl:when>
623
                                                        <xsl:when
624
                                                                test="contains(./funderName, 'Ministerio de Economía y Competitividad') or contains(./funderName, 'Gobierno de Espana') or contains(./funderName, 'Ministry of Economy and Competitiveness')">
625
                                                            <!-- SGOV -->
626
                                                            <oaf:projectId>
627
                                                                <xsl:value-of select="concat($varSGOV, ./awardNumber)"/>
628
                                                            </oaf:projectId>
629
                                                        </xsl:when>
630
                                                        <xsl:when
631
                                                                test="ends-with(./funderIdentifier, '10.13039/501100001711') or contains(./funderName, 'Swiss National Science Foundation') or contains(./funderName, 'Schweizerischer Nationalfonds zur Förderung der Wissenschaftlichen Forschung')">
632
                                                            <!-- SNSF -->
633
                                                            <oaf:projectId>
634
                                                                <xsl:value-of select="concat($varSNSF, ./awardNumber)"/>
635
                                                            </oaf:projectId>
636
                                                        </xsl:when>
637
                                                        <xsl:when
638
                                                                test="ends-with(./funderIdentifier, '10.13039/501100004410') or contains(./funderName, 'Turkish National Science and Research Council') or (contains(./funderName, 'Türkiye Bilimsel ve Teknolojik Ara') and contains(./funderName, 'rma Kurumu'))">
639
                                                            <!-- TUBITAK -->
640
                                                            <oaf:projectId>
641
                                                                <xsl:value-of
642
                                                                        select="concat($varTUBITAK, ./awardNumber)"/>
643
                                                            </oaf:projectId>
644
                                                        </xsl:when>
645
                                                    </xsl:choose>
646
                                                </xsl:for-each>
647

  
648

  
649
                                                <xsl:for-each select="distinct-values(//awards/awardUri)">
650
                                                    <xsl:if test="starts-with(normalize-space(.), 'info:eu-repo/grantAgreement/EC/H2020')">
651
                                                        <xsl:variable name="projectId"
652
                                                                      select="substring-after(., 'info:eu-repo/grantAgreement/EC/H2020/')"/>
653
                                                        <oaf:projectid>
654
                                                            <xsl:attribute name="validationDate">
655
                                                                <xsl:value-of select="$validationDate"/>
656
                                                            </xsl:attribute>
657
                                                            <xsl:value-of
658
                                                                    select="concat($varH2020, $projectId)"
659
                                                            />
660
                                                        </oaf:projectid>
661
                                                    </xsl:if>
662

  
663
                                                    <xsl:if
664
                                                            test="matches(normalize-space(.), '(info:eu-repo/grantagreement/ec/fp7/)(\d\d\d\d\d\d)(.*)', 'i')">
665
                                                        <oaf:projectid>
666
                                                            <xsl:value-of
667
                                                                    select="concat($varFP7, replace(normalize-space(.), '(info:eu-repo/grantagreement/ec/fp7/)(\d\d\d\d\d\d)(.*)', '$2', 'i'))"
668
                                                            />
669
                                                        </oaf:projectid>
670
                                                    </xsl:if>
671
                                                </xsl:for-each>
672

  
673

  
674
                                                <oaf:hostedBy>
675
                                                    <xsl:attribute name="name">
676
                                                        <xsl:value-of select="$varHostedByOfficialName"/>
677
                                                    </xsl:attribute>
678
                                                    <xsl:attribute name="id">
679
                                                        <xsl:value-of select="$varHostedByDataSourceId"/>
680
                                                    </xsl:attribute>
681
                                                </oaf:hostedBy>
682
                                                <oaf:collectedFrom>
683
                                                    <xsl:attribute name="name">
684
                                                        <xsl:value-of select="$varOfficialName"/>
685
                                                    </xsl:attribute>
686
                                                    <xsl:attribute name="id">
687
                                                        <xsl:value-of select="$varDataSourceId"/>
688
                                                    </xsl:attribute>
689
                                                </oaf:collectedFrom>
690

  
691
                                            </xsl:otherwise>
692
                                        </xsl:choose>
693
                                    </resource>
694
                                </metadata>
695
                                <xsl:copy-of select="//*[local-name() = 'about']"/>
696
                            </record>
697
                        </xsl:template>
698

  
699

  
700
                    </xsl:stylesheet>
701

  
702
                </CODE>
703
            </SCRIPT>
704
        </CONFIGURATION>
705
        <STATUS/>
706
        <SECURITY_PARAMETERS/>
707
    </BODY>
708
</RESOURCE_PROFILE>

Also available in: Unified diff