Project

General

Profile

1
<?xml version="1.0" encoding="UTF-8"?>
2
<xsl:stylesheet version="1.0"
3
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4
	xmlns:fn="http://www.w3.org/2005/xpath-functions" exclude-result-prefixes="fn">
5

    
6
	<xsl:variable name="namespacePrefix" select="string('ec_h2020fund')"/>
7

    
8
	<xsl:template match="/">
9
	
10
		<fundings>
11
			<fundingtree>
12
				<funder>
13
					<id>ec__________::EC</id>
14
					<shortname>EC</shortname>
15
					<name>European Commission</name>
16
					<jurisdiction>EU</jurisdiction>
17
				</funder>
18
				<xsl:call-template name="level3" />
19
			</fundingtree>
20
			<xsl:if test="string-length(//level_4/@code) &gt; 0">
21
				<fundingtree>
22
					<funder>
23
						<id>ec__________::EC</id>
24
						<shortname>EC</shortname>
25
						<name>European Commission</name>
26
						<jurisdiction>EU</jurisdiction>
27
					</funder>
28
					<funding_level_3>
29
						<id><xsl:value-of select="concat($namespacePrefix, '::', //level_1/@code, '::', //level_2/@code, '::', //level_3/@code, '::', //level_4/@code)" /></id>
30
						<description><xsl:value-of select="//level_4" /></description>
31
						<name><xsl:value-of select="//level_4/@code" /></name>
32
						<class>ec:h2020fundings</class>
33
						<parent>
34
							<xsl:call-template name="level3" />
35
						</parent>
36
					</funding_level_3>
37
				</fundingtree>
38
			</xsl:if>
39
		</fundings>
40
	</xsl:template>
41
	
42
	<xsl:template name="level3">
43
		<funding_level_2>
44
			<id><xsl:value-of select="concat($namespacePrefix, '::', //level_1/@code, '::', //level_2/@code, '::', //level_3/@code)" /></id>
45
			<description><xsl:value-of select="//level_3" /></description>
46
			<name><xsl:value-of select="//level_3/@code" /></name>
47
			<class>ec:h2020fundings</class>
48
			<parent>
49
				<funding_level_1>
50
					<id><xsl:value-of select="concat($namespacePrefix, '::', //level_1/@code, '::', //level_2/@code)" /></id>
51
					<description><xsl:value-of select="//level_2" /></description>
52
					<name><xsl:value-of select="//level_2/@code" /></name>
53
					<class>ec:h2020fundings</class>
54
					<parent>
55
						<funding_level_0>
56
							<id><xsl:value-of select="concat($namespacePrefix, '::', //level_1/@code)" /></id>
57
							<description><xsl:value-of select="//level_1" /></description>
58
							<name><xsl:value-of select="//level_1/@code" /></name>
59
							<class>ec:h2020fundings</class>
60
							<parent />
61
						</funding_level_0>
62
					</parent>
63
				</funding_level_1>
64
			</parent>
65
		</funding_level_2>
66
	</xsl:template>
67

    
68
</xsl:stylesheet>
(4-4/6)