/usr/share/kde4/apps/kbibtex/arxiv2bibtex.xsl is in kbibtex 0.4-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | <xsl:stylesheet version = '1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xmlns:arxiv="http://arxiv.org/schemas/atom">
<!--
- This Extensible Stylesheet Language Transformation file translates XML files
- as provided by arXiv into BibTeX files.
-
- This file was written by Thomas Fischer <fischer@unix-ag.uni-kl.de>
- It is released under the GNU Public License version 2 or later.
-
- To run test this transformation file, run e.g.
- wget 'http://export.arxiv.org/api/query?search_query=all:gandalf+lechner' -O - | sed -e 's/xmlns="http:\/\/www.w3.org\/2005\/Atom"//' | xsltproc arxiv2bibtex.xsl -
- Within KBibTeX, some post-processing on the resulting BibTeX file is done.
-->
<xsl:output method="text" omit-xml-declaration="yes" indent="no" encoding="UTF-8"/>
<xsl:strip-space elements="*"/>
<!-- START HERE -->
<xsl:template match="/">
<!-- process each entry -->
<xsl:apply-templates select="feed/entry" />
</xsl:template>
<xsl:template match="entry">
<!-- Test if entry is a journal article (@article), otherwise @misc -->
<xsl:choose>
<xsl:when test="arxiv:journal_ref">
<xsl:text>@article</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>@misc</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:text>{</xsl:text><xsl:value-of select='substring(id,22,100)' />
<!-- process authors by merging all names with "and" -->
<xsl:text>,
author = {</xsl:text>
<xsl:for-each select="author/name" >
<xsl:if test="position() > 1"><xsl:text> and </xsl:text></xsl:if>
<xsl:value-of select="."/>
</xsl:for-each>
<xsl:text>}</xsl:text>
<xsl:apply-templates select="title" />
<xsl:apply-templates select="updated" />
<xsl:apply-templates select="summary" />
<xsl:apply-templates select="link" />
<xsl:apply-templates select="arxiv:doi" />
<xsl:apply-templates select="arxiv:journal_ref" />
<xsl:text>,
archivePrefix = {arXiv},
eprint = {</xsl:text>
<xsl:value-of select='substring(id,22,100)' />
<xsl:text>},
primaryClass = {</xsl:text>
<xsl:value-of select="arxiv:primary_category/@term" />
<xsl:text>},
comment = {published = </xsl:text>
<xsl:value-of select="published" />
<xsl:if test="updated">
<xsl:text>, updated = </xsl:text>
<xsl:value-of select="updated" />
</xsl:if>
<xsl:if test="arxiv:comment">
<xsl:text>, </xsl:text>
<xsl:value-of select="arxiv:comment" />
</xsl:if>
<xsl:text>}
}
</xsl:text>
</xsl:template>
<xsl:template match="title">
<xsl:text>,
title = {{</xsl:text><xsl:value-of select="." /><xsl:text>}}</xsl:text>
</xsl:template>
<xsl:template match="updated">
<xsl:text>,
year = {</xsl:text><xsl:value-of select="substring(.,1,4)" /><xsl:text>},
month = </xsl:text>
<xsl:choose>
<xsl:when test="substring(.,6,2) = '01'"><xsl:text>jan</xsl:text></xsl:when>
<xsl:when test="substring(.,6,2) = '02'"><xsl:text>feb</xsl:text></xsl:when>
<xsl:when test="substring(.,6,2) = '03'"><xsl:text>mar</xsl:text></xsl:when>
<xsl:when test="substring(.,6,2) = '04'"><xsl:text>apr</xsl:text></xsl:when>
<xsl:when test="substring(.,6,2) = '05'"><xsl:text>may</xsl:text></xsl:when>
<xsl:when test="substring(.,6,2) = '06'"><xsl:text>jun</xsl:text></xsl:when>
<xsl:when test="substring(.,6,2) = '07'"><xsl:text>jul</xsl:text></xsl:when>
<xsl:when test="substring(.,6,2) = '08'"><xsl:text>aug</xsl:text></xsl:when>
<xsl:when test="substring(.,6,2) = '09'"><xsl:text>sep</xsl:text></xsl:when>
<xsl:when test="substring(.,6,2) = '10'"><xsl:text>oct</xsl:text></xsl:when>
<xsl:when test="substring(.,6,2) = '11'"><xsl:text>nov</xsl:text></xsl:when>
<xsl:when test="substring(.,6,2) = '12'"><xsl:text>dec</xsl:text></xsl:when>
<xsl:otherwise>{}</xsl:otherwise></xsl:choose>
</xsl:template>
<xsl:template match="summary">
<xsl:text>,
abstract = {</xsl:text><xsl:value-of select="." /><xsl:text>}</xsl:text>
</xsl:template>
<xsl:template match="link"><xsl:choose>
<xsl:when test="@title = 'doi'">
<!-- ignore for now -->
</xsl:when>
<xsl:otherwise>
<!-- FIXME handle multiple URLs -->
<xsl:text>,
url = {</xsl:text><xsl:value-of select="@href" /><xsl:text>}</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="arxiv:doi">
<xsl:text>,
doi = {</xsl:text><xsl:value-of select="." /><xsl:text>}</xsl:text>
</xsl:template>
<xsl:template match="arxiv:journal_ref">
<!-- FIXME split journal_ref into journal name, volume, issue, year, ... -->
<xsl:text>,
journal = {</xsl:text><xsl:value-of select="." /><xsl:text>}</xsl:text>
</xsl:template>
</xsl:stylesheet>
|