Project

General

Profile

1
<?xml version="1.0" encoding="UTF-8"?>
2
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3
>
4

    
5
	<xsl:param name="parentDatasourceId"/>
6

    
7
	<xsl:template name="dateCorda">
8
		<xsl:param name="datename"/>
9
		<xsl:param name="datevalue"/>
10
		<FIELD name="{$datename}" type="date" format="dd-MMM-yyyy">
11
			<xsl:value-of select="concat(substring($datevalue, 1, 2),'-',substring($datevalue,3,3),'-',substring($datevalue,6,4))"/>
12
		</FIELD>
13
	</xsl:template>
14

    
15
	<xsl:variable name="namespacePrefix" select="string('ec__________')"/>
16
	<xsl:variable name="funderID" select="concat($namespacePrefix, '::EC')"/>
17

    
18
	<xsl:template match="/">
19
		<record
20
		>
21

    
22
			<xsl:copy-of select=".//*[local-name()='header']"/>
23

    
24
			<metadata>
25
				<ROWS>
26
					<xsl:for-each select="//Project">
27

    
28
						<xsl:variable name="toaCode" select="./ProjectTOACode"/>
29
						<xsl:variable name="fundingId">
30
							<xsl:choose>
31
								<xsl:when test="$toaCode and starts-with($toaCode, 'ERC-')">
32
									<xsl:value-of select="concat($funderID, '::H2020::ERC::', $toaCode)"/>
33
								</xsl:when>
34
								<xsl:when test="$toaCode and not(starts-with($toaCode, 'ERC-'))">
35
									<xsl:value-of select="concat($funderID, '::H2020::', $toaCode)"/>
36
								</xsl:when>
37
								<xsl:otherwise>
38
									<xsl:value-of select="concat($funderID, '::H2020')"/>
39
								</xsl:otherwise>
40
							</xsl:choose>
41
						</xsl:variable>
42
						<xsl:variable name="projectId" select="concat('corda__h2020::', normalize-space(./ProjectId))"/>
43

    
44
						<ROW table="projects">
45
							<FIELD name="_dnet_resource_identifier_">
46
								<xsl:value-of select="$projectId"/>
47
							</FIELD>
48
							<FIELD name="id">
49
								<xsl:value-of select="$projectId"/>
50
							</FIELD>
51
							<FIELD name="code">
52
								<xsl:value-of select="./ProjectId"/>
53
							</FIELD>
54
							<FIELD name="acronym">
55
								<xsl:value-of select="./ProjectAcronym"/>
56
							</FIELD>
57
							<FIELD name="title">
58
								<xsl:value-of select="./ProjectTitle"/>
59
							</FIELD>
60
							<xsl:call-template name="dateCorda">
61
								<xsl:with-param name="datename">startdate</xsl:with-param>
62
								<xsl:with-param name="datevalue" select="./ProjectStartDate"></xsl:with-param>
63
							</xsl:call-template>
64
							<xsl:call-template name="dateCorda">
65
								<xsl:with-param name="datename">enddate</xsl:with-param>
66
								<xsl:with-param name="datevalue" select="./ProjectEndDate"></xsl:with-param>
67
							</xsl:call-template>
68
							<FIELD name="call_identifier">
69
								<xsl:value-of select="./ProjectCallIdentifier"/>
70
							</FIELD>
71
							<FIELD name="oa_mandate_for_publications" type="boolean">true</FIELD>
72
							<FIELD name="ec_article29_3" type="boolean">
73
								<xsl:value-of select="./Article29-3"/>
74
							</FIELD>
75
							<FIELD name="collectedfrom">
76
								<xsl:value-of select="$parentDatasourceId"/>
77
							</FIELD>
78
							<FIELD name="contracttypeclass">
79
								<xsl:value-of select="./ProjectTOACode"/>
80
							</FIELD>
81
							<FIELD name="contracttypescheme">ec:h2020toas</FIELD>
82
							<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
83
							<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
84
							<FIELD name="websiteurl">
85
								<xsl:value-of select="./ProjectInternetAddress"/>
86
							</FIELD>
87
							<FIELD name="optional1">
88
								<xsl:value-of select="./ProjectTopicCode"/>
89
							</FIELD>
90
							<FIELD name="optional2">
91
								<xsl:value-of select="./ProjectTopicDescr"/>
92
							</FIELD>
93
							<xsl:variable name="personSurname" select="./CoordinatorContactPerson/PersonLastName"/>
94
							<xsl:variable name="personFirstName" select="./CoordinatorContactPerson/PersonFirstName"/>
95
							<xsl:variable name="contactfullname">
96
								<xsl:choose>
97
									<xsl:when test="string-length($personFirstName) &gt; 0 and string-length($personSurname) &gt; 0">
98
										<xsl:value-of select="normalize-space(concat($personSurname, ', ', $personFirstName))"/>
99
									</xsl:when>
100
									<xsl:when test="string-length($personFirstName) &gt; 0">
101
										<xsl:value-of select="normalize-space($personFirstName)"/>
102
									</xsl:when>
103
									<xsl:when test="string-length($personSurname) &gt; 0">
104
										<xsl:value-of select="normalize-space($personSurname)"/>
105
									</xsl:when>
106
									<xsl:otherwise>
107
										<xsl:value-of select="''"/>
108
									</xsl:otherwise>
109
								</xsl:choose>
110
							</xsl:variable>
111
							<xsl:if test="string-length($contactfullname) &gt; 0">
112
								<FIELD name="contactfullname">
113
									<xsl:value-of select="$contactfullname"/>
114
								</FIELD>
115
							</xsl:if>
116
							<xsl:variable name="contactfax" select="normalize-space(./CoordinatorContactPerson/ContactFax)"/>
117
							<xsl:if test="string-length($contactfax) &gt; 0">
118
								<FIELD name="contactfax">
119
									<xsl:value-of select="$contactfax"/>
120
								</FIELD>
121
							</xsl:if>
122
							<xsl:variable name="contactphone" select="normalize-space(./CoordinatorContactPerson/ContactPhone)"/>
123
							<xsl:if test="string-length($contactphone) &gt; 0">
124
								<FIELD name="contactphone">
125
									<xsl:value-of select="$contactphone"/>
126
								</FIELD>
127
							</xsl:if>
128
							<xsl:variable name="contactemail" select="normalize-space(./CoordinatorContactPerson/ContactEmail)"/>
129
							<xsl:if test="string-length($contactemail) &gt; 0">
130
								<FIELD name="contactemail">
131
									<xsl:value-of select="$contactemail"/>
132
								</FIELD>
133
							</xsl:if>
134
						</ROW>
135
						<xsl:for-each select="./OrganisationParticipant">
136
							<xsl:variable name="organizationId" select="concat('corda__h2020::', ./OrganisationPIC)"/>
137

    
138
							<xsl:variable name="whitelist" select="'0123456789'"/>
139
							<ROW table="organizations">
140
								<FIELD name="_dnet_resource_identifier_">
141
									<xsl:value-of select="$organizationId"/>
142
								</FIELD>
143
								<FIELD name="id">
144
									<xsl:value-of select="$organizationId"/>
145
								</FIELD>
146
								<FIELD name="legalshortname">
147
									<xsl:value-of select="./OrganisationShortName"/>
148
								</FIELD>
149
								<FIELD name="legalname">
150
									<xsl:value-of select="./OrganisationLegalName"/>
151
								</FIELD>
152
								<FIELD name="websiteurl">
153
									<xsl:choose>
154
										<xsl:when test="starts-with(normalize-space(./OrganisationWebPage), 'http')">
155
											<xsl:value-of select="./OrganisationWebPage"/>
156
										</xsl:when>
157
										<xsl:when test="string-length(normalize-space(./OrganisationWebPage)) &gt; 0">
158
											<xsl:value-of select="concat('http://', normalize-space(./OrganisationWebPage))"/>
159
										</xsl:when>
160
									</xsl:choose>
161
								</FIELD>
162
								<FIELD name="ec_legalbody" type="boolean">
163
									<xsl:value-of select="./PublicBody"/>
164
								</FIELD>
165
								<FIELD name="ec_legalperson" type="boolean">
166
									<xsl:value-of select="./LegalPerson"/>
167
								</FIELD>
168
								<FIELD name="ec_nonprofit" type="boolean">
169
									<xsl:value-of select="./NonProfit"/>
170
								</FIELD>
171
								<FIELD name="ec_researchorganization" type="boolean">
172
									<xsl:value-of select="./ResearchOrganisation"/>
173
								</FIELD>
174
								<FIELD name="ec_highereducation" type="boolean">
175
									<xsl:value-of select="./HigherEducation"/>
176
								</FIELD>
177
								<FIELD name="ec_internationalorganizationeurinterests" type="boolean">
178
									<xsl:value-of select="./InternationalOrgEurInterest"/>
179
								</FIELD>
180
								<FIELD name="ec_internationalorganization" type="boolean">
181
									<xsl:value-of select="./InternationalOrgEurInterest"/>
182
								</FIELD>
183
								<FIELD name="ec_smevalidated" type="boolean">
184
									<xsl:value-of select="./SMEValidated"/>
185
								</FIELD>
186
								<FIELD name="countryclass">
187
									<xsl:value-of select="./OrganisationCountry"/>
188
								</FIELD>
189
								<FIELD name="countryscheme">dnet:countries</FIELD>
190
								<FIELD name="collectedfrom">
191
									<xsl:value-of select="$parentDatasourceId"/>
192
								</FIELD>
193
								<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
194
								<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
195
								<FIELD name="trust" type="float">
196
									<xsl:value-of select="0.92"/>
197
								</FIELD>
198
							</ROW>
199

    
200
							<ROW table="project_organization">
201
								<FIELD name="_dnet_resource_identifier_">
202
									<xsl:value-of select='concat($projectId, "@@", $organizationId)'/>
203
								</FIELD>
204
								<xsl:choose>
205
									<xsl:when test="string-length(translate(./ParticipantOrder, $whitelist, '')) &gt; 0">
206
										<FIELD name="participantnumber" type="int">9999</FIELD>
207
									</xsl:when>
208
									<xsl:otherwise>
209
										<FIELD name="participantnumber" type="int">
210
											<xsl:value-of select="./ParticipantOrder"/>
211
										</FIELD>
212
									</xsl:otherwise>
213
								</xsl:choose>
214
								<FIELD name="project">
215
									<xsl:value-of select="$projectId"/>
216
								</FIELD>
217
								<FIELD name="resporganization">
218
									<xsl:value-of select="$organizationId"/>
219
								</FIELD>
220
								<xsl:choose>
221
									<xsl:when test="./ParticipantOrder = 1">
222
										<FIELD name="semanticclass">coordinator</FIELD>
223
									</xsl:when>
224
									<xsl:otherwise>
225
										<FIELD name="semanticclass">participant</FIELD>
226
									</xsl:otherwise>
227
								</xsl:choose>
228
								<FIELD name="semanticscheme">dnet:project_organization_relations</FIELD>
229
							</ROW>
230
						</xsl:for-each>
231

    
232
						<ROW table="subjects">
233
							<FIELD name="_dnet_resource_identifier_">
234
								<xsl:value-of select="concat('corda__h2020::', normalize-space(./ProjectTopicCode))"/>
235
							</FIELD>
236
							<FIELD name="id">
237
								<xsl:value-of select="concat('corda__h2020::', normalize-space(./ProjectTopicCode))"/>
238
							</FIELD>
239
							<FIELD name="name">
240
								<xsl:value-of select="./ProjectTopicDescr"/>
241
							</FIELD>
242
							<FIELD name="semanticclass">ec:h2020topics</FIELD>
243
							<FIELD name="semanticscheme">dnet:subject_classification_typologies</FIELD>
244
						</ROW>
245

    
246
						<ROW table="project_subject">
247
							<FIELD name="_dnet_resource_identifier_">
248
								<xsl:value-of select="concat($projectId, '@@corda__h2020::', normalize-space(./ProjectTopicCode))"/>
249
							</FIELD>
250
							<FIELD name="project">
251
								<xsl:value-of select="$projectId"/>
252
							</FIELD>
253
							<FIELD name="subject">
254
								<xsl:value-of select="concat('corda__h2020::', normalize-space(./ProjectTopicCode))"/>
255
							</FIELD>
256
						</ROW>
257

    
258
						<ROW table="project_fundingpath">
259
							<FIELD name="_dnet_resource_identifier_">
260
								<xsl:value-of select="concat($fundingId, '@@', $projectId)"/>
261
							</FIELD>
262
							<FIELD name="funding">
263
								<xsl:value-of select="$fundingId"/>
264
							</FIELD>
265
							<FIELD name="project">
266
								<xsl:value-of select="$projectId"/>
267
							</FIELD>
268
							<xsl:call-template name="dateCorda">
269
								<xsl:with-param name="datename">startdate</xsl:with-param>
270
								<xsl:with-param name="datevalue" select="./ProjectStartDate"></xsl:with-param>
271
							</xsl:call-template>
272
							<xsl:call-template name="dateCorda">
273
								<xsl:with-param name="datename">enddate</xsl:with-param>
274
								<xsl:with-param name="datevalue" select="./ProjectEndDate"></xsl:with-param>
275
							</xsl:call-template>
276
							<FIELD name="semanticclass">
277
								<xsl:value-of select="./ProjectTOACode"/>
278
							</FIELD>
279
							<FIELD name="semanticscheme">ec:h2020toas</FIELD>
280
						</ROW>
281
					</xsl:for-each>
282

    
283
				</ROWS>
284
			</metadata>
285
		</record>
286
	</xsl:template>
287
</xsl:stylesheet>
(5-5/27)