1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
3
|
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:dc="http://purl.org/dc/elements/1.1/"
|
4
|
xmlns:dr="http://www.driver-repository.eu/namespace/dr" xmlns:dri="http://www.driver-repository.eu/namespace/dri"
|
5
|
xmlns:oaf="http://namespace.openaire.eu/oaf" xmlns:fn="http://www.w3.org/2005/xpath-functions"
|
6
|
exclude-result-prefixes="xs" version="1.0">
|
7
|
|
8
|
<xsl:param name="parentDatasourceId" />
|
9
|
<xsl:param name="namespacePrefix" />
|
10
|
|
11
|
<xsl:variable name="dateFormat" select="string('yyyy-MM-dd')"/>
|
12
|
<xsl:variable name="funderID" select="concat($namespacePrefix, '::RCUK')"/>
|
13
|
|
14
|
<xsl:template match="/">
|
15
|
|
16
|
|
17
|
<record xmlns:dr="http://www.driver-repository.eu/namespace/dr"
|
18
|
xmlns:dri="http://www.driver-repository.eu/namespace/dri" xmlns:dc="http://purl.org/dc/elements/1.1/"
|
19
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:oaf="http://namespace.openaire.eu/oaf"
|
20
|
xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/">
|
21
|
|
22
|
<xsl:copy-of select=".//*[local-name()='header']" />
|
23
|
|
24
|
<metadata>
|
25
|
<ROWS>
|
26
|
<xsl:variable name="projectCode"
|
27
|
select="//*[local-name()='identifier' and ./@*[local-name()='type' and .='RCUK']]" />
|
28
|
<xsl:variable name="projectId"
|
29
|
select="concat($namespacePrefix, '::', $projectCode)" />
|
30
|
|
31
|
<xsl:variable name="sDate" select=".//*[local-name()='fund']/*[local-name()='start']"/>
|
32
|
<xsl:variable name="eDate" select=".//*[local-name()='fund']/*[local-name()='end']"/>
|
33
|
<xsl:variable name="startDate">
|
34
|
<xsl:choose>
|
35
|
<xsl:when test="contains($sDate, '+')">
|
36
|
<xsl:value-of select="substring-before($sDate, '+')"/>
|
37
|
</xsl:when>
|
38
|
<xsl:when test="contains($sDate, 'Z')">
|
39
|
<xsl:value-of select="substring-before($sDate, 'Z')"/>
|
40
|
</xsl:when>
|
41
|
<xsl:otherwise>
|
42
|
<xsl:value-of select="$sDate"/>
|
43
|
</xsl:otherwise>
|
44
|
</xsl:choose>
|
45
|
</xsl:variable>
|
46
|
<xsl:variable name="endDate">
|
47
|
<xsl:choose>
|
48
|
<xsl:when test="contains($eDate, '+')">
|
49
|
<xsl:value-of select="substring-before($eDate, '+')"/>
|
50
|
</xsl:when>
|
51
|
<xsl:when test="contains($eDate, 'Z')">
|
52
|
<xsl:value-of select="substring-before($eDate, 'Z')"/>
|
53
|
</xsl:when>
|
54
|
<xsl:otherwise>
|
55
|
<xsl:value-of select="$eDate"/>
|
56
|
</xsl:otherwise>
|
57
|
</xsl:choose>
|
58
|
</xsl:variable>
|
59
|
|
60
|
<xsl:variable name="personCode"
|
61
|
select=".//*[local-name()='person']/@*[local-name()='id']" />
|
62
|
<xsl:variable name="personId"
|
63
|
select="concat($namespacePrefix,'::',$personCode)" />
|
64
|
<xsl:variable name="personSurname" select=".//*[local-name()='surname']" />
|
65
|
<xsl:variable name="personFirstName" select=".//*[local-name()='firstName']" />
|
66
|
<xsl:variable name="fundingId"
|
67
|
select="concat($funderID ,'::' , .//*[local-name()='funder']/name)" />
|
68
|
|
69
|
<ROW table="projects">
|
70
|
<FIELD name="_dnet_resource_identifier_">
|
71
|
<xsl:value-of select="$projectId" />
|
72
|
</FIELD>
|
73
|
<FIELD name="id">
|
74
|
<xsl:value-of select="$projectId" />
|
75
|
</FIELD>
|
76
|
<FIELD name="code">
|
77
|
<xsl:value-of select="$projectCode" />
|
78
|
</FIELD>
|
79
|
<FIELD name="title">
|
80
|
<xsl:value-of select=".//*[local-name()='title']" />
|
81
|
</FIELD>
|
82
|
<FIELD name="startdate" type="date" format="{$dateFormat}">
|
83
|
<xsl:value-of select="$startDate" />
|
84
|
</FIELD>
|
85
|
<FIELD name="enddate" type="date" format="{$dateFormat}">
|
86
|
<xsl:value-of select="$endDate" />
|
87
|
</FIELD>
|
88
|
<FIELD name="collectedfrom">
|
89
|
<xsl:value-of select="$parentDatasourceId" />
|
90
|
</FIELD>
|
91
|
<FIELD name="provenanceactionclass">sysimport:crosswalk:entityregistry</FIELD>
|
92
|
<FIELD name="optional1">
|
93
|
<xsl:value-of
|
94
|
select="concat(.//*[local-name()='valuePounds']/@*[local-name()='amount'], ' ', .//*[local-name()='valuePounds']/@*[local-name()='currencyCode'])" />
|
95
|
</FIELD>
|
96
|
</ROW>
|
97
|
|
98
|
<ROW table="project_fundingpath">
|
99
|
<FIELD name="_dnet_resource_identifier_">
|
100
|
<xsl:value-of select="concat($fundingId, '@@', $projectId)" />
|
101
|
</FIELD>
|
102
|
<FIELD name="funding">
|
103
|
<xsl:value-of select="$fundingId" />
|
104
|
</FIELD>
|
105
|
<FIELD name="project">
|
106
|
<xsl:value-of select="$projectId" />
|
107
|
</FIELD>
|
108
|
<FIELD name="startdate" type="date" format="{$dateFormat}">
|
109
|
<xsl:value-of select="$startDate" />
|
110
|
</FIELD>
|
111
|
<FIELD name="enddate" type="date" format="{$dateFormat}">
|
112
|
<xsl:value-of select="$endDate" />
|
113
|
</FIELD>
|
114
|
</ROW>
|
115
|
|
116
|
<xsl:for-each select=".//pp-org">
|
117
|
<xsl:variable name="organizationId" select="concat($namespacePrefix, '::', normalize-space(./id))" />
|
118
|
<xsl:variable name="country" select="./country" />
|
119
|
<ROW table="organizations">
|
120
|
<FIELD name="_dnet_resource_identifier_">
|
121
|
<xsl:value-of select="$organizationId" />
|
122
|
</FIELD>
|
123
|
<FIELD name="id">
|
124
|
<xsl:value-of select="$organizationId" />
|
125
|
</FIELD>
|
126
|
<FIELD name="legalname">
|
127
|
<xsl:value-of select="./name" />
|
128
|
</FIELD>
|
129
|
|
130
|
<xsl:if test="string-length($country) > 0">
|
131
|
<FIELD name="countryclass"><xsl:value-of select="$country" /></FIELD>
|
132
|
<FIELD name="countryscheme">dnet:countries</FIELD>
|
133
|
</xsl:if>
|
134
|
|
135
|
<FIELD name="collectedfrom">
|
136
|
<xsl:value-of select="$parentDatasourceId" />
|
137
|
</FIELD>
|
138
|
<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
|
139
|
<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
|
140
|
</ROW>
|
141
|
<ROW table="project_organization">
|
142
|
<FIELD name="_dnet_resource_identifier_">
|
143
|
<xsl:value-of select='concat($projectId, "@@", $organizationId)' />
|
144
|
</FIELD>
|
145
|
<FIELD name="project">
|
146
|
<xsl:value-of select="$projectId" />
|
147
|
</FIELD>
|
148
|
<FIELD name="resporganization">
|
149
|
<xsl:value-of select="$organizationId" />
|
150
|
</FIELD>
|
151
|
|
152
|
<FIELD name="semanticclass">participant</FIELD>
|
153
|
<FIELD name="semanticscheme">dnet:project_organization_relations</FIELD>
|
154
|
</ROW>
|
155
|
|
156
|
</xsl:for-each>
|
157
|
|
158
|
<xsl:variable name="leadOrgId"
|
159
|
select="concat($namespacePrefix, '::', normalize-space(.//ld-org/id))" />
|
160
|
<ROW table="organizations">
|
161
|
<FIELD name="_dnet_resource_identifier_">
|
162
|
<xsl:value-of select="$leadOrgId" />
|
163
|
</FIELD>
|
164
|
<FIELD name="id">
|
165
|
<xsl:value-of select="$leadOrgId" />
|
166
|
</FIELD>
|
167
|
<FIELD name="legalname">
|
168
|
<xsl:value-of select=".//ld-org/name" />
|
169
|
</FIELD>
|
170
|
<xsl:variable name="country" select=".//ld-org/country"/>
|
171
|
<xsl:if test="string-length($country) > 0">
|
172
|
<FIELD name="countryclass"><xsl:value-of select="$country" /></FIELD>
|
173
|
<FIELD name="countryscheme">dnet:countries</FIELD>
|
174
|
</xsl:if>
|
175
|
|
176
|
<FIELD name="collectedfrom">
|
177
|
<xsl:value-of select="$parentDatasourceId" />
|
178
|
</FIELD>
|
179
|
<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
|
180
|
<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
|
181
|
</ROW>
|
182
|
|
183
|
<xsl:if test="string-length($personFirstName) > 0">
|
184
|
<ROW table="persons">
|
185
|
<FIELD name="_dnet_resource_identifier_">
|
186
|
<xsl:value-of select="$personId" />
|
187
|
</FIELD>
|
188
|
<FIELD name="id">
|
189
|
<xsl:value-of select="$personId" />
|
190
|
</FIELD>
|
191
|
<FIELD name="firstname">
|
192
|
<xsl:value-of select="$personFirstName" />
|
193
|
</FIELD>
|
194
|
<FIELD name="secondnames">
|
195
|
<xsl:value-of select="$personSurname" />
|
196
|
</FIELD>
|
197
|
<FIELD name="collectedfrom">
|
198
|
<xsl:value-of select="$parentDatasourceId" />
|
199
|
</FIELD>
|
200
|
<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
|
201
|
<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
|
202
|
</ROW>
|
203
|
</xsl:if>
|
204
|
<ROW table="project_organization">
|
205
|
<FIELD name="_dnet_resource_identifier_">
|
206
|
<xsl:value-of select='concat($projectId, "@@", $leadOrgId)' />
|
207
|
</FIELD>
|
208
|
<FIELD name="project">
|
209
|
<xsl:value-of select="$projectId" />
|
210
|
</FIELD>
|
211
|
<FIELD name="resporganization">
|
212
|
<xsl:value-of select="$leadOrgId" />
|
213
|
</FIELD>
|
214
|
<FIELD name="participantnumber" type="int">1</FIELD>
|
215
|
<FIELD name="semanticclass">coordinator</FIELD>
|
216
|
<FIELD name="semanticscheme">dnet:project_organization_relations</FIELD>
|
217
|
<xsl:if test="string-length($personFirstName) > 0">
|
218
|
<FIELD name="contactperson">
|
219
|
<xsl:value-of select="$personId" />
|
220
|
</FIELD>
|
221
|
</xsl:if>
|
222
|
</ROW>
|
223
|
|
224
|
</ROWS>
|
225
|
</metadata>
|
226
|
</record>
|
227
|
</xsl:template>
|
228
|
|
229
|
</xsl:stylesheet>
|