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&#x9;Authors&#x9;Publication Year&#x9;DOI&#x9;Permanent identifier&#x9;Publication type&#x9;Journal&#x9;Funder&#x9;Project Name (GA Number)&#x9;Access&#xD;</xsl:text>
13
-->
14
        <xsl:apply-templates select="//result"/>
15
    </xsl:template>
16

    
17
    <!-- Title&#x9; Authors&#x9; Description&#x9; Year&#x9; DOI&#x9; Permanent identifier&#x9; Publication type&#x9; Journal&#x9; Project Name&#x9; GA number&#x9; 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>&#x9;</xsl:text>
27

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

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

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

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

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

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

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

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

    
106
                    <xsl:text>&quot;</xsl:text>
107
                    <xsl:text>&#x9;</xsl:text>
108

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

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

    
124
                <!-- authors -->
125
                <xsl:text>&quot;</xsl:text>
126
                <xsl:for-each select="field[@name='hasAuthor']">
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>&#x9;</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>&#x9;</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>&#x9;</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>&#x9;</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>&#x9;</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>&#x9;</xsl:text>
170

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

    
176
                <!-- project name -->
177
                <xsl:text>&quot;</xsl:text>
178
                <!-- project name -->
179
                <xsl:text>&quot;</xsl:text>
180
                <xsl:text>&#x9;</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>
(36-36/46)