1 |
44471
|
michele.ar
|
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
|
|
<xsl:stylesheet version="1.0"
|
3 |
48139
|
alessia.ba
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fn="http://www.w3.org/2005/xpath-functions"
|
4 |
|
|
exclude-result-prefixes="fn">
|
5 |
44471
|
michele.ar
|
|
6 |
48139
|
alessia.ba
|
<xsl:variable name="namespacePrefix" select="string('snsf________')"/>
|
7 |
|
|
<xsl:variable name="funderID" select="concat($namespacePrefix, '::SNSF')"/>
|
8 |
44471
|
michele.ar
|
|
9 |
|
|
<xsl:template match="/">
|
10 |
|
|
<fundings>
|
11 |
48139
|
alessia.ba
|
<xsl:variable name="p0" select="normalize-space(.//column[@name='Funding Instrument Hierarchy'])"/>
|
12 |
|
|
<xsl:variable name="p1" select="normalize-space(.//column[@name='Funding Instrument'])"/>
|
13 |
44471
|
michele.ar
|
|
14 |
|
|
<fundingtree>
|
15 |
|
|
<funder>
|
16 |
48139
|
alessia.ba
|
<id>
|
17 |
|
|
<xsl:value-of select="$funderID"/>
|
18 |
|
|
</id>
|
19 |
44471
|
michele.ar
|
<shortname>SNSF</shortname>
|
20 |
|
|
<name>Swiss National Science Foundation</name>
|
21 |
|
|
<jurisdiction>CH</jurisdiction>
|
22 |
|
|
</funder>
|
23 |
|
|
<xsl:if test="string-length($p1) > 0">
|
24 |
|
|
<xsl:choose>
|
25 |
|
|
<xsl:when test="(string-length($p0) > 0) and (string-length($p1) > 0)">
|
26 |
48139
|
alessia.ba
|
<xsl:variable name="level0" select="concat($funderID, '::', $p0)"/>
|
27 |
|
|
<xsl:variable name="level1" select="concat($funderID, '::', $p0, '::', $p1)"/>
|
28 |
44471
|
michele.ar
|
<funding_level_1>
|
29 |
48139
|
alessia.ba
|
<id>
|
30 |
|
|
<xsl:value-of select="$level1"/>
|
31 |
|
|
</id>
|
32 |
|
|
<description>
|
33 |
|
|
<xsl:value-of select="$p1"/>
|
34 |
|
|
</description>
|
35 |
|
|
<name>
|
36 |
|
|
<xsl:value-of select="$p1"/>
|
37 |
|
|
</name>
|
38 |
44471
|
michele.ar
|
<parent>
|
39 |
|
|
<funding_level_0>
|
40 |
48139
|
alessia.ba
|
<id>
|
41 |
|
|
<xsl:value-of select="$level0"/>
|
42 |
|
|
</id>
|
43 |
|
|
<description>
|
44 |
|
|
<xsl:value-of select="$p0"/>
|
45 |
|
|
</description>
|
46 |
|
|
<name>
|
47 |
|
|
<xsl:value-of select="$p0"/>
|
48 |
|
|
</name>
|
49 |
|
|
<parent/>
|
50 |
44471
|
michele.ar
|
<class>snsf:fundingStream</class>
|
51 |
|
|
</funding_level_0>
|
52 |
|
|
</parent>
|
53 |
|
|
</funding_level_1>
|
54 |
|
|
</xsl:when>
|
55 |
|
|
<xsl:when test="string-length($p0) > 0">
|
56 |
48139
|
alessia.ba
|
<xsl:variable name="level0" select="concat($funderID, '::', $p0)"/>
|
57 |
44471
|
michele.ar
|
<funding_level_0>
|
58 |
48139
|
alessia.ba
|
<id>
|
59 |
|
|
<xsl:value-of select="$level0"/>
|
60 |
|
|
</id>
|
61 |
|
|
<description>
|
62 |
|
|
<xsl:value-of select="$p0"/>
|
63 |
|
|
</description>
|
64 |
|
|
<name>
|
65 |
|
|
<xsl:value-of select="$p0"/>
|
66 |
|
|
</name>
|
67 |
|
|
<parent/>
|
68 |
44471
|
michele.ar
|
<class>snsf:fundingStream</class>
|
69 |
|
|
</funding_level_0>
|
70 |
|
|
</xsl:when>
|
71 |
|
|
<xsl:when test="string-length($p1) > 0">
|
72 |
48139
|
alessia.ba
|
<xsl:variable name="level0" select="concat($funderID, '::', $p1)"/>
|
73 |
44471
|
michele.ar
|
<funding_level_0>
|
74 |
48139
|
alessia.ba
|
<id>
|
75 |
|
|
<xsl:value-of select="$level0"/>
|
76 |
|
|
</id>
|
77 |
|
|
<description>
|
78 |
|
|
<xsl:value-of select="$p1"/>
|
79 |
|
|
</description>
|
80 |
|
|
<name>
|
81 |
|
|
<xsl:value-of select="$p1"/>
|
82 |
|
|
</name>
|
83 |
|
|
<parent/>
|
84 |
44471
|
michele.ar
|
<class>snsf:fundingStream</class>
|
85 |
|
|
</funding_level_0>
|
86 |
|
|
</xsl:when>
|
87 |
|
|
<xsl:otherwise><!-- Funding columns are empty --></xsl:otherwise>
|
88 |
|
|
</xsl:choose>
|
89 |
|
|
</xsl:if>
|
90 |
|
|
</fundingtree>
|
91 |
|
|
</fundings>
|
92 |
|
|
</xsl:template>
|
93 |
|
|
</xsl:stylesheet>
|