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" xmlns:fn="http://www.w3.org/2005/xpath-functions"
4
                exclude-result-prefixes="fn">
5

    
6
	<xsl:variable name="namespacePrefix" select="string('ec__________')"/>
7
	<xsl:variable name="funderID" select="concat($namespacePrefix, '::EC')"/>
8

    
9
	<xsl:template match="/">
10
		<xsl:variable name="specificProgramName">
11
			<xsl:value-of select="normalize-space(.//ProjectSpecificProgram)"/>
12
		</xsl:variable>
13
		<xsl:variable name="programName">
14
			<xsl:value-of select="normalize-space(.//ProjectProgram)"/>
15
		</xsl:variable>
16
		<xsl:variable name="specificProgramDesc" select=".//ProjectSpecificProgramDescr"/>
17
		<xsl:variable name="specificProgramId"
18
		              select="normalize-space(concat($funderID, '::FP7::', $specificProgramName))"/>
19
		<xsl:variable name="programDesc" select=".//ProjectProgramDescr"/>
20
		<xsl:variable name="programId"
21
		              select="concat($funderID, '::FP7::', $specificProgramName, '::', $programName)"/>
22

    
23
		<fundingtree>
24
			<funder>
25
				<id>
26
					<xsl:value-of select="$funderID"/>
27
				</id>
28
				<shortname>EC</shortname>
29
				<name>European Commission</name>
30
				<jurisdiction>EU</jurisdiction>
31
			</funder>
32
			<xsl:choose>
33
				<xsl:when test="string-length($programName) > 0 and string-length($specificProgramName) > 0">
34
				<funding_level_2>
35
				<id>
36
					<xsl:value-of select="$programId"/>
37
				</id>
38
				<description>
39
					<xsl:value-of select="$programDesc"/>
40
				</description>
41
				<name>
42
					<xsl:value-of select="$programName"/>
43
				</name>
44
				<class>ec:program</class>
45
				<parent>
46
					<funding_level_1>
47
						<id>
48
							<xsl:value-of select="$specificProgramId"/>
49
						</id>
50
						<description>
51
							<xsl:value-of select="$specificProgramDesc"/>
52
						</description>
53
						<name>
54
							<xsl:value-of select="$specificProgramName"/>
55
						</name>
56
						<class>ec:specificprogram</class>
57
						<parent>
58
							<funding_level_0>
59
								<id>
60
									<xsl:value-of select="concat($funderID, '::FP7')"/>
61
								</id>
62
								<description>SEVENTH FRAMEWORK PROGRAMME</description>
63
								<name>FP7</name>
64
								<parent/>
65
								<class>ec:frameworkprogram</class>
66
							</funding_level_0>
67
						</parent>
68
					</funding_level_1>
69
				</parent>
70
				</funding_level_2>
71
				</xsl:when>
72
				<xsl:otherwise>
73
					<xsl:choose>
74
						<xsl:when test="string-length($specificProgramName) > 0">
75
							<funding_level_1>
76
								<id>
77
									<xsl:value-of select="$specificProgramId"/>
78
								</id>
79
								<description>
80
									<xsl:value-of select="$specificProgramDesc"/>
81
								</description>
82
								<name>
83
									<xsl:value-of select="$specificProgramName"/>
84
								</name>
85
								<class>ec:specificprogram</class>
86
								<parent>
87
									<funding_level_0>
88
										<id>
89
											<xsl:value-of select="concat($funderID, '::FP7')"/>
90
										</id>
91
										<description>SEVENTH FRAMEWORK PROGRAMME</description>
92
										<name>FP7</name>
93
										<parent/>
94
										<class>ec:frameworkprogram</class>
95
									</funding_level_0>
96
								</parent>
97
							</funding_level_1>
98
						</xsl:when>
99
						<xsl:otherwise>
100
							<funding_level_0>
101
								<id>
102
									<xsl:value-of select="concat($funderID, '::FP7')"/>
103
								</id>
104
								<description>SEVENTH FRAMEWORK PROGRAMME</description>
105
								<name>FP7</name>
106
								<parent/>
107
								<class>ec:frameworkprogram</class>
108
							</funding_level_0>
109
						</xsl:otherwise>
110
					</xsl:choose>
111
				</xsl:otherwise>
112
			</xsl:choose>
113
		</fundingtree>
114
	</xsl:template>
115

    
116
</xsl:stylesheet>
(5-5/30)