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