1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
3
|
|
4
|
<xsl:param name="parentDatasourceId"/>
|
5
|
<xsl:param name="namespacePrefix"/>
|
6
|
<xsl:param name="quote">"</xsl:param>
|
7
|
|
8
|
<xsl:variable name="funderID" select="concat($namespacePrefix, '::NIH')"/>
|
9
|
<xsl:variable name="fundingName" select="upper-case(normalize-space(//IC_NAME))"/>
|
10
|
<xsl:variable name="fundingID">
|
11
|
<xsl:choose>
|
12
|
<xsl:when test="$fundingName != ''">
|
13
|
<xsl:value-of select="concat($funderID, '::', $fundingName)"/>
|
14
|
</xsl:when>
|
15
|
<xsl:otherwise>
|
16
|
<xsl:value-of select="$funderID"/>
|
17
|
</xsl:otherwise>
|
18
|
</xsl:choose>
|
19
|
</xsl:variable>
|
20
|
|
21
|
<xsl:variable name="projectID" select="concat($namespacePrefix, '::', .//FULL_PROJECT_NUM)"/>
|
22
|
<xsl:variable name="orgID" select="concat($namespacePrefix, '::', upper-case(translate(.//ORG_NAME, ' ,', '__')))"/>
|
23
|
|
24
|
<xsl:variable name="terms" select="string-join(.//PROJECT_TERMS/TERM/text(), ',')"/>
|
25
|
<xsl:variable name="termsx" select="string-join(.//PROJECT_TERMSX/TERM/text(), ',')"/>
|
26
|
|
27
|
<xsl:template name="getJson">
|
28
|
<xsl:param name="varName"/>
|
29
|
<xsl:param name="value"/>
|
30
|
<xsl:value-of select="concat($quote, $varName, $quote, ':', $quote, $value, $quote)"/>
|
31
|
</xsl:template>
|
32
|
|
33
|
<xsl:template match="/">
|
34
|
<record
|
35
|
>
|
36
|
|
37
|
<xsl:copy-of select=".//*[local-name()='header']"/>
|
38
|
<metadata>
|
39
|
<ROWS>
|
40
|
<xsl:if test="string-length(normalize-space(.//PROJECT_TITLE)) > 0 and string-length($projectID) > 0">
|
41
|
|
42
|
<xsl:variable name="startDate" select=".//PROJECT_START"/>
|
43
|
<xsl:variable name="endDate" select=".//PROJECT_END"/>
|
44
|
|
45
|
<xsl:variable name="orgname">
|
46
|
<xsl:call-template name="getJson">
|
47
|
<xsl:with-param name="varName">orgname</xsl:with-param>
|
48
|
<xsl:with-param name="value">
|
49
|
<xsl:value-of select=".//ORG_NAME"/>
|
50
|
</xsl:with-param>
|
51
|
</xsl:call-template>
|
52
|
</xsl:variable>
|
53
|
<xsl:variable name="activity">
|
54
|
<xsl:call-template name="getJson">
|
55
|
<xsl:with-param name="varName">activity</xsl:with-param>
|
56
|
<xsl:with-param name="value">
|
57
|
<xsl:value-of select=".//ACTIVITY"/>
|
58
|
</xsl:with-param>
|
59
|
</xsl:call-template>
|
60
|
</xsl:variable>
|
61
|
<xsl:variable name="administeringic">
|
62
|
<xsl:call-template name="getJson">
|
63
|
<xsl:with-param name="varName">administeringic</xsl:with-param>
|
64
|
<xsl:with-param name="value">
|
65
|
<xsl:value-of select=".//ADMINISTERING_IC"/>
|
66
|
</xsl:with-param>
|
67
|
</xsl:call-template>
|
68
|
</xsl:variable>
|
69
|
<xsl:variable name="serialnumber">
|
70
|
<xsl:call-template name="getJson">
|
71
|
<xsl:with-param name="varName">serialnumber</xsl:with-param>
|
72
|
<xsl:with-param name="value">
|
73
|
<xsl:value-of select=".//SERIAL_NUMBER"/>
|
74
|
</xsl:with-param>
|
75
|
</xsl:call-template>
|
76
|
</xsl:variable>
|
77
|
<xsl:variable name="coreprojectnum">
|
78
|
<xsl:call-template name="getJson">
|
79
|
<xsl:with-param name="varName">coreprojectnum</xsl:with-param>
|
80
|
<xsl:with-param name="value">
|
81
|
<xsl:value-of select=".//CORE_PROJECT_NUM"/>
|
82
|
</xsl:with-param>
|
83
|
</xsl:call-template>
|
84
|
</xsl:variable>
|
85
|
|
86
|
<xsl:variable name="jsonExtra">
|
87
|
<xsl:value-of select="concat('{', $orgname, ',', $activity, ',', $administeringic ,',',$serialnumber, ',', $coreprojectnum, '}')"/>
|
88
|
</xsl:variable>
|
89
|
|
90
|
<ROW table="projects">
|
91
|
<FIELD name="_dnet_resource_identifier_">
|
92
|
<xsl:value-of select="$projectID"/>
|
93
|
</FIELD>
|
94
|
<FIELD name="id">
|
95
|
<xsl:value-of select="$projectID"/>
|
96
|
</FIELD>
|
97
|
<FIELD name="code">
|
98
|
<xsl:value-of select=".//FULL_PROJECT_NUM"/>
|
99
|
</FIELD>
|
100
|
<FIELD name="startdate" type="date" format="MM/dd/yyyy">
|
101
|
<xsl:value-of select="$startDate"/>
|
102
|
</FIELD>
|
103
|
<FIELD name="enddate" type="date" format="MM/dd/yyyy">
|
104
|
<xsl:value-of select="$endDate"/>
|
105
|
</FIELD>
|
106
|
<FIELD name="title">
|
107
|
<xsl:value-of select=".//PROJECT_TITLE"/>
|
108
|
</FIELD>
|
109
|
<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
|
110
|
<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
|
111
|
<FIELD name="collectedfrom">
|
112
|
<xsl:value-of select="$parentDatasourceId"/>
|
113
|
</FIELD>
|
114
|
<FIELD name="optional1">
|
115
|
<xsl:value-of select="concat(.//TOTAL_COST, ' $')"/>
|
116
|
</FIELD>
|
117
|
<FIELD name="jsonextrainfo">
|
118
|
<xsl:value-of select="$jsonExtra"/>
|
119
|
</FIELD>
|
120
|
</ROW>
|
121
|
<ROW table="project_fundingpath">
|
122
|
<FIELD name="_dnet_resource_identifier_">
|
123
|
<xsl:value-of select="concat($fundingID,'@@', $projectID)"/>
|
124
|
</FIELD>
|
125
|
<FIELD name="funding">
|
126
|
<xsl:value-of select="$fundingID"/>
|
127
|
</FIELD>
|
128
|
<FIELD name="project">
|
129
|
<xsl:value-of select="$projectID"/>
|
130
|
</FIELD>
|
131
|
<FIELD name="startdate" type="date" format="MM/dd/yyyy">
|
132
|
<xsl:value-of select="$startDate"/>
|
133
|
</FIELD>
|
134
|
<FIELD name="enddate" type="date" format="MM/dd/yyyy">
|
135
|
<xsl:value-of select="$endDate"/>
|
136
|
</FIELD>
|
137
|
</ROW>
|
138
|
|
139
|
<!--
|
140
|
<xsl:for-each select=".//PIS/PI[./PI_ID != '']">
|
141
|
<xsl:variable name="personId" select="concat($namespacePrefix, '::', ./PI_ID)"/>
|
142
|
<xsl:variable name="personName" select="tokenize(./PI_NAME, ',')"/>
|
143
|
<ROW table="persons">
|
144
|
<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="$personID" /></FIELD>
|
145
|
<FIELD name="id"><xsl:value-of select="$personID" /></FIELD>
|
146
|
<FIELD name="firstname"><xsl:value-of select="$personName[1]" /></FIELD>
|
147
|
<FIELD name="secondnames"><xsl:value-of select="$personName[0]" /></FIELD>
|
148
|
<FIELD name="collectedfrom"><xsl:value-of select="$parentDatasourceId" /></FIELD>
|
149
|
<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
|
150
|
<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
|
151
|
</ROW>
|
152
|
</xsl:for-each>
|
153
|
-->
|
154
|
|
155
|
<xsl:if test="string-length($orgID) > 4">
|
156
|
<ROW table="organizations">
|
157
|
<FIELD name="_dnet_resource_identifier_">
|
158
|
<xsl:value-of select="$orgID"/>
|
159
|
</FIELD>
|
160
|
<FIELD name="id">
|
161
|
<xsl:value-of select="$orgID"/>
|
162
|
</FIELD>
|
163
|
<FIELD name="legalname">
|
164
|
<xsl:value-of select=".//ORG_NAME"/>
|
165
|
</FIELD>
|
166
|
<FIELD name="collectedfrom">
|
167
|
<xsl:value-of select="$parentDatasourceId"/>
|
168
|
</FIELD>
|
169
|
<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
|
170
|
<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
|
171
|
<FIELD name="trust" type="float">0.8</FIELD>
|
172
|
</ROW>
|
173
|
<ROW table="project_organization">
|
174
|
<!--<xsl:variable name="contactPerson" select=".//PIS/PI[./PI_ID != ''][1]"/> -->
|
175
|
<FIELD name="_dnet_resource_identifier_">
|
176
|
<xsl:value-of select="concat($projectID, '@@', $orgID)"/>
|
177
|
</FIELD>
|
178
|
<FIELD name="participantnumber" type="int">1</FIELD>
|
179
|
<FIELD name="startdate" type="date" format="MM/dd/yyyy">
|
180
|
<xsl:value-of select="$startDate"/>
|
181
|
</FIELD>
|
182
|
<FIELD name="enddate" type="date" format="MM/dd/yyyy">
|
183
|
<xsl:value-of select="$endDate"/>
|
184
|
</FIELD>
|
185
|
<FIELD name="project">
|
186
|
<xsl:value-of select="$projectID"/>
|
187
|
</FIELD>
|
188
|
<FIELD name="resporganization">
|
189
|
<xsl:value-of select="$orgID"/>
|
190
|
</FIELD>
|
191
|
<!--
|
192
|
<xsl:if test="$contactPerson">
|
193
|
<FIELD name="contactperson"><xsl:value-of select="concat($namespacePrefix, '::', $contactPerson/PI_ID)" /></FIELD>
|
194
|
</xsl:if>
|
195
|
-->
|
196
|
<FIELD name="semanticclass">participant</FIELD>
|
197
|
<FIELD name="semanticscheme">dnet:project_organization_relations</FIELD>
|
198
|
</ROW>
|
199
|
</xsl:if>
|
200
|
|
201
|
</xsl:if>
|
202
|
</ROWS>
|
203
|
</metadata>
|
204
|
</record>
|
205
|
</xsl:template>
|
206
|
</xsl:stylesheet>
|