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
        <xsl:text disable-output-escaping="yes">Title&#x9;Authors&#x9;Publication Year&#x9;DOI&#x9;Download From&#x9;Publication type&#x9;Journal&#x9;Funder&#x9;Project Name (GA Number)&#x9;Access&#xD;</xsl:text>
12
        <xsl:apply-templates select="//result"/>
13
    </xsl:template>
14

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

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

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

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

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

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

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

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

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

    
104
                    <xsl:text>&quot;</xsl:text>
105
                    <xsl:text>&#x9;</xsl:text>
106

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

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

    
122
                <!-- authors -->
123
                <xsl:text>&quot;</xsl:text>
124
                <xsl:for-each select="field[@name='hasAuthor']">
125
                    <xsl:value-of select="field[@name='fullname']/@value"/>
126
                    <xsl:if test="not(position()=last())">
127
                        <xsl:text>;</xsl:text>
128
                    </xsl:if>
129
                </xsl:for-each>
130
                <xsl:text>&quot;</xsl:text>
131
                <xsl:text>&#x9;</xsl:text>
132

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

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

    
149
                <!-- Download From -->
150
                <xsl:text>&quot;</xsl:text>
151
                <xsl:value-of select="field[@name='datasource'][1]/field[@name='url']/@value"/>
152
                <xsl:text>&quot;</xsl:text>
153
                <xsl:text>&#x9;</xsl:text>
154

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

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

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

    
174
                <!-- project name -->
175
                <xsl:text>&quot;</xsl:text>
176
                <!-- project name -->
177
                <xsl:text>&quot;</xsl:text>
178
                <xsl:text>&#x9;</xsl:text>
179

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

    
188
    </xsl:template>
189

    
190
</xsl:stylesheet>
(44-44/46)