Project

General

Profile

1
<?xml version="1.0" encoding="UTF-8"?>
2
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
3

    
4
    <!-- Turn off auto-insertion of <?xml> tag and set indenting on -->
5
    <xsl:output method="text" encoding="utf-8" omit-xml-declaration="yes" media-type="text/csv" />
6

    
7
    <!-- strip whitespace from whitespace-only nodes -->
8
    <xsl:strip-space elements="*"/>
9

    
10
    <xsl:template match = "/">
11
<!--
12
        <xsl:text disable-output-escaping="yes">Title,Authors,Publication Year,DOI,Permanent identifier,Publication type,Journal,Funder,Project Name (GA Number),Access&#xD;</xsl:text>
13
-->
14
        <xsl:apply-templates select="//result"/>
15
    </xsl:template>
16

    
17
    <!-- Title, Authors, Description, Year, DOI, Permanent identifier, Publication type, Journal, Project Name, GA number, Access -->
18
    <xsl:template match="result">
19
        <xsl:choose>
20
            <xsl:when test="field[@name='project']">
21
                <xsl:for-each select="field[@name='project']">
22
                    <!-- title -->
23
                    <xsl:text>&quot;</xsl:text>
24
                    <xsl:value-of select="../field[@name='title']/@value"/>
25
                    <xsl:text>&quot;</xsl:text>
26
                    <xsl:text>,</xsl:text>
27

    
28
                    <!-- authors -->
29
                    <xsl:text>&quot;</xsl:text>
30
                    <xsl:for-each select="../field[@name='hasAuthor']">
31
                        <xsl:value-of select="field[@name='fullname']/@value"/>
32
                        <xsl:if test="not(position()=last())">
33
                            <xsl:text>;</xsl:text>
34
                        </xsl:if>
35
                    </xsl:for-each>
36
                    <xsl:text>&quot;</xsl:text>
37
                    <xsl:text>,</xsl:text>
38

    
39
                    <!-- description
40
                    <xsl:text>&quot;</xsl:text>
41
                        <xsl:value-of select="field[@name='description']/@value"/>
42
                        <xsl:if test="position() != last()"><xsl:text>&#160;</xsl:text></xsl:if>
43
                    <xsl:text>&quot;</xsl:text>
44
                    <xsl:text>,</xsl:text>
45
            -->
46
                    <!-- year -->
47
                    <xsl:text>&quot;</xsl:text>
48
                    <xsl:value-of select="../field[@name='dateofacceptance']/@value"/>
49
                    <xsl:text>&quot;</xsl:text>
50
                    <xsl:text>,</xsl:text>
51

    
52
                    <!-- DOI -->
53
                    <xsl:for-each select="../field[@name='pid']">
54
                        <xsl:if test="field[@name='classid' and @value='doi']/@value = 'doi'">
55
                            <xsl:text>&quot;</xsl:text>
56
                            <xsl:value-of select="field[@name='value']/@value"/>
57
                            <xsl:text>&quot;</xsl:text>
58
                        </xsl:if>
59
                    </xsl:for-each>
60
                    <xsl:text>,</xsl:text>
61

    
62
                    <!-- Permanent Identifier -->
63
                    <xsl:text>&quot;</xsl:text>
64
                    <xsl:value-of select="../field[@name='datasource'][1]/field[@name='url']/@value"/>
65
                    <xsl:text>&quot;</xsl:text>
66
                    <xsl:text>,</xsl:text>
67

    
68
                    <!-- Publication type -->
69
                    <xsl:text>&quot;</xsl:text>
70
                    <xsl:value-of select="../field[@name='datasource'][1]/field[@name='typename']/@value"/>
71
                    <xsl:text>&quot;</xsl:text>
72
                    <xsl:text>,</xsl:text>
73

    
74
                    <!-- journal -->
75
                    <xsl:text>&quot;</xsl:text>
76
                    <xsl:for-each select="../field[@name='source']">
77
                        <xsl:value-of select="replace(@value, '&lt;/?\w+[^&lt;]*&gt;', '')"/>
78
                    </xsl:for-each>
79
                    <xsl:text>&quot;</xsl:text>
80
                    <xsl:text>,</xsl:text>
81

    
82
                    <!-- Funder -->
83
                    <xsl:text>&quot;</xsl:text>
84
                    <xsl:for-each select="field[@name='funding']/field[@name='funder']">
85
                        <xsl:value-of select="@value"/>
86
                    </xsl:for-each>
87
                    <xsl:text>&quot;</xsl:text>
88
                    <xsl:text>,</xsl:text>
89

    
90
                    <!-- project name -->
91
                    <xsl:text>&quot;</xsl:text>
92
                    <!-- project name -->
93
                    <xsl:choose>
94
                        <xsl:when test="field[@name='projectacronym']/@value != ''" >
95
                            <xsl:value-of select="field[@name='projectacronym']/@value"/>
96
                        </xsl:when>
97
                        <xsl:otherwise>
98
                            <xsl:value-of select="field[@name='projecttitle']/@value"/>
99
                        </xsl:otherwise>
100
                    </xsl:choose>
101
                    <xsl:if test="field[@name='projectcode']/@value!= ''">
102
                        <xsl:value-of select="concat('(',field[@name='projectcode']/@value,')')"/>
103
                    </xsl:if>
104

    
105
                    <xsl:text>&quot;</xsl:text>
106
                    <xsl:text>,</xsl:text>
107

    
108
                    <!--access -->
109
                    <xsl:text>&quot;</xsl:text>
110
                    <xsl:value-of select="../field[@name='bestaccessright']/@value"/>
111
                    <xsl:text>&quot;</xsl:text>
112
                    <xsl:text>&#xD;</xsl:text>
113

    
114
                </xsl:for-each>
115
            </xsl:when>
116
            <xsl:otherwise>
117
                <!-- title -->
118
                <xsl:text>&quot;</xsl:text>
119
                <xsl:value-of select="field[@name='title']/@value"/>
120
                <xsl:text>&quot;</xsl:text>
121
                <xsl:text>,</xsl:text>
122

    
123
                <!-- authors -->
124
                <xsl:text>&quot;</xsl:text>
125
                <xsl:for-each select="field[@name='hasAuthor']">
126
                    <xsl:sort select="./field[@name='ranking']/@value" data-type="number"/>
127
                    <xsl:value-of select="field[@name='fullname']/@value"/>
128
                    <xsl:if test="not(position()=last())">
129
                        <xsl:text>;</xsl:text>
130
                    </xsl:if>
131
                </xsl:for-each>
132
                <xsl:text>&quot;</xsl:text>
133
                <xsl:text>,</xsl:text>
134

    
135
                <!-- year -->
136
                <xsl:text>&quot;</xsl:text>
137
                <xsl:value-of select="field[@name='dateofacceptance']/@value"/>
138
                <xsl:text>&quot;</xsl:text>
139
                <xsl:text>,</xsl:text>
140

    
141
                <!-- DOI -->
142
                <xsl:for-each select="field[@name='pid']">
143
                    <xsl:if test="field[@name='classid' and @value='doi']/@value = 'doi'">
144
                        <xsl:text>&quot;</xsl:text>
145
                        <xsl:value-of select="field[@name='value']/@value"/>
146
                        <xsl:text>&quot;</xsl:text>
147
                    </xsl:if>
148
                </xsl:for-each>
149
                <xsl:text>,</xsl:text>
150

    
151
                <!-- Permanent Identifier -->
152
                <xsl:text>&quot;</xsl:text>
153
                <xsl:value-of select="field[@name='datasource'][1]/field[@name='url']/@value"/>
154
                <xsl:text>&quot;</xsl:text>
155
                <xsl:text>,</xsl:text>
156

    
157
                <!-- Publication type -->
158
                <xsl:text>&quot;</xsl:text>
159
                <xsl:value-of select="field[@name='datasource'][1]/field[@name='typename']/@value"/>
160
                <xsl:text>&quot;</xsl:text>
161
                <xsl:text>,</xsl:text>
162

    
163
                <!-- journal -->
164
                <xsl:text>&quot;</xsl:text>
165
                <xsl:for-each select="field[@name='source']">
166
                    <xsl:value-of select="@value"/>
167
                </xsl:for-each>
168
                <xsl:text>&quot;</xsl:text>
169
                <xsl:text>,</xsl:text>
170

    
171
                <!-- Funder -->
172
                <xsl:text>&quot;</xsl:text>
173
                <xsl:text>&quot;</xsl:text>
174
                <xsl:text>,</xsl:text>
175

    
176
                <!-- project name -->
177
                <xsl:text>&quot;</xsl:text>
178
                <!-- project name -->
179
                <xsl:text>&quot;</xsl:text>
180
                <xsl:text>,</xsl:text>
181

    
182
                <!--access -->
183
                <xsl:text>&quot;</xsl:text>
184
                <xsl:value-of select="../field[@name='bestaccessright']/@value"/>
185
                <xsl:text>&quot;</xsl:text>
186
                <xsl:text>&#xD;</xsl:text>
187
            </xsl:otherwise>
188
        </xsl:choose>
189

    
190
    </xsl:template>
191

    
192
</xsl:stylesheet>
(35-35/46)