1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
3
|
|
4
|
<xsl:param name="parentDatasourceId"/>
|
5
|
<xsl:param name="namespacePrefix" select="string('nsf_________')"/>
|
6
|
|
7
|
<xsl:template match="/">
|
8
|
<record>
|
9
|
|
10
|
<xsl:copy-of select=".//*[local-name()='header']"/>
|
11
|
<metadata>
|
12
|
<ROWS>
|
13
|
<xsl:if test="string-length(normalize-space(.//AwardTitle)) > 0 and string-length(normalize-space(.//AwardID)) > 0">
|
14
|
|
15
|
<xsl:variable name="projectId" select="concat($namespacePrefix, '::', normalize-space(.//AwardID))"/>
|
16
|
<xsl:variable name="orgId" select="concat($namespacePrefix, '::', translate(normalize-space(.//Institution/Name), ' ,.', '___'))"/>
|
17
|
<xsl:variable name="startDate" select=".//AwardEffectiveDate"/>
|
18
|
<xsl:variable name="endDate" select=".//AwardExpirationDate"/>
|
19
|
|
20
|
<ROW table="projects">
|
21
|
<FIELD name="_dnet_resource_identifier_">
|
22
|
<xsl:value-of select="$projectId"/>
|
23
|
</FIELD>
|
24
|
<FIELD name="id">
|
25
|
<xsl:value-of select="$projectId"/>
|
26
|
</FIELD>
|
27
|
<FIELD name="code">
|
28
|
<xsl:value-of select=".//AwardID"/>
|
29
|
</FIELD>
|
30
|
<FIELD name="startdate" type="date" format="MM/dd/yyyy">
|
31
|
<xsl:value-of select="$startDate"/>
|
32
|
</FIELD>
|
33
|
<FIELD name="enddate" type="date" format="MM/dd/yyyy">
|
34
|
<xsl:value-of select="$endDate"/>
|
35
|
</FIELD>
|
36
|
<FIELD name="title">
|
37
|
<xsl:value-of select=".//AwardTitle"/>
|
38
|
</FIELD>
|
39
|
<FIELD name="contracttypeclass">
|
40
|
<xsl:value-of select=".//AwardInstrument/Value"/>
|
41
|
</FIELD>
|
42
|
<FIELD name="contracttypescheme">nsf:contractTypes</FIELD>
|
43
|
<FIELD name="acronym"></FIELD>
|
44
|
<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
|
45
|
<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
|
46
|
<FIELD name="collectedfrom">
|
47
|
<xsl:value-of select="$parentDatasourceId"/>
|
48
|
</FIELD>
|
49
|
<!-- <FIELD name="???"><xsl:value-of select=".//AbstractNarration" /></FIELD> -->
|
50
|
</ROW>
|
51
|
|
52
|
<ROW table="organizations">
|
53
|
<FIELD name="_dnet_resource_identifier_">
|
54
|
<xsl:value-of select="$orgId"/>
|
55
|
</FIELD>
|
56
|
<FIELD name="id">
|
57
|
<xsl:value-of select="$orgId"/>
|
58
|
</FIELD>
|
59
|
<FIELD name="legalname">
|
60
|
<xsl:value-of select=".//Institution/Name"/>
|
61
|
</FIELD>
|
62
|
<FIELD name="collectedfrom">
|
63
|
<xsl:value-of select="$parentDatasourceId"/>
|
64
|
</FIELD>
|
65
|
<xsl:if test="string-length(normalize-space(.//Institution/CountryName)) > 0">
|
66
|
<FIELD name="countryclass">
|
67
|
<xsl:value-of select=".//Institution/CountryName"/>
|
68
|
</FIELD>
|
69
|
</xsl:if>
|
70
|
<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
|
71
|
<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
|
72
|
<FIELD name="optional1">
|
73
|
<xsl:value-of select=".//Institution/CityName"/>
|
74
|
</FIELD>
|
75
|
<FIELD name="optional2">
|
76
|
<xsl:value-of select=".//Institution/StreetAddress"/>
|
77
|
</FIELD>
|
78
|
</ROW>
|
79
|
|
80
|
<xsl:for-each select=".//Investigator[./RoleCode='Principal Investigator'] | .//Investigator[./RoleCode='Co-Principal Investigator'] | .//Investigator[./RoleCode='Former Principal Investigator'] | .//Investigator[./RoleCode='Former Co-Principal Investigator']">
|
81
|
<xsl:if test="position() = 1">
|
82
|
<xsl:variable name="personName" select="normalize-space(./FirstName)"/>
|
83
|
<xsl:variable name="personSurname" select="normalize-space(./LastName)"></xsl:variable>
|
84
|
<xsl:if test="$personName != '' and $personSurname != '' and $personName != 'NO DATA AVAILABLE' and $personSurname != 'NO DATA AVAILABLE'">
|
85
|
<xsl:variable name="personId" select="concat($projectId, '::', translate(concat($personName, ' ', $personSurname), ' ,.', '___'))"/>
|
86
|
<ROW table="persons">
|
87
|
<FIELD name="_dnet_resource_identifier_">
|
88
|
<xsl:value-of select="$personId"/>
|
89
|
</FIELD>
|
90
|
<FIELD name="id">
|
91
|
<xsl:value-of select="$personId"/>
|
92
|
</FIELD>
|
93
|
<FIELD name="firstname">
|
94
|
<xsl:value-of select="./FirstName"/>
|
95
|
</FIELD>
|
96
|
<FIELD name="secondnames">
|
97
|
<xsl:value-of select="./LastName"/>
|
98
|
</FIELD>
|
99
|
<FIELD name="email">
|
100
|
<xsl:value-of select="./EmailAddress"/>
|
101
|
</FIELD>
|
102
|
<FIELD name="collectedfrom">
|
103
|
<xsl:value-of select="$parentDatasourceId"/>
|
104
|
</FIELD>
|
105
|
<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
|
106
|
<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
|
107
|
<FIELD name="optional1">
|
108
|
<xsl:value-of select="./RoleCode"/>
|
109
|
</FIELD>
|
110
|
</ROW>
|
111
|
</xsl:if>
|
112
|
</xsl:if>
|
113
|
</xsl:for-each>
|
114
|
|
115
|
<ROW table="project_organization">
|
116
|
<FIELD name="_dnet_resource_identifier_">
|
117
|
<xsl:value-of select="concat($projectId, '@@', $orgId)"/>
|
118
|
</FIELD>
|
119
|
<FIELD name="participantnumber" type="int">1</FIELD>
|
120
|
<FIELD name="startdate" type="date" format="MM/dd/yyyy">
|
121
|
<xsl:value-of select="$startDate"/>
|
122
|
</FIELD>
|
123
|
<FIELD name="enddate" type="date" format="MM/dd/yyyy">
|
124
|
<xsl:value-of select="$endDate"/>
|
125
|
</FIELD>
|
126
|
<FIELD name="project">
|
127
|
<xsl:value-of select="$projectId"/>
|
128
|
</FIELD>
|
129
|
<FIELD name="resporganization">
|
130
|
<xsl:value-of select="$orgId"/>
|
131
|
</FIELD>
|
132
|
<xsl:for-each select=".//Investigator[./RoleCode='Principal Investigator'] | .//Investigator[./RoleCode='Co-Principal Investigator'] | .//Investigator[./RoleCode='Former Principal Investigator'] | .//Investigator[./RoleCode='Former Co-Principal Investigator']">
|
133
|
<xsl:if test="position() = 1">
|
134
|
<xsl:variable name="personName" select="normalize-space(./FirstName)"/>
|
135
|
<xsl:variable name="personSurname" select="normalize-space(./LastName)"></xsl:variable>
|
136
|
<xsl:if test="$personName != '' and $personSurname != '' and $personName != 'NO DATA AVAILABLE' and $personSurname != 'NO DATA AVAILABLE'">
|
137
|
<FIELD name="contactperson">
|
138
|
<xsl:value-of select="concat($projectId, '::', translate(concat($personName, ' ', $personSurname), ' ,.', '___'))"/>
|
139
|
</FIELD>
|
140
|
</xsl:if>
|
141
|
</xsl:if>
|
142
|
</xsl:for-each>
|
143
|
|
144
|
<FIELD name="semanticclass">coordinator</FIELD>
|
145
|
<FIELD name="semanticscheme">dnet:project_organization_relations</FIELD>
|
146
|
</ROW>
|
147
|
|
148
|
<xsl:for-each select=".//FoaInformation">
|
149
|
<xsl:variable name="subjectId" select="concat($namespacePrefix, '::', normalize-space(./Code))"/>
|
150
|
|
151
|
<ROW table="subjects">
|
152
|
<FIELD name="_dnet_resource_identifier_">
|
153
|
<xsl:value-of select="$subjectId"/>
|
154
|
</FIELD>
|
155
|
<FIELD name="id">
|
156
|
<xsl:value-of select="$subjectId"/>
|
157
|
</FIELD>
|
158
|
<FIELD name="name">
|
159
|
<xsl:value-of select="./Name"/>
|
160
|
</FIELD>
|
161
|
<FIELD name="semanticclass">nsf:fieldOfApplication</FIELD>
|
162
|
<FIELD name="semanticscheme">dnet:subject_classification_typologies</FIELD>
|
163
|
</ROW>
|
164
|
|
165
|
<ROW table="project_subject">
|
166
|
<FIELD name="_dnet_resource_identifier_">
|
167
|
<xsl:value-of select="concat($projectId, '@@', $subjectId)"/>
|
168
|
</FIELD>
|
169
|
<FIELD name="project">
|
170
|
<xsl:value-of select="$projectId"/>
|
171
|
</FIELD>
|
172
|
<FIELD name="subject">
|
173
|
<xsl:value-of select="$subjectId"/>
|
174
|
</FIELD>
|
175
|
</ROW>
|
176
|
</xsl:for-each>
|
177
|
<!--
|
178
|
<xsl:for-each select=".//ProgramElement">
|
179
|
<xsl:if test="string-length(normalize-space(./Code)) > 0">
|
180
|
<xsl:variable name="fundingId" select="concat($namespacePrefix, '::NSF::PEC::', normalize-space(./Code))" />
|
181
|
<ROW table="project_fundingpath">
|
182
|
<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="concat($fundingId,'@@', $projectId)" /></FIELD>
|
183
|
<FIELD name="funding"><xsl:value-of select="$fundingId" /></FIELD>
|
184
|
<FIELD name="project"><xsl:value-of select="$projectId" /></FIELD>
|
185
|
<FIELD name="startdate" type="date" format="MM/dd/yyyy"><xsl:value-of select="$startDate" /></FIELD>
|
186
|
<FIELD name="enddate" type="date" format="MM/dd/yyyy"><xsl:value-of select="$endDate" /></FIELD>
|
187
|
</ROW>
|
188
|
</xsl:if>
|
189
|
</xsl:for-each>
|
190
|
|
191
|
<xsl:for-each select=".//ProgramReference">
|
192
|
<xsl:if test="string-length(normalize-space(./Code)) > 0">
|
193
|
<xsl:variable name="fundingId" select="concat($namespacePrefix, '::NSF::PRC::', normalize-space(./Code))"/>
|
194
|
<ROW table="project_fundingpath">
|
195
|
<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="concat($fundingId,'@@', $projectId)" /></FIELD>
|
196
|
<FIELD name="funding"><xsl:value-of select="$fundingId" /></FIELD>
|
197
|
<FIELD name="project"><xsl:value-of select="$projectId" /></FIELD>
|
198
|
<FIELD name="startdate" type="date" format="MM/dd/yyyy"><xsl:value-of select="$startDate" /></FIELD>
|
199
|
<FIELD name="enddate" type="date" format="MM/dd/yyyy"><xsl:value-of select="$endDate" /></FIELD>
|
200
|
</ROW>
|
201
|
</xsl:if>
|
202
|
</xsl:for-each>
|
203
|
-->
|
204
|
|
205
|
|
206
|
<xsl:for-each select="//funding">
|
207
|
<xsl:variable name="directorate" select="normalize-space(./orgDirectorateAbbr)"/>
|
208
|
<xsl:variable name="division" select="normalize-space(./orgDivisionAbbr)"/>
|
209
|
<xsl:variable name="fundingId">
|
210
|
<xsl:choose>
|
211
|
<xsl:when test="string-length($directorate) > 0">
|
212
|
<xsl:choose>
|
213
|
<xsl:when test="string-length($division) > 0">
|
214
|
<xsl:value-of select="concat($namespacePrefix, '::NSF::', $directorate, '::', $division)"/>
|
215
|
</xsl:when>
|
216
|
<xsl:otherwise>
|
217
|
<xsl:value-of select="concat($namespacePrefix, '::NSF::', $directorate)"/>
|
218
|
</xsl:otherwise>
|
219
|
</xsl:choose>
|
220
|
</xsl:when>
|
221
|
<xsl:otherwise>
|
222
|
<xsl:value-of select="concat($namespacePrefix, '::NSF')"/>
|
223
|
</xsl:otherwise>
|
224
|
</xsl:choose>
|
225
|
</xsl:variable>
|
226
|
|
227
|
<ROW table="project_fundingpath">
|
228
|
<FIELD name="_dnet_resource_identifier_">
|
229
|
<xsl:value-of select="concat($fundingId,'@@', $projectId)"/>
|
230
|
</FIELD>
|
231
|
<FIELD name="funding">
|
232
|
<xsl:value-of select="$fundingId"/>
|
233
|
</FIELD>
|
234
|
<FIELD name="project">
|
235
|
<xsl:value-of select="$projectId"/>
|
236
|
</FIELD>
|
237
|
<FIELD name="startdate" type="date" format="MM/dd/yyyy">
|
238
|
<xsl:value-of select="$startDate"/>
|
239
|
</FIELD>
|
240
|
<FIELD name="enddate" type="date" format="MM/dd/yyyy">
|
241
|
<xsl:value-of select="$endDate"/>
|
242
|
</FIELD>
|
243
|
</ROW>
|
244
|
</xsl:for-each>
|
245
|
|
246
|
<!-- If there is no funding element at all, let's add a funding path that contains only the funder. -->
|
247
|
<xsl:if test="not(//funding)">
|
248
|
<xsl:variable name="fundingId" select="concat($namespacePrefix, '::NSF')"/>
|
249
|
<ROW table="project_fundingpath">
|
250
|
<FIELD name="_dnet_resource_identifier_">
|
251
|
<xsl:value-of select="concat($fundingId,'@@', $projectId)"/>
|
252
|
</FIELD>
|
253
|
<FIELD name="funding">
|
254
|
<xsl:value-of select="$fundingId"/>
|
255
|
</FIELD>
|
256
|
<FIELD name="project">
|
257
|
<xsl:value-of select="$projectId"/>
|
258
|
</FIELD>
|
259
|
<FIELD name="startdate" type="date" format="MM/dd/yyyy">
|
260
|
<xsl:value-of select="$startDate"/>
|
261
|
</FIELD>
|
262
|
<FIELD name="enddate" type="date" format="MM/dd/yyyy">
|
263
|
<xsl:value-of select="$endDate"/>
|
264
|
</FIELD>
|
265
|
</ROW>
|
266
|
</xsl:if>
|
267
|
|
268
|
</xsl:if>
|
269
|
</ROWS>
|
270
|
</metadata>
|
271
|
</record>
|
272
|
</xsl:template>
|
273
|
|
274
|
<xsl:template name="getContactPersonId">
|
275
|
<xsl:param name="projectID"/>
|
276
|
<xsl:for-each select=".//Investigator[./RoleCode='Principal Investigator'] | .//Investigator[./RoleCode='Co-Principal Investigator'] | .//Investigator[./RoleCode='Former Principal Investigator'] | .//Investigator[./RoleCode='Former Co-Principal Investigator']">
|
277
|
<xsl:if test="position() = 1">
|
278
|
<xsl:variable name="personName" select="normalize-space(./FirstName)"/>
|
279
|
<xsl:variable name="personSurname" select="normalize-space(./LastName)"></xsl:variable>
|
280
|
<xsl:choose>
|
281
|
<xsl:when test="$personName != '' and $personSurname != '' and $personName != 'NO DATA AVAILABLE' and $personSurname != 'NO DATA AVAILABLE'">
|
282
|
<xsl:value-of select="concat($projectID, '::', translate(concat($personName, ' ', $personSurname), ' ,.', '___'))"/>
|
283
|
</xsl:when>
|
284
|
<xsl:otherwise>
|
285
|
<xsl:value-of select="string('NA')"/>
|
286
|
</xsl:otherwise>
|
287
|
</xsl:choose>
|
288
|
</xsl:if>
|
289
|
</xsl:for-each>
|
290
|
</xsl:template>
|
291
|
</xsl:stylesheet>
|