Project

General

Profile

« Previous | Next » 

Revision 48139

integrated (hopefully) all required changes from dnet40

View differences:

snsf_contexts.xsl
1 1
<?xml version="1.0" encoding="UTF-8"?>
2 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">
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 5

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

  
9 9
	<xsl:template match="/">
10 10
		<fundings>
11
			<xsl:variable name="p0"	select="normalize-space(.//column[@name='Funding Instrument Hierarchy'])" />
12
			<xsl:variable name="p1" select="normalize-space(.//column[@name='Funding Instrument'])" />
11
			<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 13

  
14 14
			<fundingtree>
15 15
				<funder>
16
					<id><xsl:value-of select="$funderID" /></id>
16
					<id>
17
						<xsl:value-of select="$funderID"/>
18
					</id>
17 19
					<shortname>SNSF</shortname>
18 20
					<name>Swiss National Science Foundation</name>
19 21
					<jurisdiction>CH</jurisdiction>
......
21 23
				<xsl:if test="string-length($p1) &gt; 0">
22 24
					<xsl:choose>
23 25
						<xsl:when test="(string-length($p0) &gt; 0) and (string-length($p1) &gt; 0)">
24
							<xsl:variable name="level0" select="concat($funderID, '::', $p0)" />
25
							<xsl:variable name="level1"	select="concat($funderID, '::', $p0, '::', $p1)" />
26
							<xsl:variable name="level0" select="concat($funderID, '::', $p0)"/>
27
							<xsl:variable name="level1" select="concat($funderID, '::', $p0, '::', $p1)"/>
26 28
							<funding_level_1>
27
								<id><xsl:value-of select="$level1" /></id>
28
								<description><xsl:value-of select="$p1" /></description>
29
								<name><xsl:value-of select="$p1" /></name>
29
								<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>
30 38
								<parent>
31 39
									<funding_level_0>
32
										<id><xsl:value-of select="$level0" /></id>
33
										<description><xsl:value-of select="$p0" /></description>
34
										<name><xsl:value-of select="$p0" /></name>
35
										<parent />
40
										<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/>
36 50
										<class>snsf:fundingStream</class>
37 51
									</funding_level_0>
38 52
								</parent>
39 53
							</funding_level_1>
40 54
						</xsl:when>
41 55
						<xsl:when test="string-length($p0) &gt; 0">
42
							<xsl:variable name="level0" select="concat($funderID, '::', $p0)" />
56
							<xsl:variable name="level0" select="concat($funderID, '::', $p0)"/>
43 57
							<funding_level_0>
44
								<id><xsl:value-of select="$level0" /></id>
45
								<description><xsl:value-of select="$p0" /></description>
46
								<name><xsl:value-of select="$p0" /></name>
47
								<parent />
58
								<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/>
48 68
								<class>snsf:fundingStream</class>
49 69
							</funding_level_0>
50 70
						</xsl:when>
51 71
						<xsl:when test="string-length($p1) &gt; 0">
52
							<xsl:variable name="level0" select="concat($funderID, '::', $p1)" />
72
							<xsl:variable name="level0" select="concat($funderID, '::', $p1)"/>
53 73
							<funding_level_0>
54
								<id><xsl:value-of select="$level0" /></id>
55
								<description><xsl:value-of select="$p1" /></description>
56
								<name><xsl:value-of select="$p1" /></name>
57
								<parent />
74
								<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/>
58 84
								<class>snsf:fundingStream</class>
59 85
							</funding_level_0>
60 86
						</xsl:when>

Also available in: Unified diff