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
	<xsl:param name="parentDatasourceId"/>
5

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

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

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

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

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

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

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

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

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

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

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

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

    
281
				</ROWS>
282
			</metadata>
283
		</record>
284
	</xsl:template>
285
</xsl:stylesheet>
(7-7/31)