1 |
26600
|
sandro.lab
|
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
48193
|
alessia.ba
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
3 |
|
|
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
4 |
|
|
exclude-result-prefixes="xs" version="2.0">
|
5 |
26600
|
sandro.lab
|
|
6 |
48139
|
alessia.ba
|
<xsl:param name="parentDatasourceId"/>
|
7 |
|
|
<xsl:param name="namespacePrefix"/>
|
8 |
|
|
<xsl:param name="quote">"</xsl:param>
|
9 |
26600
|
sandro.lab
|
|
10 |
48139
|
alessia.ba
|
<xsl:variable name="funderID" select="concat($namespacePrefix, '::WT')"/>
|
11 |
|
|
|
12 |
|
|
<xsl:variable name="stream" select="normalize-space(.//Grant/Stream)"/>
|
13 |
|
|
<xsl:variable name="fundingID">
|
14 |
26600
|
sandro.lab
|
<xsl:choose>
|
15 |
48139
|
alessia.ba
|
<xsl:when test="string-length($stream) > 0">
|
16 |
|
|
<xsl:value-of select="concat($funderID, '::', $stream)"/>
|
17 |
26600
|
sandro.lab
|
</xsl:when>
|
18 |
|
|
<xsl:otherwise>
|
19 |
48139
|
alessia.ba
|
<xsl:value-of select="$funderID"/>
|
20 |
26600
|
sandro.lab
|
</xsl:otherwise>
|
21 |
|
|
</xsl:choose>
|
22 |
|
|
</xsl:variable>
|
23 |
|
|
|
24 |
48139
|
alessia.ba
|
<xsl:variable name="projectID" select="concat($namespacePrefix, '::', .//Grant/Id)"/>
|
25 |
|
|
|
26 |
|
|
<xsl:variable name="orgID" select="concat($namespacePrefix, '::', translate(.//Institution/Name, ' ,', '__'))"/>
|
27 |
|
|
<!--
|
28 |
|
|
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).
|
29 |
|
|
At this stage we are somehow fine to loose one of the persons (the second project with the same id overwrites the previous project
|
30 |
|
|
-->
|
31 |
|
|
<xsl:variable name="personID" select="concat($namespacePrefix, '::', .//Person/Alias[@Source='Wellcome Trust'])"/>
|
32 |
|
|
<xsl:variable name="startDate" select="translate(.//Grant/StartDate,'/\','--')"/>
|
33 |
|
|
<xsl:variable name="endDate" select="translate(.//Grant/EndDate,'/\','--')"/>
|
34 |
|
|
|
35 |
|
|
<xsl:variable name="dateFormat" select="string('yyyy-MM-dd')"/>
|
36 |
|
|
|
37 |
|
|
<xsl:template name="getJson">
|
38 |
|
|
<xsl:param name="varName"/>
|
39 |
|
|
<xsl:param name="value"/>
|
40 |
|
|
<xsl:value-of select="concat($quote, $varName, $quote, ':', $quote, $value, $quote)"/>
|
41 |
|
|
</xsl:template>
|
42 |
|
|
|
43 |
26600
|
sandro.lab
|
<xsl:template match="/">
|
44 |
48139
|
alessia.ba
|
<record>
|
45 |
26600
|
sandro.lab
|
|
46 |
48139
|
alessia.ba
|
<xsl:copy-of select=".//*[local-name()='header']"/>
|
47 |
|
|
<metadata>
|
48 |
|
|
<ROWS>
|
49 |
|
|
<xsl:if test="string-length(normalize-space(.//Grant/Title)) > 0 and string-length($projectID) > 0">
|
50 |
|
|
<ROW table="projects">
|
51 |
|
|
<FIELD name="_dnet_resource_identifier_">
|
52 |
|
|
<xsl:value-of select="$projectID"/>
|
53 |
|
|
</FIELD>
|
54 |
|
|
<FIELD name="id">
|
55 |
|
|
<xsl:value-of select="$projectID"/>
|
56 |
|
|
</FIELD>
|
57 |
|
|
<FIELD name="code">
|
58 |
|
|
<xsl:value-of select=".//Grant/Id"/>
|
59 |
|
|
</FIELD>
|
60 |
|
|
<FIELD name="startdate" type="date" format="{$dateFormat}">
|
61 |
|
|
<xsl:value-of select="$startDate"/>
|
62 |
|
|
</FIELD>
|
63 |
|
|
<FIELD name="enddate" type="date" format="{$dateFormat}">
|
64 |
|
|
<xsl:value-of select="$endDate"/>
|
65 |
|
|
</FIELD>
|
66 |
|
|
<FIELD name="title">
|
67 |
|
|
<xsl:value-of select=".//Grant/Title"/>
|
68 |
|
|
</FIELD>
|
69 |
|
|
<FIELD name="contracttypeclass">UNKNOWN</FIELD>
|
70 |
|
|
<FIELD name="contracttypescheme">wt:contractTypes</FIELD>
|
71 |
|
|
|
72 |
|
|
<FIELD name="acronym"></FIELD>
|
73 |
|
|
<FIELD name="keywords">
|
74 |
|
|
<xsl:value-of select="normalize-space(.//Grant/Type)"/>
|
75 |
|
|
</FIELD>
|
76 |
|
|
<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
|
77 |
|
|
<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
|
78 |
|
|
<FIELD name="collectedfrom">
|
79 |
|
|
<xsl:value-of select="$parentDatasourceId"/>
|
80 |
|
|
</FIELD>
|
81 |
|
|
<FIELD name="optional1">
|
82 |
|
|
<xsl:value-of select="concat(.//Grant/Amount, ' ', .//Grant/Amount/@Currency)"/>
|
83 |
|
|
</FIELD>
|
84 |
48224
|
alessia.ba
|
<xsl:if test="string-length(normalize-space(.//Grant/Alias[1]/text())) > 0">
|
85 |
48139
|
alessia.ba
|
<xsl:variable name="projectAlias">
|
86 |
|
|
<xsl:call-template name="getJson">
|
87 |
|
|
<xsl:with-param name="varName">alias</xsl:with-param>
|
88 |
|
|
<xsl:with-param name="value">
|
89 |
48224
|
alessia.ba
|
<xsl:value-of select=".//Grant/Alias[1]"/>
|
90 |
48139
|
alessia.ba
|
</xsl:with-param>
|
91 |
|
|
</xsl:call-template>
|
92 |
|
|
</xsl:variable>
|
93 |
|
|
<xsl:variable name="jsonExtra">
|
94 |
|
|
<xsl:value-of select="concat('{', $projectAlias, '}')"/>
|
95 |
|
|
</xsl:variable>
|
96 |
|
|
<FIELD name="jsonextrainfo">
|
97 |
|
|
<xsl:value-of select="$jsonExtra"/>
|
98 |
|
|
</FIELD>
|
99 |
|
|
</xsl:if>
|
100 |
48224
|
alessia.ba
|
<!-- oa_mandate_for_publications is true for projects started after 2005 -->
|
101 |
48193
|
alessia.ba
|
<xsl:choose>
|
102 |
48224
|
alessia.ba
|
<!-- Invalid date: we need at least YYYY -->
|
103 |
|
|
<xsl:when test="string-length($startDate) < 4">
|
104 |
|
|
<FIELD name="oa_mandate_for_publications" type="boolean">false</FIELD>
|
105 |
|
|
</xsl:when>
|
106 |
48193
|
alessia.ba
|
<xsl:when test="xs:date($startDate) >= xs:date('2015-01-01')">
|
107 |
|
|
<FIELD name="oa_mandate_for_publications" type="boolean">true</FIELD>
|
108 |
|
|
</xsl:when>
|
109 |
|
|
<xsl:otherwise><FIELD name="oa_mandate_for_publications" type="boolean">false</FIELD></xsl:otherwise>
|
110 |
|
|
</xsl:choose>
|
111 |
48948
|
claudio.at
|
|
112 |
48960
|
claudio.at
|
<xsl:variable name="personSurname" select="normalize-space(.//Person/FamilyName)"/>
|
113 |
|
|
<xsl:variable name="personFirstName" select="normalize-space(.//Person/GivenName)"/>
|
114 |
48964
|
claudio.at
|
<xsl:variable name="personInitials" select="normalize-space(.//Person/Initials)"/>
|
115 |
|
|
<xsl:variable name="personTitle" select="normalize-space(.//Person/Title)"/>
|
116 |
|
|
|
117 |
48948
|
claudio.at
|
<xsl:variable name="contactfullname">
|
118 |
|
|
<xsl:choose>
|
119 |
|
|
<xsl:when test="string-length($personFirstName) > 0 and string-length($personSurname) > 0">
|
120 |
48964
|
claudio.at
|
<xsl:value-of select="normalize-space(concat($personTitle, ' ', $personSurname, ', ', $personFirstName, ' ', $personInitials))"/>
|
121 |
48948
|
claudio.at
|
</xsl:when>
|
122 |
|
|
<xsl:when test="string-length($personFirstName) > 0">
|
123 |
48964
|
claudio.at
|
<xsl:value-of select="normalize-space(concat($personFirstName, ' ', $personInitials))"/>
|
124 |
48948
|
claudio.at
|
</xsl:when>
|
125 |
|
|
<xsl:when test="string-length($personSurname) > 0">
|
126 |
48964
|
claudio.at
|
<xsl:choose>
|
127 |
|
|
<xsl:when test="string-length($personInitials) > 0">
|
128 |
|
|
<xsl:value-of select="normalize-space(concat($personTitle, ' ', $personSurname, ', ', $personInitials))"/>
|
129 |
|
|
</xsl:when>
|
130 |
|
|
<xsl:otherwise>
|
131 |
|
|
<xsl:value-of select="normalize-space(concat($personTitle, ' ', $personSurname))"/>
|
132 |
|
|
</xsl:otherwise>
|
133 |
|
|
</xsl:choose>
|
134 |
48948
|
claudio.at
|
</xsl:when>
|
135 |
|
|
<xsl:otherwise>
|
136 |
|
|
<xsl:value-of select="''"/>
|
137 |
|
|
</xsl:otherwise>
|
138 |
|
|
</xsl:choose>
|
139 |
|
|
</xsl:variable>
|
140 |
|
|
<xsl:if test="string-length($contactfullname) > 0">
|
141 |
|
|
<FIELD name="contactfullname">
|
142 |
|
|
<xsl:value-of select="$contactfullname"/>
|
143 |
|
|
</FIELD>
|
144 |
|
|
</xsl:if>
|
145 |
48139
|
alessia.ba
|
</ROW>
|
146 |
|
|
<ROW table="project_fundingpath">
|
147 |
|
|
<FIELD name="_dnet_resource_identifier_">
|
148 |
|
|
<xsl:value-of select="concat($fundingID,'@@', $projectID)"/>
|
149 |
|
|
</FIELD>
|
150 |
|
|
<FIELD name="funding">
|
151 |
|
|
<xsl:value-of select="$fundingID"/>
|
152 |
|
|
</FIELD>
|
153 |
|
|
<FIELD name="project">
|
154 |
|
|
<xsl:value-of select="$projectID"/>
|
155 |
|
|
</FIELD>
|
156 |
|
|
<FIELD name="startdate" type="date" format="{$dateFormat}">
|
157 |
|
|
<xsl:value-of select="$startDate"/>
|
158 |
|
|
</FIELD>
|
159 |
|
|
<FIELD name="enddate" type="date" format="{$dateFormat}">
|
160 |
|
|
<xsl:value-of select="$endDate"/>
|
161 |
|
|
</FIELD>
|
162 |
|
|
</ROW>
|
163 |
|
|
<xsl:if test="not(concat($namespacePrefix, '::') = $orgID)">
|
164 |
|
|
<ROW table="organizations">
|
165 |
|
|
<FIELD name="_dnet_resource_identifier_">
|
166 |
|
|
<xsl:value-of select="$orgID"/>
|
167 |
|
|
</FIELD>
|
168 |
|
|
<FIELD name="id">
|
169 |
|
|
<xsl:value-of select="$orgID"/>
|
170 |
|
|
</FIELD>
|
171 |
|
|
<FIELD name="legalname">
|
172 |
|
|
<xsl:value-of select=".//Institution/Name"/>
|
173 |
|
|
</FIELD>
|
174 |
|
|
<FIELD name="collectedfrom">
|
175 |
|
|
<xsl:value-of select="$parentDatasourceId"/>
|
176 |
|
|
</FIELD>
|
177 |
|
|
<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
|
178 |
|
|
<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
|
179 |
|
|
<FIELD name="trust" type="float">0.8</FIELD>
|
180 |
|
|
</ROW>
|
181 |
|
|
<ROW table="project_organization">
|
182 |
|
|
<FIELD name="_dnet_resource_identifier_">
|
183 |
|
|
<xsl:value-of select="concat($projectID, '@@', $orgID)"/>
|
184 |
|
|
</FIELD>
|
185 |
|
|
<FIELD name="participantnumber" type="int">1</FIELD>
|
186 |
|
|
<FIELD name="startdate" type="date" format="{$dateFormat}">
|
187 |
|
|
<xsl:value-of select="$startDate"/>
|
188 |
|
|
</FIELD>
|
189 |
|
|
<FIELD name="enddate" type="date" format="{$dateFormat}">
|
190 |
|
|
<xsl:value-of select="$endDate"/>
|
191 |
|
|
</FIELD>
|
192 |
|
|
<FIELD name="project">
|
193 |
|
|
<xsl:value-of select="$projectID"/>
|
194 |
|
|
</FIELD>
|
195 |
|
|
<FIELD name="resporganization">
|
196 |
|
|
<xsl:value-of select="$orgID"/>
|
197 |
|
|
</FIELD>
|
198 |
|
|
<FIELD name="semanticclass">coordinator</FIELD>
|
199 |
|
|
<FIELD name="semanticscheme">dnet:project_organization_relations</FIELD>
|
200 |
|
|
</ROW>
|
201 |
|
|
</xsl:if>
|
202 |
|
|
</xsl:if>
|
203 |
|
|
</ROWS>
|
204 |
|
|
</metadata>
|
205 |
26600
|
sandro.lab
|
</record>
|
206 |
|
|
</xsl:template>
|
207 |
48948
|
claudio.at
|
</xsl:stylesheet>
|