Project

General

Profile

1
<?xml version="1.0" encoding="UTF-8"?>
2
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
3
    <xsl:output method="xml" indent="yes" encoding="UTF-8"/>
4
    <xsl:template match="/">
5
        <result>
6
            <xsl:apply-templates select="row/groupresult"/>
7
        </result>
8
    </xsl:template>
9

    
10

    
11
    <xsl:template match="groupresult">
12
        <field>
13
            <xsl:attribute name='name'>
14
                <xsl:value-of select='./@field'/>
15
            </xsl:attribute>
16
            <xsl:attribute name='indexId'>
17
                <xsl:value-of select='./@field'/>
18
            </xsl:attribute>
19
            <field name="count">
20
                <xsl:attribute name="value">
21
                    <xsl:value-of select="./count"/>
22
                </xsl:attribute>
23
            </field>
24
            <field name="value">
25
                <xsl:choose>
26
                    <xsl:when test="./@field='funderid' or ./@field='fundinglevel0_id' or ./@field='fundinglevel1_id' or ./@field='fundinglevel2_id' or ./@field='relfunderid' or ./@field='relfundinglevel0_id' or ./@field='relfundinglevel1_id' or ./@field='relfundinglevel2_id'">
27
                        <xsl:attribute name="value">
28
                            <xsl:call-template name="getExtension">
29
						<xsl:with-param name="filename" select="./value"/>
30
                            </xsl:call-template>
31
                        </xsl:attribute>
32
                        <xsl:attribute name="value_original">
33
                            <xsl:value-of select="./value"/>
34
                        </xsl:attribute>
35
                    </xsl:when>
36
                    <xsl:otherwise>
37
                        <xsl:attribute name="value">
38
                            <xsl:value-of select="./value"/>
39
                        </xsl:attribute>
40
                        <xsl:attribute name="value_original">
41
                            <xsl:value-of select="./value"/>
42
                        </xsl:attribute>
43
                    </xsl:otherwise>
44
                </xsl:choose>
45
            </field>
46
        </field>
47
    </xsl:template>
48

    
49
    <xsl:template match="node() | @*"></xsl:template>
50

    
51
    <xsl:template name="getExtension">
52
        <xsl:param name="filename"/>
53
        <xsl:choose>
54
            <xsl:when test="contains($filename, '_::')">
55
                <xsl:call-template name="getExtension">
56
                    <xsl:with-param name="filename" select="substring-after($filename, '_::')"/>
57
                </xsl:call-template>
58
            </xsl:when>
59
            <xsl:otherwise>
60
                <xsl:value-of select="$filename"/>
61
            </xsl:otherwise>
62
        </xsl:choose>
63
    </xsl:template>
64

    
65

    
66
</xsl:stylesheet>
(3-3/40)