summaryrefslogtreecommitdiffstats
path: root/xslt/arxiv2tellico.xsl
blob: 8028e6ce22f25994652ea1d85c8802e613e2eaf2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns="http://periapsis.org/tellico/"
                xmlns:atom="http://www.w3.org/2005/Atom"
                xmlns:arxiv="http://arxiv.org/schemas/atom"
                xmlns:str="http://exslt.org/strings"
                xmlns:exsl="http://exslt.org/common"
                xmlns:c="uri:category"
                exclude-result-prefixes="atom arxiv"
                extension-element-prefixes="str exsl"
                version="1.0">

<!--
   ===================================================================
   Tellico XSLT file - used for importing data from crossref.org

   See http://www.crossref.org/schema/queryResultSchema/crossref_query_output2.0.7.xsd

   Copyright (C) 2007 Robby Stephenson - robby@periapsis.org

   This XSLT stylesheet is designed to be used with the 'Tellico'
   application, which can be found at http://www.periapsis.org/tellico/

   ===================================================================
-->

<!-- lookup table for categories -->
<c:categories>
  <c:category id="astro-ph">Astrophysics</c:category>
  <c:category id="cond-mat">Condensed Matter</c:category>
  <c:category id="cond-mat.dis-nn">Disordered Systems and Neural Networks</c:category>
  <c:category id="cond-mat.mtrl-sci">Materials Science</c:category>
  <c:category id="cond-mat.mes-hall">Mesoscopic Systems and Quantum Hall Effect</c:category>
  <c:category id="cond-mat.other">Other</c:category>
  <c:category id="cond-mat.soft">Soft Condensed Matter</c:category>
  <c:category id="cond-mat.stat-mech">Statistical Mechanics</c:category>
  <c:category id="cond-mat.str-el">Strongly Correlated Electrons</c:category>
  <c:category id="cond-mat.supr-con">Superconductivity</c:category>
  <c:category id="gr-qc">General Relativity and Quantum Cosmology</c:category>
  <c:category id="hep-ex">High Energy Physics - Experiment</c:category>
  <c:category id="hep-lat">High Energy Physics - Lattice</c:category>
  <c:category id="hep-ph">High Energy Physics - Phenomenology</c:category>
  <c:category id="hep-th">High Energy Physics - Theory</c:category>
  <c:category id="math-ph">Mathematical Physics</c:category>
  <c:category id="nucl-ex">Nuclear Experiment</c:category>
  <c:category id="nucl-th">Nuclear Theory</c:category>
  <c:category id="physics">Physics</c:category>
  <c:category id="physics.acc-ph">Accelerator Physics</c:category>
  <c:category id="physics.ao-ph">Atmospheric and Oceanic Physics</c:category>
  <c:category id="physics.atom-ph">Atomic Physics</c:category>
  <c:category id="physics.atm-clus">Atomic and Molecular Clusters</c:category>
  <c:category id="physics.bio-ph">Biological Physics</c:category>
  <c:category id="physics.chem-ph">Chemical Physics</c:category>
  <c:category id="physics.class-ph">Classical Physics</c:category>
  <c:category id="physics.comp-ph">Computational Physics</c:category>
  <c:category id="physics.data-an">Data Analysis, Statistics and Probability</c:category>
  <c:category id="physics.flu-dyn">Fluid Dynamics</c:category>
  <c:category id="physics.gen-ph">General Physics</c:category>
  <c:category id="physics.geo-ph">Geophysics</c:category>
  <c:category id="physics.hist-ph">History of Physics</c:category>
  <c:category id="physics.ins-det">Instrumentation and Detectors</c:category>
  <c:category id="physics.med-ph">Medical Physics</c:category>
  <c:category id="physics.optics">Optics</c:category>
  <c:category id="physics.ed-ph">Physics Education</c:category>
  <c:category id="physics.soc-ph">Physics and Society</c:category>
  <c:category id="physics.plasm-ph">Plasma Physics</c:category>
  <c:category id="physics.pop-ph">Popular Physics</c:category>
  <c:category id="physics.space-ph">Space Physics</c:category>
  <c:category id="quant-ph">Quantum Physics</c:category>
  <c:category id="math">Mathematics</c:category>
  <c:category id="math.AG">Algebraic Geometry</c:category>
  <c:category id="math.AT">Algebraic Topology</c:category>
  <c:category id="math.AP">Analysis of PDEs</c:category>
  <c:category id="math.CT">Category Theory</c:category>
  <c:category id="math.CA">Classical Analysis and ODEs</c:category>
  <c:category id="math.CO">Combinatorics</c:category>
  <c:category id="math.AC">Commutative Algebra</c:category>
  <c:category id="math.CV">Complex Variables</c:category>
  <c:category id="math.DG">Differential Geometry</c:category>
  <c:category id="math.DS">Dynamical Systems</c:category>
  <c:category id="math.FA">Functional Analysis</c:category>
  <c:category id="math.GM">General Mathematics</c:category>
  <c:category id="math.GN">General Topology</c:category>
  <c:category id="math.GT">Geometric Topology</c:category>
  <c:category id="math.GR">Group Theory</c:category>
  <c:category id="math.HO">History and Overview</c:category>
  <c:category id="math.IT">Information Theory</c:category>
  <c:category id="math.KT">K-Theory and Homology</c:category>
  <c:category id="math.LO">Logic</c:category>
  <c:category id="math.MP">Mathematical Physics</c:category>
  <c:category id="math.MG">Metric Geometry</c:category>
  <c:category id="math.NT">Number Theory</c:category>
  <c:category id="math.NA">Numerical Analysis</c:category>
  <c:category id="math.OA">Operator Algebras</c:category>
  <c:category id="math.OC">Optimization and Control</c:category>
  <c:category id="math.PR">Probability</c:category>
  <c:category id="math.QA">Quantum Algebra</c:category>
  <c:category id="math.RT">Representation Theory</c:category>
  <c:category id="math.RA">Rings and Algebras</c:category>
  <c:category id="math.SP">Spectral Theory</c:category>
  <c:category id="math.ST">Statistics</c:category>
  <c:category id="math.SG">Symplectic Geometry</c:category>
  <c:category id="nlin">Nonlinear Sciences</c:category>
  <c:category id="nlin.AO">Adaptation and Self-Organizing Systems</c:category>
  <c:category id="nlin.CG">Cellular Automata and Lattice Gases</c:category>
  <c:category id="nlin.CD">Chaotic Dynamics</c:category>
  <c:category id="nlin.SI">Exactly Solvable and Integrable Systems</c:category>
  <c:category id="nlin.PS">Pattern Formation and Solitons</c:category>
  <c:category id="cs.AR">Architecture</c:category>
  <c:category id="cs.AI">Artificial Intelligence</c:category>
  <c:category id="cs.CL">Computation and Language</c:category>
  <c:category id="cs.CC">Computational Complexity</c:category>
  <c:category id="cs.CE">Computational Engineering, Finance, and Science</c:category>
  <c:category id="cs.CG">Computational Geometry</c:category>
  <c:category id="cs.GT">Computer Science and Game Theory</c:category>
  <c:category id="cs.CV">Computer Vision and Pattern Recognition</c:category>
  <c:category id="cs.CY">Computers and Society</c:category>
  <c:category id="cs.CR">Cryptography and Security</c:category>
  <c:category id="cs.DS">Data Structures and Algorithms</c:category>
  <c:category id="cs.DB">Databases</c:category>
  <c:category id="cs.DL">Digital Libraries</c:category>
  <c:category id="cs.DM">Discrete Mathematics</c:category>
  <c:category id="cs.DC">Distributed, Parallel, and Cluster Computing</c:category>
  <c:category id="cs.GL">General Literature</c:category>
  <c:category id="cs.GR">Graphics</c:category>
  <c:category id="cs.HC">Human-Computer Interaction</c:category>
  <c:category id="cs.IR">Information Retrieval</c:category>
  <c:category id="cs.IT">Information Theory</c:category>
  <c:category id="cs.LG">Learning</c:category>
  <c:category id="cs.LO">Logic in Computer Science</c:category>
  <c:category id="cs.MS">Mathematical Software</c:category>
  <c:category id="cs.MA">Multiagent Systems</c:category>
  <c:category id="cs.MM">Multimedia</c:category>
  <c:category id="cs.NI">Networking and Internet Architecture</c:category>
  <c:category id="cs.NE">Neural and Evolutionary Computing</c:category>
  <c:category id="cs.NA">Numerical Analysis</c:category>
  <c:category id="cs.OS">Operating Systems</c:category>
  <c:category id="cs.OH">Other</c:category>
  <c:category id="cs.PF">Performance</c:category>
  <c:category id="cs.PL">Programming Languages</c:category>
  <c:category id="cs.RO">Robotics</c:category>
  <c:category id="cs.SE">Software Engineering</c:category>
  <c:category id="cs.SD">Sound</c:category>
  <c:category id="cs.SC">Symbolic Computation</c:category>
  <c:category id="q-bio">Quantitative Biology</c:category>
  <c:category id="q-bio.BM">Biomolecules</c:category>
  <c:category id="q-bio.CB">Cell Behavior</c:category>
  <c:category id="q-bio.GN">Genomics</c:category>
  <c:category id="q-bio.MN">Molecular Networks</c:category>
  <c:category id="q-bio.NC">Neurons and Cognition</c:category>
  <c:category id="q-bio.OT">Other</c:category>
  <c:category id="q-bio.PE">Populations and Evolution</c:category>
  <c:category id="q-bio.QM">Quantitative Methods</c:category>
  <c:category id="q-bio.SC">Subcellular Processes</c:category>
  <c:category id="q-bio.TO">Tissues and Organs</c:category>
  <c:category id="stat">Statistics</c:category>
  <c:category id="stat.AP">Applications</c:category>
  <c:category id="stat.CO">Computation</c:category>
  <c:category id="stat.ML">Machine Learning</c:category>
  <c:category id="stat.ME">Methodology</c:category>
  <c:category id="stat.TH">Theory</c:category>
</c:categories>
<xsl:key name="categories" match="c:category" use="@id"/>
<xsl:variable name="categories-top" select="document('')/*/c:categories"/>

<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"
            doctype-public="-//Robby Stephenson/DTD Tellico V10.0//EN"
            doctype-system="http://periapsis.org/tellico/dtd/v10/tellico.dtd"/>

<xsl:template match="/">
 <tellico syntaxVersion="10">
  <collection title="Arxiv Search" type="5">
   <fields>
    <field name="_default"/>
     <field flags="0" title="arXiv ID" category="Publishing" format="4" type="1" name="arxiv" description="arXiv ID"/>
   </fields>
   <xsl:apply-templates select="atom:feed/atom:entry"/>
  </collection>
 </tellico>
</xsl:template>

<xsl:template match="atom:entry">
 <entry>

  <title>
   <xsl:value-of select="normalize-space(atom:title)"/>
  </title>

  <entry-type>
   <xsl:text>article</xsl:text>
  </entry-type>

  <authors>
   <xsl:for-each select="atom:author">
    <author>
     <xsl:value-of select="normalize-space(atom:name)"/>
    </author>
   </xsl:for-each>
  </authors>

  <abstract>
   <xsl:value-of select="normalize-space(atom:summary)"/>
  </abstract>

  <note>
   <xsl:value-of select="normalize-space(arxiv:comment)"/>
  </note>

  <keywords>
   <xsl:for-each select="atom:category">
    <keyword>
     <xsl:apply-templates select="$categories-top">
      <xsl:with-param name="cat" select="@term"/>
     </xsl:apply-templates>
    </keyword>
   </xsl:for-each>
  </keywords>

  <url>
   <xsl:choose>
    <xsl:when test="atom:link[@title='pdf']">
     <xsl:value-of select="atom:link[@title='pdf']/@href"/>
    </xsl:when>
    <xsl:otherwise>
     <xsl:value-of select="atom:link[1]/@href"/>
    </xsl:otherwise>
   </xsl:choose>
  </url>

  <doi>
   <xsl:value-of select="arxiv:doi"/>
  </doi>

  <xsl:call-template name="journal_ref">
   <xsl:with-param name="value" select="arxiv:journal_ref"/>
  </xsl:call-template>

  <arxiv>
   <!-- remove http://arxiv.org/abs/ from beginning -->
   <xsl:value-of select="substring(atom:id, string-length('http://arxiv.org/abs/')+1)"/>
  </arxiv>

 </entry>

</xsl:template>

<xsl:template name="journal_ref">
 <xsl:param name="value"/>

 <journal>
  <xsl:value-of select="substring-before($value, '(')"/>
 </journal>

 <xsl:variable name="after1" select="substring-after($value, '(')"/>
 <xsl:variable name="year" select="substring-before($after1, ')')"/>
 <year>
  <xsl:value-of select="normalize-space($year)"/>
 </year>

 <xsl:variable name="after2" select="substring-after($after1, ')')"/>
 <pages>
  <xsl:value-of select="normalize-space($after2)"/>
 </pages>
</xsl:template>

<xsl:template match="c:categories">
 <xsl:param name="cat"/>
 <xsl:variable name="c" select="key('categories', $cat)"/>
 <xsl:if test="$c">
  <xsl:value-of select="$c"/>
 </xsl:if>
 <xsl:if test="not($c)">
  <xsl:value-of select="$cat"/>
 </xsl:if>
</xsl:template>

</xsl:stylesheet>