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,Download From,Publication type,Journal,Funder,Project Name (GA Number),Access
</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>"</xsl:text>
|
22
|
<xsl:value-of select="../field[@name='title']/@value"/>
|
23
|
<xsl:text>"</xsl:text>
|
24
|
<xsl:text>,</xsl:text>
|
25
|
|
26
|
<!-- authors -->
|
27
|
<xsl:text>"</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>"</xsl:text>
|
36
|
<xsl:text>,</xsl:text>
|
37
|
|
38
|
<!-- description
|
39
|
<xsl:text>"</xsl:text>
|
40
|
<xsl:value-of select="field[@name='description']/@value"/>
|
41
|
<xsl:if test="position() != last()"><xsl:text> </xsl:text></xsl:if>
|
42
|
<xsl:text>"</xsl:text>
|
43
|
<xsl:text>,</xsl:text>
|
44
|
-->
|
45
|
<!-- year -->
|
46
|
<xsl:text>"</xsl:text>
|
47
|
<xsl:value-of select="../field[@name='dateofacceptance']/@value"/>
|
48
|
<xsl:text>"</xsl:text>
|
49
|
<xsl:text>,</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>"</xsl:text>
|
55
|
<xsl:value-of select="field[@name='value']/@value"/>
|
56
|
<xsl:text>"</xsl:text>
|
57
|
</xsl:if>
|
58
|
</xsl:for-each>
|
59
|
<xsl:text>,</xsl:text>
|
60
|
|
61
|
<!-- Download From -->
|
62
|
<xsl:text>"</xsl:text>
|
63
|
<xsl:value-of select="../field[@name='datasource'][1]/field[@name='url']/@value"/>
|
64
|
<xsl:text>"</xsl:text>
|
65
|
<xsl:text>,</xsl:text>
|
66
|
|
67
|
<!-- Publication type -->
|
68
|
<xsl:text>"</xsl:text>
|
69
|
<xsl:value-of select="../field[@name='datasource'][1]/field[@name='typename']/@value"/>
|
70
|
<xsl:text>"</xsl:text>
|
71
|
<xsl:text>,</xsl:text>
|
72
|
|
73
|
<!-- journal -->
|
74
|
<xsl:text>"</xsl:text>
|
75
|
<xsl:for-each select="../field[@name='source']">
|
76
|
<xsl:value-of select="replace(@value, '</?\w+[^<]*>', '')"/>
|
77
|
</xsl:for-each>
|
78
|
<xsl:text>"</xsl:text>
|
79
|
<xsl:text>,</xsl:text>
|
80
|
|
81
|
<!-- Funder -->
|
82
|
<xsl:text>"</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>"</xsl:text>
|
87
|
<xsl:text>,</xsl:text>
|
88
|
|
89
|
<!-- project name -->
|
90
|
<xsl:text>"</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>"</xsl:text>
|
105
|
<xsl:text>,</xsl:text>
|
106
|
|
107
|
<!--access -->
|
108
|
<xsl:text>"</xsl:text>
|
109
|
<xsl:value-of select="../field[@name='bestaccessright']/@value"/>
|
110
|
<xsl:text>"</xsl:text>
|
111
|
<xsl:text>
</xsl:text>
|
112
|
|
113
|
</xsl:for-each>
|
114
|
</xsl:when>
|
115
|
<xsl:otherwise>
|
116
|
<!-- title -->
|
117
|
<xsl:text>"</xsl:text>
|
118
|
<xsl:value-of select="field[@name='title']/@value"/>
|
119
|
<xsl:text>"</xsl:text>
|
120
|
<xsl:text>,</xsl:text>
|
121
|
|
122
|
<!-- authors -->
|
123
|
<xsl:text>"</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>"</xsl:text>
|
131
|
<xsl:text>,</xsl:text>
|
132
|
|
133
|
<!-- year -->
|
134
|
<xsl:text>"</xsl:text>
|
135
|
<xsl:value-of select="field[@name='dateofacceptance']/@value"/>
|
136
|
<xsl:text>"</xsl:text>
|
137
|
<xsl:text>,</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>"</xsl:text>
|
143
|
<xsl:value-of select="field[@name='value']/@value"/>
|
144
|
<xsl:text>"</xsl:text>
|
145
|
</xsl:if>
|
146
|
</xsl:for-each>
|
147
|
<xsl:text>,</xsl:text>
|
148
|
|
149
|
<!-- Permanent Identifier -->
|
150
|
<xsl:text>"</xsl:text>
|
151
|
<xsl:value-of select="field[@name='datasource'][1]/field[@name='url']/@value"/>
|
152
|
<xsl:text>"</xsl:text>
|
153
|
<xsl:text>,</xsl:text>
|
154
|
|
155
|
<!-- Publication type -->
|
156
|
<xsl:text>"</xsl:text>
|
157
|
<xsl:value-of select="field[@name='datasource'][1]/field[@name='typename']/@value"/>
|
158
|
<xsl:text>"</xsl:text>
|
159
|
<xsl:text>,</xsl:text>
|
160
|
|
161
|
<!-- journal -->
|
162
|
<xsl:text>"</xsl:text>
|
163
|
<xsl:for-each select="field[@name='source']">
|
164
|
<xsl:value-of select="@value"/>
|
165
|
</xsl:for-each>
|
166
|
<xsl:text>"</xsl:text>
|
167
|
<xsl:text>,</xsl:text>
|
168
|
|
169
|
<!-- Funder -->
|
170
|
<xsl:text>"</xsl:text>
|
171
|
<xsl:text>"</xsl:text>
|
172
|
<xsl:text>,</xsl:text>
|
173
|
|
174
|
<!-- project name -->
|
175
|
<xsl:text>"</xsl:text>
|
176
|
<!-- project name -->
|
177
|
<xsl:text>"</xsl:text>
|
178
|
<xsl:text>,</xsl:text>
|
179
|
|
180
|
<!--access -->
|
181
|
<xsl:text>"</xsl:text>
|
182
|
<xsl:value-of select="../field[@name='bestaccessright']/@value"/>
|
183
|
<xsl:text>"</xsl:text>
|
184
|
<xsl:text>
</xsl:text>
|
185
|
</xsl:otherwise>
|
186
|
</xsl:choose>
|
187
|
|
188
|
</xsl:template>
|
189
|
|
190
|
</xsl:stylesheet>
|