Project

General

Profile

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
			<xsl:copy-of select=".//*[local-name()='header']"/>
37
			<metadata>
38
				<ROWS>
39
					<xsl:if test="string-length(normalize-space(.//PROJECT_TITLE)) &gt; 0 and string-length($projectID) &gt; 0">
40

    
41
						<xsl:variable name="startDate" select=".//PROJECT_START"/>
42
						<xsl:variable name="endDate" select=".//PROJECT_END"/>
43

    
44
						<xsl:variable name="orgname">
45
							<xsl:call-template name="getJson">
46
								<xsl:with-param name="varName">orgname</xsl:with-param>
47
								<xsl:with-param name="value">
48
									<xsl:value-of select=".//ORG_NAME"/>
49
								</xsl:with-param>
50
							</xsl:call-template>
51
						</xsl:variable>
52
						<xsl:variable name="activity">
53
							<xsl:call-template name="getJson">
54
								<xsl:with-param name="varName">activity</xsl:with-param>
55
								<xsl:with-param name="value">
56
									<xsl:value-of select=".//ACTIVITY"/>
57
								</xsl:with-param>
58
							</xsl:call-template>
59
						</xsl:variable>
60
						<xsl:variable name="administeringic">
61
							<xsl:call-template name="getJson">
62
								<xsl:with-param name="varName">administeringic</xsl:with-param>
63
								<xsl:with-param name="value">
64
									<xsl:value-of select=".//ADMINISTERING_IC"/>
65
								</xsl:with-param>
66
							</xsl:call-template>
67
						</xsl:variable>
68
						<xsl:variable name="serialnumber">
69
							<xsl:call-template name="getJson">
70
								<xsl:with-param name="varName">serialnumber</xsl:with-param>
71
								<xsl:with-param name="value">
72
									<xsl:value-of select=".//SERIAL_NUMBER"/>
73
								</xsl:with-param>
74
							</xsl:call-template>
75
						</xsl:variable>
76
						<xsl:variable name="coreprojectnum">
77
							<xsl:call-template name="getJson">
78
								<xsl:with-param name="varName">coreprojectnum</xsl:with-param>
79
								<xsl:with-param name="value">
80
									<xsl:value-of select=".//CORE_PROJECT_NUM"/>
81
								</xsl:with-param>
82
							</xsl:call-template>
83
						</xsl:variable>
84

    
85
						<xsl:variable name="jsonExtra">
86
							<xsl:value-of select="concat('{', $orgname, ',', $activity, ',', $administeringic ,',',$serialnumber, ',', $coreprojectnum, '}')"/>
87
						</xsl:variable>
88

    
89
						<ROW table="projects">
90
							<FIELD name="_dnet_resource_identifier_">
91
								<xsl:value-of select="$projectID"/>
92
							</FIELD>
93
							<FIELD name="id">
94
								<xsl:value-of select="$projectID"/>
95
							</FIELD>
96
							<FIELD name="code">
97
								<xsl:value-of select=".//FULL_PROJECT_NUM"/>
98
							</FIELD>
99
							<FIELD name="startdate" type="date" format="MM/dd/yyyy">
100
								<xsl:value-of select="$startDate"/>
101
							</FIELD>
102
							<FIELD name="enddate" type="date" format="MM/dd/yyyy">
103
								<xsl:value-of select="$endDate"/>
104
							</FIELD>
105
							<FIELD name="title">
106
								<xsl:value-of select=".//PROJECT_TITLE"/>
107
							</FIELD>
108
							<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
109
							<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
110
							<FIELD name="collectedfrom">
111
								<xsl:value-of select="$parentDatasourceId"/>
112
							</FIELD>
113
							<FIELD name="optional1">
114
								<xsl:value-of select="concat(.//TOTAL_COST, ' $')"/>
115
							</FIELD>
116
							<FIELD name="jsonextrainfo">
117
								<xsl:value-of select="$jsonExtra"/>
118
							</FIELD>
119
						</ROW>
120
						<ROW table="project_fundingpath">
121
							<FIELD name="_dnet_resource_identifier_">
122
								<xsl:value-of select="concat($fundingID,'@@', $projectID)"/>
123
							</FIELD>
124
							<FIELD name="funding">
125
								<xsl:value-of select="$fundingID"/>
126
							</FIELD>
127
							<FIELD name="project">
128
								<xsl:value-of select="$projectID"/>
129
							</FIELD>
130
							<FIELD name="startdate" type="date" format="MM/dd/yyyy">
131
								<xsl:value-of select="$startDate"/>
132
							</FIELD>
133
							<FIELD name="enddate" type="date" format="MM/dd/yyyy">
134
								<xsl:value-of select="$endDate"/>
135
							</FIELD>
136
						</ROW>
137
						<xsl:if test="string-length($orgID) &gt; 4">
138
							<ROW table="organizations">
139
								<FIELD name="_dnet_resource_identifier_">
140
									<xsl:value-of select="$orgID"/>
141
								</FIELD>
142
								<FIELD name="id">
143
									<xsl:value-of select="$orgID"/>
144
								</FIELD>
145
								<FIELD name="legalname">
146
									<xsl:value-of select=".//ORG_NAME"/>
147
								</FIELD>
148
								<FIELD name="collectedfrom">
149
									<xsl:value-of select="$parentDatasourceId"/>
150
								</FIELD>
151
								<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
152
								<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
153
								<FIELD name="trust" type="float">0.8</FIELD>
154
							</ROW>
155
							<ROW table="project_organization">
156
								<FIELD name="_dnet_resource_identifier_">
157
									<xsl:value-of select="concat($projectID, '@@', $orgID)"/>
158
								</FIELD>
159
								<FIELD name="participantnumber" type="int">1</FIELD>
160
								<FIELD name="startdate" type="date" format="MM/dd/yyyy">
161
									<xsl:value-of select="$startDate"/>
162
								</FIELD>
163
								<FIELD name="enddate" type="date" format="MM/dd/yyyy">
164
									<xsl:value-of select="$endDate"/>
165
								</FIELD>
166
								<FIELD name="project">
167
									<xsl:value-of select="$projectID"/>
168
								</FIELD>
169
								<FIELD name="resporganization">
170
									<xsl:value-of select="$orgID"/>
171
								</FIELD>
172
								<FIELD name="semanticclass">participant</FIELD>
173
								<FIELD name="semanticscheme">dnet:project_organization_relations</FIELD>
174
							</ROW>
175
						</xsl:if>
176
					</xsl:if>
177
				</ROWS>
178
			</metadata>
179
		</record>
180
	</xsl:template>
181
</xsl:stylesheet>
(17-17/30)