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: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>&#x9;</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>&#x9;</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>&#x9;</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>&#x9;</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>&#x9;</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>&#x9;</xsl:text>
73

    
74
                    <!-- journal -->
75
                    <xsl:text>&quot;</xsl:text>
76
                    <xsl:for-each select="../field[@name='source']">
77
                        <xsl:value-of select="@value"/>
78
                    </xsl:for-each>
79
                    <xsl:text>&quot;</xsl:text>
80
                    <xsl:text>&#x9;</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>&#x9;</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>&#x9;</xsl:text>
107

    
108
                    <!--access -->
109
                    <xsl:text>&quot;</xsl:text>
110
                    <xsl:value-of select="../field[@name='bestlicense']/@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>&#x9;</xsl:text>
122

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

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

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

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

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

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

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

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

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

    
189
    </xsl:template>
190

    
191
</xsl:stylesheet>
(30-30/40)