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
|
|
5
|
<xsl:param name="parentDatasourceId" />
|
6
|
<xsl:param name="namespacePrefix" select="string('nsf_________')" />
|
7
|
|
8
|
<xsl:template match="/">
|
9
|
<record
|
10
|
>
|
11
|
|
12
|
<xsl:copy-of select=".//*[local-name()='header']"/>
|
13
|
<metadata>
|
14
|
<ROWS>
|
15
|
<xsl:if test="string-length(normalize-space(.//AwardTitle)) > 0 and string-length(normalize-space(.//AwardID)) > 0">
|
16
|
|
17
|
<xsl:variable name="projectId" select="concat($namespacePrefix, '::', normalize-space(.//AwardID))" />
|
18
|
<xsl:variable name="orgId" select="concat($namespacePrefix, '::', translate(normalize-space(.//Institution/Name), ' ,.', '___'))" />
|
19
|
<xsl:variable name="startDate" select=".//AwardEffectiveDate"/>
|
20
|
<xsl:variable name="endDate" select=".//AwardExpirationDate"/>
|
21
|
|
22
|
<ROW table="projects">
|
23
|
<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="$projectId" /></FIELD>
|
24
|
<FIELD name="id"><xsl:value-of select="$projectId" /></FIELD>
|
25
|
<FIELD name="code"><xsl:value-of select=".//AwardID"/></FIELD>
|
26
|
<FIELD name="startdate" type="date" format="MM/dd/yyyy"><xsl:value-of select="$startDate" /></FIELD>
|
27
|
<FIELD name="enddate" type="date" format="MM/dd/yyyy"><xsl:value-of select="$endDate"/></FIELD>
|
28
|
<FIELD name="title"><xsl:value-of select=".//AwardTitle" /></FIELD>
|
29
|
<FIELD name="contracttypeclass"><xsl:value-of select=".//AwardInstrument/Value"/></FIELD>
|
30
|
<FIELD name="contracttypescheme">nsf:contractTypes</FIELD>
|
31
|
<FIELD name="acronym"> </FIELD>
|
32
|
<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
|
33
|
<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
|
34
|
<FIELD name="collectedfrom"><xsl:value-of select="$parentDatasourceId" /></FIELD>
|
35
|
<!-- <FIELD name="???"><xsl:value-of select=".//AbstractNarration" /></FIELD> -->
|
36
|
</ROW>
|
37
|
|
38
|
<ROW table="organizations">
|
39
|
<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="$orgId" /></FIELD>
|
40
|
<FIELD name="id"><xsl:value-of select="$orgId" /></FIELD>
|
41
|
<FIELD name="legalname"><xsl:value-of select=".//Institution/Name" /></FIELD>
|
42
|
<FIELD name="collectedfrom"><xsl:value-of select="$parentDatasourceId" /></FIELD>
|
43
|
<xsl:if test="string-length(normalize-space(.//Institution/CountryName)) > 0">
|
44
|
<FIELD name="countryclass"><xsl:value-of select=".//Institution/CountryName" /></FIELD>
|
45
|
</xsl:if>
|
46
|
<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
|
47
|
<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
|
48
|
<FIELD name="optional1"><xsl:value-of select=".//Institution/CityName" /></FIELD>
|
49
|
<FIELD name="optional2"><xsl:value-of select=".//Institution/StreetAddress" /></FIELD>
|
50
|
</ROW>
|
51
|
|
52
|
|
53
|
<xsl:for-each select=".//Investigator[./RoleCode='Principal Investigator'] | .//Investigator[./RoleCode='Co-Principal Investigator'] | .//Investigator[./RoleCode='Former Principal Investigator'] | .//Investigator[./RoleCode='Former Co-Principal Investigator']">
|
54
|
<xsl:if test="position() = 1">
|
55
|
<xsl:variable name="personId" select="concat($projectId, '::', translate(concat(./FirstName, ' ', .//LastName), ' ,.', '___'))" />
|
56
|
<ROW table="persons">
|
57
|
<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="$personId" /></FIELD>
|
58
|
<FIELD name="id"><xsl:value-of select="$personId" /></FIELD>
|
59
|
<FIELD name="firstname"><xsl:value-of select="./FirstName" /></FIELD>
|
60
|
<FIELD name="secondnames"><xsl:value-of select="./LastName" /></FIELD>
|
61
|
<FIELD name="email"><xsl:value-of select="./EmailAddress" /></FIELD>
|
62
|
<FIELD name="collectedfrom"><xsl:value-of select="$parentDatasourceId" /></FIELD>
|
63
|
<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
|
64
|
<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
|
65
|
<FIELD name="optional1"><xsl:value-of select="./RoleCode" /></FIELD>
|
66
|
</ROW>
|
67
|
</xsl:if>
|
68
|
</xsl:for-each>
|
69
|
|
70
|
<ROW table="project_organization">
|
71
|
<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="concat($projectId, '@@', $orgId)" /></FIELD>
|
72
|
<FIELD name="participantnumber" type="int">1</FIELD>
|
73
|
<FIELD name="startdate" type="date" format="MM/dd/yyyy"><xsl:value-of select="$startDate" /></FIELD>
|
74
|
<FIELD name="enddate" type="date" format="MM/dd/yyyy"><xsl:value-of select="$endDate" /></FIELD>
|
75
|
<FIELD name="project"><xsl:value-of select="$projectId" /></FIELD>
|
76
|
<FIELD name="resporganization"><xsl:value-of select="$orgId" /></FIELD>
|
77
|
<xsl:for-each select=".//Investigator[./RoleCode='Principal Investigator'] | .//Investigator[./RoleCode='Co-Principal Investigator'] | .//Investigator[./RoleCode='Former Principal Investigator'] | .//Investigator[./RoleCode='Former Co-Principal Investigator']">
|
78
|
<xsl:if test="position() = 1">
|
79
|
<FIELD name="contactperson"><xsl:value-of select="concat($projectId, '::', translate(concat(./FirstName, ' ', .//LastName), ' ,.', '___'))" /></FIELD>
|
80
|
</xsl:if>
|
81
|
</xsl:for-each>
|
82
|
<FIELD name="semanticclass">coordinator</FIELD>
|
83
|
<FIELD name="semanticscheme">dnet:project_organization_relations</FIELD>
|
84
|
</ROW>
|
85
|
|
86
|
<xsl:for-each select=".//FoaInformation">
|
87
|
<xsl:variable name="subjectId" select="concat($namespacePrefix, '::', normalize-space(./Code))"/>
|
88
|
|
89
|
<ROW table="subjects">
|
90
|
<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="$subjectId" /></FIELD>
|
91
|
<FIELD name="id"><xsl:value-of select="$subjectId" /></FIELD>
|
92
|
<FIELD name="name"><xsl:value-of select="./Name" /></FIELD>
|
93
|
<FIELD name="semanticclass">nsf:fieldOfApplication</FIELD>
|
94
|
<FIELD name="semanticscheme">dnet:subject_classification_typologies</FIELD>
|
95
|
</ROW>
|
96
|
|
97
|
<ROW table="project_subject">
|
98
|
<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="concat($projectId, '@@', $subjectId)" /></FIELD>
|
99
|
<FIELD name="project"><xsl:value-of select="$projectId" /></FIELD>
|
100
|
<FIELD name="subject"><xsl:value-of select="$subjectId" /></FIELD>
|
101
|
</ROW>
|
102
|
</xsl:for-each>
|
103
|
<!--
|
104
|
<xsl:for-each select=".//ProgramElement">
|
105
|
<xsl:if test="string-length(normalize-space(./Code)) > 0">
|
106
|
<xsl:variable name="fundingId" select="concat($namespacePrefix, '::NSF::PEC::', normalize-space(./Code))" />
|
107
|
<ROW table="project_fundingpath">
|
108
|
<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="concat($fundingId,'@@', $projectId)" /></FIELD>
|
109
|
<FIELD name="funding"><xsl:value-of select="$fundingId" /></FIELD>
|
110
|
<FIELD name="project"><xsl:value-of select="$projectId" /></FIELD>
|
111
|
<FIELD name="startdate" type="date" format="MM/dd/yyyy"><xsl:value-of select="$startDate" /></FIELD>
|
112
|
<FIELD name="enddate" type="date" format="MM/dd/yyyy"><xsl:value-of select="$endDate" /></FIELD>
|
113
|
</ROW>
|
114
|
</xsl:if>
|
115
|
</xsl:for-each>
|
116
|
|
117
|
<xsl:for-each select=".//ProgramReference">
|
118
|
<xsl:if test="string-length(normalize-space(./Code)) > 0">
|
119
|
<xsl:variable name="fundingId" select="concat($namespacePrefix, '::NSF::PRC::', normalize-space(./Code))"/>
|
120
|
<ROW table="project_fundingpath">
|
121
|
<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="concat($fundingId,'@@', $projectId)" /></FIELD>
|
122
|
<FIELD name="funding"><xsl:value-of select="$fundingId" /></FIELD>
|
123
|
<FIELD name="project"><xsl:value-of select="$projectId" /></FIELD>
|
124
|
<FIELD name="startdate" type="date" format="MM/dd/yyyy"><xsl:value-of select="$startDate" /></FIELD>
|
125
|
<FIELD name="enddate" type="date" format="MM/dd/yyyy"><xsl:value-of select="$endDate" /></FIELD>
|
126
|
</ROW>
|
127
|
</xsl:if>
|
128
|
</xsl:for-each>
|
129
|
-->
|
130
|
|
131
|
|
132
|
<xsl:for-each select="//funding">
|
133
|
<xsl:variable name="directorate" select="normalize-space(./orgDirectorateAbbr)"/>
|
134
|
<xsl:variable name="division" select="normalize-space(./orgDivisionAbbr)"/>
|
135
|
<xsl:variable name="fundingId">
|
136
|
<xsl:choose>
|
137
|
<xsl:when test="string-length($directorate) > 0">
|
138
|
<xsl:choose>
|
139
|
<xsl:when test="string-length($division) > 0">
|
140
|
<xsl:value-of select="concat($namespacePrefix, '::NSF::', $directorate, '::', $division)"/>
|
141
|
</xsl:when>
|
142
|
<xsl:otherwise>
|
143
|
<xsl:value-of select="concat($namespacePrefix, '::NSF::', $directorate)"/>
|
144
|
</xsl:otherwise>
|
145
|
</xsl:choose>
|
146
|
</xsl:when>
|
147
|
<xsl:otherwise>
|
148
|
<xsl:value-of select="concat($namespacePrefix, '::NSF')"/>
|
149
|
</xsl:otherwise>
|
150
|
</xsl:choose>
|
151
|
</xsl:variable>
|
152
|
|
153
|
<ROW table="project_fundingpath">
|
154
|
<FIELD name="_dnet_resource_identifier_">
|
155
|
<xsl:value-of select="concat($fundingId,'@@', $projectId)"/>
|
156
|
</FIELD>
|
157
|
<FIELD name="funding">
|
158
|
<xsl:value-of select="$fundingId"/>
|
159
|
</FIELD>
|
160
|
<FIELD name="project">
|
161
|
<xsl:value-of select="$projectId"/>
|
162
|
</FIELD>
|
163
|
<FIELD name="startdate" type="date" format="MM/dd/yyyy">
|
164
|
<xsl:value-of select="$startDate"/>
|
165
|
</FIELD>
|
166
|
<FIELD name="enddate" type="date" format="MM/dd/yyyy">
|
167
|
<xsl:value-of select="$endDate"/>
|
168
|
</FIELD>
|
169
|
</ROW>
|
170
|
</xsl:for-each>
|
171
|
</xsl:if>
|
172
|
</ROWS>
|
173
|
</metadata>
|
174
|
</record>
|
175
|
</xsl:template>
|
176
|
|
177
|
</xsl:stylesheet>
|