/usr/share/kbibtex/pubmed2bibtex.xsl is in kbibtex-data 0.8~20170819git31a77b27e8e83836e-3build2.
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 | <xsl:stylesheet version='2.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<!--
- This Extensible Stylesheet Language Transformation file translates XML files
- as provided by PubMed 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.
-->
<xsl:output method="text" omit-xml-declaration="yes" indent="no" encoding="UTF-8"/>
<xsl:strip-space elements="*"/>
<xsl:variable name="smallcase" select="'abcdefghijklmnopqrstuvwxyz'" />
<xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
<!-- START HERE -->
<xsl:template match="/">
<!-- process each entry -->
<xsl:apply-templates select="PubmedArticleSet/PubmedArticle" />
</xsl:template>
<xsl:template match="PubmedArticle">
<!-- assuming that there are only journal references -->
<xsl:text>@article{pmid</xsl:text>
<xsl:value-of select="MedlineCitation/PMID" />
<xsl:apply-templates select="MedlineCitation/Article" />
<xsl:apply-templates select="PubmedData/ArticleIdList/ArticleId" />
<xsl:if test="MedlineCitation/MedlineJournalInfo/NlmUniqueID!=''"><xsl:text>,
nlmuniqueid = {</xsl:text><xsl:value-of select="MedlineCitation/MedlineJournalInfo/NlmUniqueID" /><xsl:text>}</xsl:text></xsl:if>
<xsl:text>
}
</xsl:text>
</xsl:template>
<xsl:template match="ArticleId">
<xsl:choose>
<xsl:when test="@IdType='doi'">
<xsl:text>,
doi = {</xsl:text><xsl:value-of select="." /><xsl:text>}</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>,
</xsl:text><xsl:value-of select="@IdType" /><xsl:text> = {</xsl:text><xsl:value-of select="." /><xsl:text>}</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="Article">
<xsl:text>,
title = {{</xsl:text><xsl:value-of select="ArticleTitle" /><xsl:text>}}</xsl:text>
<xsl:apply-templates select="AuthorList" />
<xsl:apply-templates select="Journal" />
<xsl:text>,
pages = {</xsl:text><xsl:value-of select="Pagination/MedlinePgn" /><xsl:text>}</xsl:text>
<xsl:if test="Abstract/AbstractText!=''"><xsl:text>,
abstract = {</xsl:text><xsl:value-of select="Abstract/AbstractText" /><xsl:text>}</xsl:text></xsl:if>
</xsl:template>
<xsl:template match="Journal">
<!-- going for the journal title's abbreviation, looks better -->
<xsl:text>,
journal = {{</xsl:text><xsl:value-of select="ISOAbbreviation" /><xsl:text>}}</xsl:text>
<xsl:if test="JournalIssue/ISSN!=''"><xsl:text>,
issn = {</xsl:text><xsl:value-of select="ISSN" /><xsl:text>}</xsl:text></xsl:if>
<xsl:if test="JournalIssue/Volume!=''"><xsl:text>,
volume = {</xsl:text><xsl:value-of select="JournalIssue/Volume" /><xsl:text>}</xsl:text></xsl:if>
<xsl:if test="JournalIssue/Issue!=''"><xsl:text>,
number = {</xsl:text><xsl:value-of select="JournalIssue/Issue" /><xsl:text>}</xsl:text></xsl:if>
<xsl:if test="JournalIssue/PubDate/Year!=''"><xsl:text>,
year = {</xsl:text><xsl:value-of select="JournalIssue/PubDate/Year" /><xsl:text>}</xsl:text></xsl:if>
<xsl:if test="JournalIssue/PubDate/Month!=''"><xsl:text>,
month = </xsl:text><xsl:value-of select="translate(JournalIssue/PubDate/Month, $uppercase, $smallcase)" /><xsl:text></xsl:text></xsl:if>
</xsl:template>
<xsl:template match="AuthorList">
<xsl:text>,
author = {</xsl:text>
<xsl:apply-templates select="Author"/>
<xsl:if test="@CompleteYN = 'N'"><xsl:text> and others</xsl:text></xsl:if>
<xsl:text>}</xsl:text>
</xsl:template>
<xsl:template match="Author">
<xsl:if test="position() > 1"><xsl:text> and </xsl:text></xsl:if>
<xsl:apply-templates select="ForeName"/><xsl:text> </xsl:text>
<xsl:apply-templates select="LastName"/>
</xsl:template>
</xsl:stylesheet>
|