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

    
15
    <!-- Title, Authors, Description, Year, DOI, Permanent identifier, Publication type, Journal, Project Name, GA number, 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>,</xsl:text>
25

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

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

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

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

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

    
72
                    <!-- journal -->
73
                    <xsl:text>&quot;</xsl:text>
74
                        <xsl:for-each select="../field[@name='source']">
75
                            <xsl:value-of select="@value"/>
76
                        </xsl:for-each>
77
                    <xsl:text>&quot;</xsl:text>
78
                    <xsl:text>,</xsl:text>
79

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

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

    
103
                    <xsl:text>&quot;</xsl:text>
104
                    <xsl:text>,</xsl:text>
105

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

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

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

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

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

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

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

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

    
168
            <!-- Funder -->
169
            <xsl:text>&quot;</xsl:text>
170
            <xsl:text>&quot;</xsl:text>
171
            <xsl:text>,</xsl:text>
172

    
173
            <!-- project name -->
174
            <xsl:text>&quot;</xsl:text>
175
            <!-- project name -->
176
            <xsl:text>&quot;</xsl:text>
177
            <xsl:text>,</xsl:text>
178

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

    
187
    </xsl:template>
188

    
189
</xsl:stylesheet>
(7-7/40)