Project

General

Profile

1
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  
2
	xmlns:oai="http://www.openarchives.org/OAI/2.0/" 
3
	xmlns:dc="http://purl.org/dc/elements/1.1/" 
4
	xmlns:oaire="http://namespace.openaire.eu/schema/oaire/"
5
	xmlns:datacite="http://datacite.org/schema/kernel-4"
6
	xmlns:dri="http://www.driver-repository.eu/namespace/dri"
7
	xmlns:TransformationFunction="eu.dnetlib.data.collective.transformation.core.xsl.ext.TransformationFunctionProxy" 
8
	xmlns:dnet="eu.dnetlib.data.utils.XsltFunctions" 
9
	exclude-result-prefixes="xsl TransformationFunction dnet dc oaire datacite">
10
	
11
	<xsl:param name="varOfficialName" />
12

    
13
	<xsl:variable name="tf" select="TransformationFunction:getInstance()" />
14

    
15
	<xsl:template match="/">
16

    
17
		<xsl:variable name="tmpRights">
18
			<xsl:choose>
19
				<xsl:when test=".//datacite:rights/@rightsURI = 'info:eu-repo/semantics/closedAccess'">Closed Access</xsl:when>
20
				<xsl:when test=".//datacite:rights/@rightsURI = 'info:eu-repo/semantics/restrictedAccess'">Restricted</xsl:when>
21
				<xsl:when test=".//datacite:rights/@rightsURI = 'info:eu-repo/semantics/embargoedAccess'">Embargo</xsl:when>
22
				<xsl:when test=".//datacite:rights/@rightsURI = 'info:eu-repo/semantics/openAccess'">Open Access</xsl:when>
23
				<xsl:otherwise>Unknown</xsl:otherwise>
24
			</xsl:choose>
25
		</xsl:variable>
26
		<xsl:variable name="rights" select="normalize-space($tmpRights)" />
27

    
28
		<oai:record>
29
			<xsl:copy-of select="//*[local-name() = 'header']" />
30
			<oai:metadata>
31
				<record>
32

    
33
					<identifier>
34
						<xsl:value-of select="normalize-space(//dri:recordIdentifier)" />
35
					</identifier>
36

    
37
					<title>
38
						<xsl:value-of select="//datacite:title[1]" />
39
					</title>
40

    
41
					<creators>
42
						<xsl:for-each select="//datacite:creatorName">
43
							<xsl:variable name="orcid" select="../datacite:nameIdentifier[@nameIdentifierScheme='ORCID']"/>
44
							<xsl:for-each select="tokenize(dnet:cleanNames(.), '#')">
45
								<xsl:if test="string-length(.) &gt; 0">
46
									<creator orcid="{$orcid}">
47
										<xsl:value-of select="." />
48
									</creator>
49
								</xsl:if>
50
							</xsl:for-each>
51
						</xsl:for-each>
52
					</creators>
53

    
54
					<publisher>
55
						<xsl:value-of select="//dc:publisher[1]" />
56
					</publisher>
57

    
58
					<subjects>
59
						<xsl:for-each select="//datacite:subject">
60
							<subject>
61
								<xsl:value-of select="." />
62
							</subject>
63
						</xsl:for-each>
64
					</subjects>
65

    
66
					<contributors>
67
						<xsl:for-each select="//datacite:contributorName">
68
							<xsl:for-each select="tokenize(., ',')">
69
								<contributor>
70
									<xsl:value-of select="normalize-space(.)" />
71
								</contributor>
72
							</xsl:for-each>
73
						</xsl:for-each>
74
					</contributors>
75

    
76
					<date>
77
						<xsl:choose>
78
							<xsl:when test="//datacite:date[@dateType='Issued']">
79
								<xsl:value-of select="dnet:extractYear(//datacite:date[@dateType='Issued'][1])" />
80
							</xsl:when>
81
							<xsl:when test="//datacite:date[@dateType='Available']">
82
								<xsl:value-of select="dnet:extractYear(//datacite:date[@dateType='Available'][1])" />
83
							</xsl:when>
84
							<xsl:otherwise>
85
								<xsl:value-of select="dnet:extractYear(//datacite:date[1])" />
86
							</xsl:otherwise>
87
						</xsl:choose>
88
					</date>
89

    
90
					<language>
91
						<xsl:value-of select="TransformationFunction:convertString($tf, //dc:language[1], 'Languages')" />
92
					</language>
93

    
94
					<xsl:variable name="infoType" select="normalize-space(//oaire:resourceType[contains(., 'info:eu-repo/semantics')])" />
95
					<xsl:variable name="peopleType" select="normalize-space(//oaire:resourceType[not(contains(., 'info:eu-repo/semantics'))])" />
96
					<xsl:choose>
97
						<xsl:when test="//oaire:resourceType/@uri">
98
							<type><xsl:value-of select="TransformationFunction:convertString($tf, //oaire:resourceType/@uri, 'IopTypologies')" /></type>
99
						</xsl:when>
100
						<xsl:when test="//oaire:resourceType">
101
							<type><xsl:value-of select="TransformationFunction:convertString($tf, //oaire:resourceType, 'IopTypologies')" /></type>
102
						</xsl:when>
103
						<xsl:otherwise>
104
							<type>Other</type>
105
						</xsl:otherwise>
106
					</xsl:choose>
107

    
108

    
109
					<!-- TODO -->
110
					<xsl:choose>
111
						<xsl:when test="starts-with(normalize-space(//dri:repositoryId), '807f0d50-2dc9-447d-8914-b91c34cb5841')">
112
							<documentPage>
113
								<xsl:value-of select="concat('https://openportal.isti.cnr.it/doc?id=people______::', dnet:md5(normalize-space(//dri:recordIdentifier)))" />
114
							</documentPage>
115
						</xsl:when>
116
						<xsl:when test="starts-with(normalize-space(//dri:repositoryId), 'a58f6fed-ac2d-4cfe-a175-d809858b0eeb')">
117
							<documentPage>
118
								<xsl:value-of select="concat('https://openportal.ispc.cnr.it/doc?id=people______::', dnet:md5(normalize-space(//dri:recordIdentifier)))" />
119
							</documentPage>
120
						</xsl:when>
121
						<xsl:when test="starts-with(normalize-space(//dri:repositoryId), 'db0e729d-38d0-44e1-9750-80d3c048525d')">
122
							<documentPage>
123
								<xsl:value-of select="concat('https://openportal.ismar.cnr.it/doc?id=people______::', dnet:md5(normalize-space(//dri:recordIdentifier)))" />
124
							</documentPage>
125
						</xsl:when>
126
						<xsl:when test="starts-with(normalize-space(//dri:repositoryId), '5bdb0333-29f0-40c9-ad33-1fc4de6b2efa')">
127
							<documentPage>
128
								<xsl:value-of select="concat('https://openportal.ino.cnr.it/doc?id=people______::', dnet:md5(normalize-space(//dri:recordIdentifier)))" />
129
							</documentPage>
130
						</xsl:when>
131
					</xsl:choose>
132
					<!-- END TODO -->
133
					
134
					<urls>
135
						<xsl:for-each select="//datacite:identifier|//datacite:alternateIdentifier">
136
							<xsl:if test="starts-with(., 'http') and contains(., 'www.cnr.it')">
137
								<!-- <url rights="Unknown" hostedBy="CNR People"><xsl:value-of select="."/></url>-->
138
							</xsl:if>
139
							<xsl:if test="starts-with(., 'http') and contains(., 'publications.cnr.it')">
140
								<url rights="Unknown" hostedBy="CNR ExploRA">
141
									<xsl:value-of select="." />
142
								</url>
143
							</xsl:if>
144
							<xsl:if test="starts-with(., 'http') and not(contains(., 'doi.org/')) and not(contains(., '/www.cnr.it/')) and not(contains(., '/publications.cnr.it/'))">
145
								<url rights="{$rights}" hostedBy="{dnet:serverName(.)}">
146
									<xsl:value-of select="." />
147
								</url>
148
							</xsl:if>
149
							<xsl:if test="starts-with(., 'http') and contains(., 'doi.org/')">
150
								<xsl:variable name="doi" select="dnet:cleanDoi(substring-after(., 'doi.org/'))" />
151
								<url rights="{$rights}" hostedBy="DOI Resolver">
152
									<xsl:value-of select="concat('https://dx.doi.org/', $doi)" />
153
								</url>
154
							</xsl:if>
155
							<xsl:if test="starts-with(., 'info:doi:')">
156
								<xsl:variable name="doi" select="dnet:cleanDoi(substring-after(., 'info:doi:'))" />
157
								<url rights="{$rights}" hostedBy="DOI Resolver">
158
									<xsl:value-of select="concat('https://dx.doi.org/', $doi)" />
159
								</url>
160
							</xsl:if>
161
						</xsl:for-each>
162
						<xsl:for-each select="//oaire:file">
163
							<xsl:if test="starts-with(., 'http') and contains(., 'iris.cnr.it')">
164
								<url rights="{$rights}" hostedBy="CNR IRIS">
165
									<xsl:value-of select="." />
166
								</url>
167
							</xsl:if>
168
						</xsl:for-each>
169
					</urls>
170

    
171
					<dois>
172
						<xsl:for-each select="//datacite:identifier|//datacite:alternateIdentifier">
173
							<xsl:if test="starts-with(., 'info:doi:')">
174
								<xsl:variable name="doi" select="dnet:cleanDoi(substring-after(., 'info:doi:'))" />
175
								<xsl:if test="$doi">
176
									<doi>
177
										<xsl:value-of select="$doi" />
178
									</doi>
179
								</xsl:if>
180
							</xsl:if>
181
							<xsl:if test="starts-with(., 'http') and contains(., 'doi.org/')">
182
								<xsl:variable name="doi" select="dnet:cleanDoi(substring-after(., 'doi.org/'))" />
183
								<xsl:if test="$doi">
184
									<doi>
185
										<xsl:value-of select="$doi" />
186
									</doi>
187
								</xsl:if>
188
							</xsl:if>
189
						</xsl:for-each>
190
					</dois>
191

    
192
					<xsl:choose>
193
						<xsl:when test="//datacite:identifier[starts-with(., 'http') and not(contains(., '/www.cnr.it/')) and not(contains(., '/publications.cnr.it/'))] | //datacite:alternateIdentifier[starts-with(., 'http') and not(contains(., '/www.cnr.it/')) and not(contains(., '/publications.cnr.it/'))]">
194
							<bestRights>
195
								<xsl:value-of select="$rights" />
196
							</bestRights>
197
						</xsl:when>
198
						<xsl:when test="//datacite:identifier[starts-with(., 'info:doi:')]">
199
							<bestRights>
200
								<xsl:value-of select="$rights" />
201
							</bestRights>
202
						</xsl:when>
203
						<xsl:otherwise>
204
							<bestRights>Unknown</bestRights>
205
						</xsl:otherwise>
206
					</xsl:choose>
207

    
208
					<abstract>
209
						<xsl:value-of select="//dc:description[1]" />
210
					</abstract>
211

    
212
					<!-- TODO -->
213
					<xsl:for-each select="//dc:source[(string-length(.) > 10) and not(starts-with(., 'info:cnr-pdr/source'))]">
214
						<xsl:if test="position() = 1">
215
							<source>
216
								<xsl:value-of select="." />
217
							</source>
218
						</xsl:if>
219
					</xsl:for-each>
220
					<!-- END TODO -->
221
					
222
					<projects>
223
						<xsl:for-each select="//oaire:fundingReference">
224
								<project>
225
									<infoId/>
226
									<openaireId />
227
									<code>
228
										<xsl:value-of select="./oaire:awardNumber" />
229
									</code>
230
									<name>
231
										<xsl:value-of select="./oaire:awardTitle" />
232
									</name>
233
									<acronym>
234
										<xsl:value-of select="./oaire:awardTitle" />
235
									</acronym>
236
									<funder>
237
										<xsl:value-of select="./oaire:funderName"/>
238
									</funder>
239
									<program>
240
										<xsl:value-of select="./oaire:fundingStream" />
241
									</program>
242
									<jurisdiction />
243
								</project>
244
						</xsl:for-each>
245
					</projects>
246
					
247
					<!-- TODO -->					
248
					<cnrPersons>
249
						<xsl:for-each select="//datacite:creatorName">
250
							<xsl:variable name="orcid" select="../datacite:nameIdentifier[@nameIdentifierScheme='ORCID']"/>
251
							<xsl:for-each select="tokenize(dnet:cleanNames(.), '#')">
252
								<xsl:if test="string-length(.) &gt; 0">
253
									<cnrPerson>
254
										<infoId/>
255
										<name><xsl:value-of select="." /></name>
256
										<orcid><xsl:value-of select="$orcid"/></orcid>
257
									</cnrPerson>
258
								</xsl:if>
259
							</xsl:for-each>
260
						</xsl:for-each>
261
					</cnrPersons>
262
					<!-- END TODO -->
263
					
264
					<citations />
265

    
266
					<collections>
267
						<xsl:for-each select="//oai:setSpec[normalize-space(.) != 'openaire']">
268
							<inCollection>
269
								<code>
270
									<xsl:value-of select="normalize-space(.)" />
271
								</code>
272
								<name />
273
								<acronym />
274
							</inCollection>
275
						</xsl:for-each>
276
					</collections>
277
					
278
				</record>
279

    
280
			</oai:metadata>
281
		</oai:record>
282
	</xsl:template>
283
</xsl:stylesheet>
(3-3/3)