Project

General

Profile

« Previous | Next » 

Revision 60434

Added by Miriam Baglioni 11 months ago

we lost the information for one eventual level 2 in the funding stream with the data we get from the api

View differences:

fct_contexts.xsl
1 1
<?xml version="1.0" encoding="UTF-8"?>
2 2

  
3 3
<xsl:stylesheet version="1.0"
4
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fn="http://www.w3.org/2005/xpath-functions"
5
                exclude-result-prefixes="fn">
4
				xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fn="http://www.w3.org/2005/xpath-functions"
5
				exclude-result-prefixes="fn">
6 6

  
7 7
	<xsl:variable name="namespacePrefix" select="string('fct_________')"/>
8 8
	<xsl:variable name="funderID" select="concat($namespacePrefix, '::FCT')"/>
9 9

  
10 10
	<xsl:template match="/">
11
		<xsl:variable name="p1" select="normalize-space(.//funding/program)"/>
12
		<xsl:variable name="p2" select="normalize-space(.//funding/program2)"/>
11
		<xsl:variable name="p1" select="normalize-space(.//*[local-name() = 'Identifier'][@type = 'https://w3id.org/cerif/vocab/IdentifierTypes#FundingProgram'])"/>
13 12

  
14 13
		<fundingtree>
15 14
			<funder>
......
21 20
				<jurisdiction>PT</jurisdiction>
22 21
			</funder>
23 22
			<xsl:if test="string-length($p1) &gt; 0">
24
				<xsl:choose>
25
					<xsl:when test="string-length($p2) &gt; 0">
26
						<xsl:variable name="level0" select="concat($funderID, '::', $p1)"/>
27
						<xsl:variable name="level1" select="concat($funderID, '::', $p1, '::', $p2)"/>
28
						<funding_level_1>
29
							<id>
30
								<xsl:value-of select="$level1"/>
31
							</id>
32
							<description>
33
								<xsl:value-of select="$p2"/>
34
							</description>
35
							<name>
36
								<xsl:value-of select="$p2"/>
37
							</name>
38
							<parent>
39
								<funding_level_0>
40
									<id>
41
										<xsl:value-of select="$level0"/>
42
									</id>
43
									<description>
44
										<xsl:value-of select="$p1"/>
45
									</description>
46
									<name>
47
										<xsl:value-of select="$p1"/>
48
									</name>
49
									<parent/>
50
									<class>fct:program</class>
51
								</funding_level_0>
52
							</parent>
53
						</funding_level_1>
54
					</xsl:when>
55
					<xsl:otherwise>
56
						<xsl:variable name="level0" select="concat($funderID, '::', $p1)"/>
57
						<funding_level_0>
58
							<id>
59
								<xsl:value-of select="$level0"/>
60
							</id>
61
							<description>
62
								<xsl:value-of select="$p1"/>
63
							</description>
64
							<name>
65
								<xsl:value-of select="$p1"/>
66
							</name>
67
							<parent/>
68
							<class>fct:program</class>
69
						</funding_level_0>
70
					</xsl:otherwise>
71
				</xsl:choose>
23

  
24
				<xsl:variable name="level0" select="concat($funderID, '::', $p1)"/>
25
				<funding_level_0>
26
					<id>
27
						<xsl:value-of select="$level0"/>
28
					</id>
29
					<description>
30
						<xsl:value-of select="$p1"/>
31
					</description>
32
					<name>
33
						<xsl:value-of select="$p1"/>
34
					</name>
35
					<parent/>
36
					<class>fct:program</class>
37
				</funding_level_0>
72 38
			</xsl:if>
73 39
		</fundingtree>
74 40
	</xsl:template>
75 41

  
76
</xsl:stylesheet>
42
</xsl:stylesheet>

Also available in: Unified diff