Revision 52391
Added by Alessia Bardi almost 6 years ago
modules/dnet-openaireplus-profiles/trunk/src/main/resources/eu/dnetlib/test/profiles/TransformationRuleDSResources/TransformationRuleDSResourceType/funders/rcuk_2_db.xml | ||
---|---|---|
13 | 13 |
<TITLE>RCUK to DB</TITLE> |
14 | 14 |
<CODE> |
15 | 15 |
<![CDATA[ |
16 |
|
|
17 | 16 |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
18 |
xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs" version="2.0"> |
|
17 |
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:per="http://gtr.ukri.org/gtr/api/person" exclude-result-prefixes="xs" version="2.0">
|
|
19 | 18 |
|
20 | 19 |
<xsl:param name="varDataSourceId"/> |
21 | 20 |
<xsl:variable name="namespacePrefix" select="string('rcuk________')"/> |
... | ... | |
24 | 23 |
<xsl:variable name="funderID" select="concat($namespacePrefix, '::RCUK')"/> |
25 | 24 |
|
26 | 25 |
<xsl:template match="/"> |
27 |
|
|
28 |
|
|
29 | 26 |
<record> |
30 |
|
|
31 | 27 |
<xsl:copy-of select=".//*[local-name() = 'header']"/> |
32 |
|
|
33 | 28 |
<metadata> |
34 | 29 |
<ROWS> |
35 | 30 |
<xsl:variable name="projectCode" |
... | ... | |
67 | 62 |
</xsl:otherwise> |
68 | 63 |
</xsl:choose> |
69 | 64 |
</xsl:variable> |
70 |
|
|
71 |
<xsl:variable name="personCode" |
|
72 |
select=".//*[local-name() = 'person']/@*[local-name() = 'id']"/> |
|
73 |
<xsl:variable name="personId" |
|
74 |
select="concat($namespacePrefix, '::', $personCode)"/> |
|
75 | 65 |
<xsl:variable name="funding" select=".//*[local-name() = 'funder']/name"/> |
76 | 66 |
<xsl:variable name="fundingId"> |
77 | 67 |
<xsl:choose> |
... | ... | |
114 | 104 |
/> |
115 | 105 |
</FIELD> |
116 | 106 |
|
117 |
<xsl:variable name="personSurname" |
|
118 |
select="normalize-space(.//*[local-name() = 'surname'])"/> |
|
119 |
<xsl:variable name="personFirstName" |
|
120 |
select="normalize-space(.//*[local-name() = 'firstName'])"/> |
|
121 |
<xsl:variable name="contactfullname"> |
|
122 |
<xsl:choose> |
|
123 |
<xsl:when |
|
124 |
test="string-length($personFirstName) > 0 and string-length($personSurname) > 0"> |
|
125 |
<xsl:value-of |
|
126 |
select="normalize-space(concat($personSurname, ', ', $personFirstName))" |
|
127 |
/> |
|
128 |
</xsl:when> |
|
129 |
<xsl:when test="string-length($personFirstName) > 0"> |
|
130 |
<xsl:value-of select="$personFirstName"/> |
|
131 |
</xsl:when> |
|
132 |
<xsl:when test="string-length($personSurname) > 0"> |
|
133 |
<xsl:value-of select="$personSurname"/> |
|
134 |
</xsl:when> |
|
135 |
<xsl:otherwise> |
|
136 |
<xsl:value-of select="''"/> |
|
137 |
</xsl:otherwise> |
|
138 |
</xsl:choose> |
|
107 |
<xsl:variable name="principalInvestigators"> |
|
108 |
<xsl:apply-templates select=".//*[local-name() = 'person']"/> |
|
139 | 109 |
</xsl:variable> |
140 |
<xsl:if test="string-length($contactfullname) > 0"> |
|
110 |
|
|
111 |
<xsl:if test="string-length($principalInvestigators) > 0"> |
|
141 | 112 |
<FIELD name="contactfullname"> |
142 |
<xsl:value-of select="$contactfullname"/>
|
|
113 |
<xsl:value-of select="$principalInvestigators"/>
|
|
143 | 114 |
</FIELD> |
144 | 115 |
</xsl:if> |
145 | 116 |
<FIELD name="lastupdate" type="date"> |
... | ... | |
207 | 178 |
<xsl:value-of select="$organizationId"/> |
208 | 179 |
</FIELD> |
209 | 180 |
|
210 |
<FIELD name="semanticclass">participant</FIELD>
|
|
181 |
<FIELD name="role">participant</FIELD>
|
|
211 | 182 |
|
212 | 183 |
</ROW> |
213 | 184 |
|
... | ... | |
260 | 231 |
</record> |
261 | 232 |
</xsl:template> |
262 | 233 |
|
234 |
<xsl:template match="per:person"> |
|
235 |
<xsl:variable name="personSurname" |
|
236 |
select="normalize-space(.//*[local-name() = 'surname'])"/> |
|
237 |
<xsl:variable name="personFirstName" |
|
238 |
select="normalize-space(.//*[local-name() = 'firstName'])"/> |
|
239 |
<xsl:variable name="contactfullname"> |
|
240 |
<xsl:choose> |
|
241 |
<xsl:when |
|
242 |
test="string-length($personFirstName) > 0 and string-length($personSurname) > 0"> |
|
243 |
<xsl:value-of |
|
244 |
select="normalize-space(concat($personSurname, ', ', $personFirstName))" |
|
245 |
/> |
|
246 |
</xsl:when> |
|
247 |
<xsl:when test="string-length($personFirstName) > 0"> |
|
248 |
<xsl:value-of select="$personFirstName"/> |
|
249 |
</xsl:when> |
|
250 |
<xsl:when test="string-length($personSurname) > 0"> |
|
251 |
<xsl:value-of select="$personSurname"/> |
|
252 |
</xsl:when> |
|
253 |
<xsl:otherwise> |
|
254 |
<xsl:value-of select="''"/> |
|
255 |
</xsl:otherwise> |
|
256 |
</xsl:choose> |
|
257 |
</xsl:variable> |
|
258 |
<xsl:value-of select="concat($contactfullname,';')"/> |
|
259 |
</xsl:template> |
|
263 | 260 |
</xsl:stylesheet> |
264 | 261 |
|
265 | 262 |
]]> |
Also available in: Unified diff
RCUK to DB: Added namespace for person xpath