Project

General

Profile

« Previous | Next » 

Revision 44970

WT funding id with spaces, if the input string has spaces

View differences:

wt_contexts_NEW.xsl
6 6
	<xsl:variable name="namespacePrefix" select="string('wt__________')"/>
7 7
	<xsl:variable name="funderID" select="concat($namespacePrefix, '::WT')"/>
8 8

  
9
	<xsl:variable name="fundingID">
10
		<xsl:choose>
11
			<xsl:when test="string-length(normalize-space(.//Grant/Stream)) &gt; 0">
12
				<xsl:value-of select="concat($funderID, '::', translate(.//Grant/Stream,' ','_'))"/>
13
			</xsl:when>
14
			<xsl:otherwise>
15
				<xsl:value-of select="$funderID"/>
16
			</xsl:otherwise>
17
		</xsl:choose>
18
	</xsl:variable>
19

  
20

  
21 9
	<xsl:template match="/">
22
		<xsl:variable name="funding">
23
			<xsl:choose>
24
				<xsl:when test="normalize-space(.//Grant/Stream)">
25
					<xsl:value-of select="normalize-space(.//Grant/Stream)"/>
26
				</xsl:when>
27
				<xsl:otherwise>
28
					<xsl:value-of select="string('UNKNOWN')"/>
29
				</xsl:otherwise>
30
			</xsl:choose>
31
		</xsl:variable>
32

  
10
		<fundings>
33 11
		<fundingtree>
34 12
			<funder>
35 13
				<id>
......
39 17
				<name>Wellcome Trust</name>
40 18
				<jurisdiction></jurisdiction>
41 19
			</funder>
42
			<xsl:if test="string-length(.//Grant/Stream) > 0">
20
			<xsl:variable name="stream" select="normalize-space(.//Grant/Stream)"/>
21
			<xsl:if test="string-length($stream) > 0">
43 22
			<funding_level_0>
44 23
				<id>
45
					<xsl:value-of select="concat($funderID, '::', translate(.//Grant/Stream,' ','_'))"/>
24
					<xsl:value-of select="concat($funderID, '::', $stream)"/>
46 25
				</id>
47 26
				<description>
48
					<xsl:value-of select=".//Grant/Stream"/>
27
					<xsl:value-of select="$stream"/>
49 28
				</description>
50 29
				<name>
51
					<xsl:value-of select=".//Grant/Stream"/>
30
					<xsl:value-of select="$stream"/>
52 31
				</name>
53 32
				<parent></parent>
54 33
				<class>wt:fundingStream</class>
55 34
			</funding_level_0>
56 35
			</xsl:if>
57 36
		</fundingtree>
37
		</fundings>
58 38
	</xsl:template>
59 39

  
60 40
</xsl:stylesheet>

Also available in: Unified diff