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"/>
|
6
|
<xsl:param name="quote">"</xsl:param>
|
7
|
|
8
|
<xsl:variable name="funderID" select="concat($namespacePrefix, '::WT')"/>
|
9
|
|
10
|
<xsl:variable name="stream" select="normalize-space(.//Grant/Stream)"/>
|
11
|
<xsl:variable name="fundingID">
|
12
|
<xsl:choose>
|
13
|
<xsl:when test="string-length($stream) > 0">
|
14
|
<xsl:value-of select="concat($funderID, '::', $stream)"/>
|
15
|
</xsl:when>
|
16
|
<xsl:otherwise>
|
17
|
<xsl:value-of select="$funderID"/>
|
18
|
</xsl:otherwise>
|
19
|
</xsl:choose>
|
20
|
</xsl:variable>
|
21
|
|
22
|
<xsl:variable name="projectID" select="concat($namespacePrefix, '::', .//Grant/Id)"/>
|
23
|
|
24
|
<xsl:variable name="orgID" select="concat($namespacePrefix, '::', translate(.//Institution/Name, ' ,', '__'))"/>
|
25
|
<!--
|
26
|
personID is fine as long as WT gives us one person per project. If they fix their export, we might have 2 persons (or more).
|
27
|
At this stage we are somehow fine to loose one of the persons (the second project with the same id overwrites the previous project
|
28
|
-->
|
29
|
<xsl:variable name="personID" select="concat($namespacePrefix, '::', .//Person/Alias[@Source='Wellcome Trust'])"/>
|
30
|
<xsl:variable name="startDate" select="translate(.//Grant/StartDate,'/\','--')"/>
|
31
|
<xsl:variable name="endDate" select="translate(.//Grant/EndDate,'/\','--')"/>
|
32
|
|
33
|
<xsl:variable name="dateFormat" select="string('yyyy-MM-dd')"/>
|
34
|
|
35
|
<xsl:template name="getJson">
|
36
|
<xsl:param name="varName"/>
|
37
|
<xsl:param name="value"/>
|
38
|
<xsl:value-of select="concat($quote, $varName, $quote, ':', $quote, $value, $quote)"/>
|
39
|
</xsl:template>
|
40
|
|
41
|
<xsl:template match="/">
|
42
|
<record>
|
43
|
|
44
|
<xsl:copy-of select=".//*[local-name()='header']"/>
|
45
|
<metadata>
|
46
|
<ROWS>
|
47
|
<xsl:if test="string-length(normalize-space(.//Grant/Title)) > 0 and string-length($projectID) > 0">
|
48
|
<ROW table="projects">
|
49
|
<FIELD name="_dnet_resource_identifier_">
|
50
|
<xsl:value-of select="$projectID"/>
|
51
|
</FIELD>
|
52
|
<FIELD name="id">
|
53
|
<xsl:value-of select="$projectID"/>
|
54
|
</FIELD>
|
55
|
<FIELD name="code">
|
56
|
<xsl:value-of select=".//Grant/Id"/>
|
57
|
</FIELD>
|
58
|
<FIELD name="startdate" type="date" format="{$dateFormat}">
|
59
|
<xsl:value-of select="$startDate"/>
|
60
|
</FIELD>
|
61
|
<FIELD name="enddate" type="date" format="{$dateFormat}">
|
62
|
<xsl:value-of select="$endDate"/>
|
63
|
</FIELD>
|
64
|
<FIELD name="title">
|
65
|
<xsl:value-of select=".//Grant/Title"/>
|
66
|
</FIELD>
|
67
|
<FIELD name="contracttypeclass">UNKNOWN</FIELD>
|
68
|
<FIELD name="contracttypescheme">wt:contractTypes</FIELD>
|
69
|
|
70
|
<FIELD name="acronym"></FIELD>
|
71
|
<FIELD name="keywords">
|
72
|
<xsl:value-of select="normalize-space(.//Grant/Type)"/>
|
73
|
</FIELD>
|
74
|
<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
|
75
|
<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
|
76
|
<FIELD name="collectedfrom">
|
77
|
<xsl:value-of select="$parentDatasourceId"/>
|
78
|
</FIELD>
|
79
|
<FIELD name="optional1">
|
80
|
<xsl:value-of select="concat(.//Grant/Amount, ' ', .//Grant/Amount/@Currency)"/>
|
81
|
</FIELD>
|
82
|
<xsl:if test="string-length(normalize-space(.//Grant/Alias/text())) > 0">
|
83
|
<xsl:variable name="projectAlias">
|
84
|
<xsl:call-template name="getJson">
|
85
|
<xsl:with-param name="varName">alias</xsl:with-param>
|
86
|
<xsl:with-param name="value">
|
87
|
<xsl:value-of select=".//Grant/Alias"/>
|
88
|
</xsl:with-param>
|
89
|
</xsl:call-template>
|
90
|
</xsl:variable>
|
91
|
<xsl:variable name="jsonExtra">
|
92
|
<xsl:value-of select="concat('{', $projectAlias, '}')"/>
|
93
|
</xsl:variable>
|
94
|
<FIELD name="jsonextrainfo">
|
95
|
<xsl:value-of select="$jsonExtra"/>
|
96
|
</FIELD>
|
97
|
</xsl:if>
|
98
|
</ROW>
|
99
|
|
100
|
<ROW table="project_fundingpath">
|
101
|
<FIELD name="_dnet_resource_identifier_">
|
102
|
<xsl:value-of select="concat($fundingID,'@@', $projectID)"/>
|
103
|
</FIELD>
|
104
|
<FIELD name="funding">
|
105
|
<xsl:value-of select="$fundingID"/>
|
106
|
</FIELD>
|
107
|
<FIELD name="project">
|
108
|
<xsl:value-of select="$projectID"/>
|
109
|
</FIELD>
|
110
|
<FIELD name="startdate" type="date" format="{$dateFormat}">
|
111
|
<xsl:value-of select="$startDate"/>
|
112
|
</FIELD>
|
113
|
<FIELD name="enddate" type="date" format="{$dateFormat}">
|
114
|
<xsl:value-of select="$endDate"/>
|
115
|
</FIELD>
|
116
|
</ROW>
|
117
|
<ROW table="persons">
|
118
|
<FIELD name="_dnet_resource_identifier_">
|
119
|
<xsl:value-of select="$personID"/>
|
120
|
</FIELD>
|
121
|
<FIELD name="id">
|
122
|
<xsl:value-of select="$personID"/>
|
123
|
</FIELD>
|
124
|
<FIELD name="firstname">
|
125
|
<xsl:value-of select=".//Person/GivenName"/>
|
126
|
</FIELD>
|
127
|
<FIELD name="secondnames">
|
128
|
<xsl:value-of select=".//Person/FamilyName"/>
|
129
|
</FIELD>
|
130
|
<FIELD name="collectedfrom">
|
131
|
<xsl:value-of select="$parentDatasourceId"/>
|
132
|
</FIELD>
|
133
|
<FIELD name="optional1">
|
134
|
<xsl:value-of select=".//Person/Title"/>
|
135
|
</FIELD>
|
136
|
<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
|
137
|
<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
|
138
|
</ROW>
|
139
|
<xsl:if test="not(concat($namespacePrefix, '::') = $orgID)">
|
140
|
<ROW table="organizations">
|
141
|
<FIELD name="_dnet_resource_identifier_">
|
142
|
<xsl:value-of select="$orgID"/>
|
143
|
</FIELD>
|
144
|
<FIELD name="id">
|
145
|
<xsl:value-of select="$orgID"/>
|
146
|
</FIELD>
|
147
|
<FIELD name="legalname">
|
148
|
<xsl:value-of select=".//Institution/Name"/>
|
149
|
</FIELD>
|
150
|
<FIELD name="collectedfrom">
|
151
|
<xsl:value-of select="$parentDatasourceId"/>
|
152
|
</FIELD>
|
153
|
<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
|
154
|
<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
|
155
|
<FIELD name="trust" type="float">0.8</FIELD>
|
156
|
</ROW>
|
157
|
<ROW table="project_organization">
|
158
|
<FIELD name="_dnet_resource_identifier_">
|
159
|
<xsl:value-of select="concat($projectID, '@@', $orgID)"/>
|
160
|
</FIELD>
|
161
|
<FIELD name="participantnumber" type="int">1</FIELD>
|
162
|
<FIELD name="startdate" type="date" format="{$dateFormat}">
|
163
|
<xsl:value-of select="$startDate"/>
|
164
|
</FIELD>
|
165
|
<FIELD name="enddate" type="date" format="{$dateFormat}">
|
166
|
<xsl:value-of select="$endDate"/>
|
167
|
</FIELD>
|
168
|
<FIELD name="project">
|
169
|
<xsl:value-of select="$projectID"/>
|
170
|
</FIELD>
|
171
|
<FIELD name="resporganization">
|
172
|
<xsl:value-of select="$orgID"/>
|
173
|
</FIELD>
|
174
|
<FIELD name="contactperson">
|
175
|
<xsl:value-of select="$personID"/>
|
176
|
</FIELD>
|
177
|
<FIELD name="semanticclass">coordinator</FIELD>
|
178
|
<FIELD name="semanticscheme">dnet:project_organization_relations</FIELD>
|
179
|
</ROW>
|
180
|
</xsl:if>
|
181
|
</xsl:if>
|
182
|
</ROWS>
|
183
|
</metadata>
|
184
|
</record>
|
185
|
</xsl:template>
|
186
|
</xsl:stylesheet>
|