1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
<xsl:stylesheet xmlns:fwf="eu.dnetlib.data.transform.xml.FWFXsltFunctions" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
3
|
|
4
|
<xsl:param name="parentDatasourceId"/>
|
5
|
<xsl:param name="namespacePrefix"/>
|
6
|
|
7
|
<xsl:variable name="funderID" select="concat($namespacePrefix, '::FWF')"/>
|
8
|
|
9
|
<xsl:variable name="fundingCode" select="normalize-space(substring-before(.//column[@name='project number'],' –'))"/>
|
10
|
<xsl:variable name="projectNumber" select="normalize-space(substring-after(.//column[@name='project number'],' – '))"/>
|
11
|
<xsl:variable name="fundingID">
|
12
|
<xsl:choose>
|
13
|
<xsl:when test="string-length($fundingCode) > 0">
|
14
|
<xsl:value-of select="concat($funderID, '::', $fundingCode)"/>
|
15
|
</xsl:when>
|
16
|
<xsl:otherwise>
|
17
|
<xsl:value-of select="$funderID"/>
|
18
|
</xsl:otherwise>
|
19
|
</xsl:choose>
|
20
|
</xsl:variable>
|
21
|
|
22
|
|
23
|
<xsl:variable name="projectID" select="concat($namespacePrefix, '::', concat($fundingCode,'_',$projectNumber))"/>
|
24
|
<xsl:variable name="projectCode" select="concat($fundingCode,' ',$projectNumber)"/>
|
25
|
|
26
|
<xsl:variable name="projectTitle" select=".//column[@name='project title']"/>
|
27
|
|
28
|
<xsl:variable name="startDate" select=".//column[@name='from']"/>
|
29
|
<xsl:variable name="endDate" select=".//column[@name='till']"/>
|
30
|
<xsl:variable name="personId" select="concat($namespacePrefix,translate(normalize-space(.//column[@name='project lead']),' ','_'))"/>
|
31
|
<xsl:variable name="dateFormat" select="string('yyyy-MM-dd')"/>
|
32
|
<xsl:variable name="organizationId" select="concat($namespacePrefix,fwf:getMd5(.//column[@name='research place and institute']))"/>
|
33
|
<xsl:template match="/">
|
34
|
<xsl:if test="string-length($projectTitle) > 0 and
|
35
|
string-length($projectID) > 0 and
|
36
|
//column[@name='status'] != 'canceled'">
|
37
|
<record>
|
38
|
|
39
|
<xsl:copy-of select=".//*[local-name()='header']"/>
|
40
|
|
41
|
<metadata>
|
42
|
|
43
|
<ROWS>
|
44
|
|
45
|
<ROW table="projects">
|
46
|
<FIELD name="_dnet_resource_identifier_">
|
47
|
<xsl:value-of select="$projectID"/>
|
48
|
</FIELD>
|
49
|
<FIELD name="id">
|
50
|
<xsl:value-of select="$projectID"/>
|
51
|
</FIELD>
|
52
|
<FIELD name="code">
|
53
|
<xsl:value-of select="$projectCode"/>
|
54
|
</FIELD>
|
55
|
<FIELD name="startdate" type="date" format="{$dateFormat}">
|
56
|
<xsl:value-of select="$startDate"/>
|
57
|
</FIELD>
|
58
|
<FIELD name="enddate" type="date" format="{$dateFormat}">
|
59
|
<xsl:value-of select="$endDate"/>
|
60
|
</FIELD>
|
61
|
<FIELD name="title">
|
62
|
<xsl:value-of select="$projectTitle"/>
|
63
|
</FIELD>
|
64
|
<FIELD name="keywords">
|
65
|
<xsl:value-of select=".//column[@name='keywords']"/>
|
66
|
</FIELD>
|
67
|
<FIELD name="optional1">
|
68
|
<xsl:variable name="grantAmount" select=".//column[@name='grants awarded']"/>
|
69
|
<xsl:variable name="tmp" select="substring(normalize-space($grantAmount),1,1)"/>
|
70
|
<xsl:value-of select="concat($tmp,' ',substring-after($grantAmount,$tmp))"/>
|
71
|
</FIELD>
|
72
|
|
73
|
<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
|
74
|
<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
|
75
|
<FIELD name="collectedfrom">
|
76
|
<xsl:value-of select="$parentDatasourceId"/>
|
77
|
</FIELD>
|
78
|
</ROW>
|
79
|
<ROW table="project_fundingpath">
|
80
|
<FIELD name="_dnet_resource_identifier_">
|
81
|
|
82
|
<xsl:value-of select="concat($fundingID,'@@', $projectID)"/>
|
83
|
</FIELD>
|
84
|
<FIELD name="funding">
|
85
|
<xsl:value-of select="$fundingID"/>
|
86
|
</FIELD>
|
87
|
<FIELD name="project">
|
88
|
<xsl:value-of select="$projectID"/>
|
89
|
</FIELD>
|
90
|
<FIELD name="startdate" type="date" format="{$dateFormat}">
|
91
|
<xsl:value-of select="$startDate"/>
|
92
|
</FIELD>
|
93
|
<FIELD name="enddate" type="date" format="{$dateFormat}">
|
94
|
<xsl:value-of select="$endDate"/>
|
95
|
</FIELD>
|
96
|
</ROW>
|
97
|
<xsl:if test="string-length($organizationId) > 0">
|
98
|
<ROW table="organizations">
|
99
|
|
100
|
<FIELD name="_dnet_resource_identifier_">
|
101
|
<xsl:value-of select="$organizationId"/>
|
102
|
</FIELD>
|
103
|
<FIELD name="id">
|
104
|
<xsl:value-of select="$organizationId"/>
|
105
|
</FIELD>
|
106
|
<FIELD name="legalname">
|
107
|
<xsl:variable name="orgName" select="normalize-space(.//column[@name='research place and institute'])"/>
|
108
|
<xsl:choose>
|
109
|
<xsl:when test="string-length( $orgName) > 255">
|
110
|
<xsl:value-of select="substring($orgName,0,254)"/>
|
111
|
</xsl:when>
|
112
|
<xsl:otherwise>
|
113
|
<xsl:value-of select="normalize-space($orgName)"/>
|
114
|
</xsl:otherwise>
|
115
|
</xsl:choose>
|
116
|
|
117
|
|
118
|
</FIELD>
|
119
|
<FIELD name="collectedfrom">
|
120
|
<xsl:value-of select="$parentDatasourceId"/>
|
121
|
</FIELD>
|
122
|
<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
|
123
|
<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
|
124
|
</ROW>
|
125
|
</xsl:if>
|
126
|
<xsl:if test="string-length($personId) > 0">
|
127
|
<ROW table="persons">
|
128
|
<FIELD name="_dnet_resource_identifier_">
|
129
|
<xsl:value-of select="$personId"/>
|
130
|
</FIELD>
|
131
|
<FIELD name="id">
|
132
|
<xsl:value-of select="$personId"/>
|
133
|
</FIELD>
|
134
|
<FIELD name="firstname">
|
135
|
<xsl:value-of select="fwf:getName(.//column[@name='project lead'],true())"/>
|
136
|
</FIELD>
|
137
|
<FIELD name="secondnames">
|
138
|
<xsl:value-of select="fwf:getName(.//column[@name='project lead'],false())"/>
|
139
|
</FIELD>
|
140
|
<FIELD name="collectedfrom">
|
141
|
<xsl:value-of select="$parentDatasourceId"/>
|
142
|
</FIELD>
|
143
|
<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
|
144
|
<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
|
145
|
</ROW>
|
146
|
</xsl:if>
|
147
|
|
148
|
<xsl:if test="string-length($organizationId) > 0">
|
149
|
<ROW table="project_organization">
|
150
|
<FIELD name="_dnet_resource_identifier_">
|
151
|
<xsl:value-of select='concat($projectID, "@@", $organizationId)'/>
|
152
|
</FIELD>
|
153
|
<FIELD name="project">
|
154
|
<xsl:value-of select="$projectID"/>
|
155
|
</FIELD>
|
156
|
<FIELD name="resporganization">
|
157
|
<xsl:value-of select="$organizationId"/>
|
158
|
</FIELD>
|
159
|
<FIELD name="contactperson">
|
160
|
<xsl:value-of select="$personId"/>
|
161
|
</FIELD>
|
162
|
<FIELD name="semanticclass">participant</FIELD>
|
163
|
<FIELD name="semanticscheme">dnet:project_organization_relations</FIELD>
|
164
|
</ROW>
|
165
|
</xsl:if>
|
166
|
|
167
|
</ROWS>
|
168
|
</metadata>
|
169
|
</record>
|
170
|
</xsl:if>
|
171
|
</xsl:template>
|
172
|
</xsl:stylesheet>
|