1
|
<RESOURCE_PROFILE>
|
2
|
<HEADER>
|
3
|
<RESOURCE_IDENTIFIER value="33e8cc88-3b4a-4a68-b332-7cae8baad8dc_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
|
4
|
<RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
|
5
|
<RESOURCE_KIND value="TransformationRuleDSResources"/>
|
6
|
<RESOURCE_URI value=""/>
|
7
|
<DATE_OF_CREATION value="2014-07-17T10:41:08+02:00"/>
|
8
|
</HEADER>
|
9
|
<BODY>
|
10
|
<CONFIGURATION>
|
11
|
<IMPORTED/>
|
12
|
<SCRIPT>
|
13
|
<TITLE>xslt_cleaning_zenodo_datacite</TITLE>
|
14
|
<CODE><![CDATA[
|
15
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.1"
|
16
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
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
|
|
23
|
<xsl:param name="varOfficialName" />
|
24
|
<xsl:param name="varDsType" />
|
25
|
<xsl:param name="varDataSourceId" />
|
26
|
<xsl:param name="varCorda" select="'corda_______::'"/>
|
27
|
|
28
|
<xsl:param name="index" select="0"/>
|
29
|
<xsl:variable name="tf" select="TransformationFunction:getInstance()"/>
|
30
|
|
31
|
|
32
|
<xsl:template match="/">
|
33
|
<xsl:variable name="datasourcePrefix"
|
34
|
select="normalize-space(//oaf:datasourceprefix)" />
|
35
|
<xsl:call-template name="validRecord" />
|
36
|
</xsl:template>
|
37
|
|
38
|
|
39
|
<xsl:template name="validRecord">
|
40
|
<record>
|
41
|
<xsl:copy-of select="//*[local-name() = 'header']" />
|
42
|
|
43
|
<metadata>
|
44
|
<xsl:copy-of select="//*[local-name() = 'metadata']/*[local-name() = 'resource']" />
|
45
|
|
46
|
<xsl:if test="//*[local-name()='date']/@dateType='Available'">
|
47
|
<xsl:variable name='varEmbargoEndDate'
|
48
|
select="TransformationFunction:convertString($tf, normalize-space(//*[local-name()='date'][@dateType='Available']), 'DateISO8601')"/>
|
49
|
<xsl:choose>
|
50
|
<xsl:when test="string-length($varEmbargoEndDate) > 0">
|
51
|
<oaf:embargoenddate>
|
52
|
<xsl:value-of select="$varEmbargoEndDate"/>
|
53
|
</oaf:embargoenddate>
|
54
|
</xsl:when>
|
55
|
<xsl:otherwise>
|
56
|
<oaf:skip>
|
57
|
<xsl:value-of select="TransformationFunction:skipRecord($tf, $index)"/>
|
58
|
</oaf:skip>
|
59
|
</xsl:otherwise>
|
60
|
</xsl:choose>
|
61
|
</xsl:if>
|
62
|
|
63
|
<dr:CobjCategory><xsl:value-of
|
64
|
select="TransformationFunction:convertString($tf, //*[local-name()='resourceType']/@resourceTypeGeneral, 'TextTypologies')" />
|
65
|
</dr:CobjCategory>
|
66
|
|
67
|
<oaf:dateAccepted>
|
68
|
<xsl:value-of select="TransformationFunction:convertString($tf, normalize-space(//*[local-name()='publicationYear']), 'DateISO8601')"/>
|
69
|
</oaf:dateAccepted>
|
70
|
<xsl:choose>
|
71
|
|
72
|
<xsl:when test="//*[local-name() = 'rights'][starts-with(normalize-space(.), 'info:eu-repo/semantics')]">
|
73
|
<oaf:accessrights>
|
74
|
<xsl:value-of select="TransformationFunction:convertString($tf, //*[local-name() = 'rights'][starts-with(normalize-space(.), 'info:eu-repo/semantics')], 'AccessRights')"/>
|
75
|
</oaf:accessrights>
|
76
|
</xsl:when>
|
77
|
<xsl:when test="//*[local-name() = 'rights']/@rightsURI[starts-with(normalize-space(.), 'info:eu-repo/semantics')]">
|
78
|
<oaf:accessrights>
|
79
|
<xsl:value-of select="TransformationFunction:convertString($tf, //*[local-name() = 'rights']/@rightsURI[starts-with(normalize-space(.), 'info:eu-repo/semantics')], 'AccessRights')"/>
|
80
|
</oaf:accessrights>
|
81
|
</xsl:when>
|
82
|
<xsl:otherwise>
|
83
|
<xsl:choose>
|
84
|
<xsl:when test="//*[local-name() = 'rights'][starts-with(normalize-space(.), 'http://creativecommons.org')]">
|
85
|
<oaf:accessrights>
|
86
|
<xsl:text>OPEN</xsl:text>
|
87
|
</oaf:accessrights>
|
88
|
</xsl:when>
|
89
|
<xsl:otherwise>
|
90
|
<oaf:accessrights>
|
91
|
<xsl:text>CLOSED</xsl:text>
|
92
|
</oaf:accessrights>
|
93
|
</xsl:otherwise>
|
94
|
</xsl:choose>
|
95
|
</xsl:otherwise>
|
96
|
</xsl:choose>
|
97
|
|
98
|
<oaf:language>
|
99
|
<xsl:value-of select="TransformationFunction:convert($tf, //*[local-name()='language'], 'Languages')" />
|
100
|
</oaf:language>
|
101
|
|
102
|
<!--
|
103
|
<xsl:if test="//*[local-name() = 'rights'][starts-with(normalize-space(.), 'info:eu-repo/semantics/embargoedAccess')]">
|
104
|
<oaf:embargoenddate>
|
105
|
<xsl:value-of select="//*[local-name()='date']/@dateType='Available'"/>
|
106
|
</oaf:embargoenddate>
|
107
|
</xsl:if>
|
108
|
-->
|
109
|
|
110
|
<xsl:for-each select="//*[local-name()='nameIdentifier']">
|
111
|
<xsl:if test="string-length(substring-after(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7/')) = 6">
|
112
|
<oaf:projectid>
|
113
|
<xsl:value-of select="TransformationFunction:regExpr($tf, normalize-space(.), $varCorda, 's/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gm')"/>
|
114
|
</oaf:projectid>
|
115
|
</xsl:if>
|
116
|
</xsl:for-each>
|
117
|
|
118
|
<!-- <relatedIdentifier relatedIdentifierType="URL" relationType="IsPartOf">https://openaire.eu/communities/fam</relatedIdentifier> -->
|
119
|
<xsl:for-each select="//*[local-name()='relatedIdentifier']">
|
120
|
<xsl:if test="starts-with(./text(), 'https://openaire.eu/communities/')">
|
121
|
<oaf:concept><xsl:value-of select="substring-after(./text(), 'https://openaire.eu/communities/')"/></oaf:concept>
|
122
|
</xsl:if>
|
123
|
</xsl:for-each>
|
124
|
|
125
|
|
126
|
<oaf:hostedBy>
|
127
|
<xsl:attribute name="name">
|
128
|
<xsl:value-of select="$varOfficialName"/>
|
129
|
</xsl:attribute>
|
130
|
<xsl:attribute name="id">
|
131
|
<xsl:value-of select="$varDataSourceId"/>
|
132
|
</xsl:attribute>
|
133
|
</oaf:hostedBy>
|
134
|
<oaf:collectedFrom>
|
135
|
<xsl:attribute name="name">
|
136
|
<xsl:value-of select="$varOfficialName"/>
|
137
|
</xsl:attribute>
|
138
|
<xsl:attribute name="id">
|
139
|
<xsl:value-of select="$varDataSourceId"/>
|
140
|
</xsl:attribute>
|
141
|
</oaf:collectedFrom>
|
142
|
</metadata>
|
143
|
<xsl:copy-of select="//*[local-name() = 'about']" />
|
144
|
</record>
|
145
|
</xsl:template>
|
146
|
|
147
|
<!--
|
148
|
<xsl:template match="//*[local-name()='language']">
|
149
|
<oaf:language>
|
150
|
<xsl:value-of select="TransformationFunction:convert($tf, //*[local-name()='language'], 'Languages')" />
|
151
|
</oaf:language>
|
152
|
</xsl:template>
|
153
|
-->
|
154
|
</xsl:stylesheet>
|
155
|
]]></CODE>
|
156
|
</SCRIPT>
|
157
|
</CONFIGURATION>
|
158
|
<STATUS/>
|
159
|
<SECURITY_PARAMETERS/>
|
160
|
</BODY>
|
161
|
</RESOURCE_PROFILE>
|