My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes  
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
<?xml version='1.0' encoding="ISO-8859-1"?>
<xsl:stylesheet
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
version='1.0'
>
<xsl:param name="layout">ref</xsl:param>
<!--

This stylesheet transforms one or more Pubmed
Article in xml format into a set of citations for wikipedia

Author: Pierre Lindenbaum PhD plindenbaum@yahoo.fr

see: http://en.wikipedia.org/wiki/Template:Citation

-->
<xsl:output method='text' encoding="UTF-8"/>


<xsl:template match="/">
&lt;!--
Generated with pubmed2wiki.xsl
Author: Pierre Lindenbaum PhD.
plindenbaum@yahoo.fr
http://en.wikipedia.org/wiki/User:Plindenbaum
--&gt;
<xsl:text>



</xsl:text>
<xsl:apply-templates/>
</xsl:template>

<xsl:template match="PubmedArticleSet">
<xsl:if test="$layout!='ref'"><xsl:text>

&lt;div class=&apos;references-small&apos;&gt;


</xsl:text></xsl:if>
<xsl:apply-templates select="PubmedArticle"/>
<xsl:if test="$layout!='ref'"><xsl:text>

&lt;/div&gt;
</xsl:text></xsl:if>
</xsl:template>



<xsl:template match="PubmedArticle"><xsl:choose><xsl:when test="$layout='ref'">&lt;ref&gt;</xsl:when><xsl:otherwise>*</xsl:otherwise></xsl:choose>{{cite journal
| quotes = yes
<xsl:apply-templates select=".//AuthorList"/>
<xsl:apply-templates select=".//PubDate"/>
<xsl:apply-templates select="MedlineCitation/Article/ArticleTitle"/>
<xsl:apply-templates select=".//ISOAbbreviation"/>
<xsl:if test="not(.//ISOAbbreviation)"><xsl:call-template name="periodical">
<xsl:with-param name="J" select="MedlineCitation/Article/Journal/Title"/>
</xsl:call-template></xsl:if>
<xsl:apply-templates select=".//JournalIssue"/>
<xsl:apply-templates select=".//Pagination"/>
|publisher= |location = <xsl:variable name="country" select="MedlineCitation/MedlineJournalInfo/Country"/><xsl:choose>
<xsl:when test="$country='UNITED STATES'">[[United States]]</xsl:when>
<xsl:when test="$country='ENGLAND'">[[United Kingdom]]</xsl:when>
<xsl:when test="$country='ITALY'">[[Italy]]</xsl:when>
<xsl:when test="$country='FRANCE'">[[France]]</xsl:when>
<xsl:when test="$country='Not Available'"></xsl:when>
<xsl:otherwise>[[<xsl:value-of select="$country"/>]]</xsl:otherwise>
</xsl:choose>| issn = <xsl:value-of select="MedlineCitation/Article/Journal/ISSN[@IssnType=&apos;Print&apos;]"/>
<xsl:apply-templates select=".//PMID"/>
<xsl:apply-templates select=".//ArticleId[@IdType=&apos;doi&apos;]"/>
| bibcode = | oclc =| id = | url = | <xsl:if test="PubmedData/ArticleIdList/ArticleId/@IdType='doi'"><xsl:value-of select="concat('doi = ',PubmedData/ArticleIdList/ArticleId[@IdType='doi'],' |')"/></xsl:if><xsl:if test="PubmedData/ArticleIdList/ArticleId/@IdType='pmc'"><xsl:value-of select="concat('pmc = ',PubmedData/ArticleIdList/ArticleId[@IdType='pmc'],' |')"/></xsl:if> language = <xsl:variable name="lang" select="MedlineCitation/Article/Language"/><xsl:choose><xsl:when test="$lang='' or $lang='en' or $lang='eng'"></xsl:when><xsl:when test="$lang='fr'">French</xsl:when><xsl:when test="$lang='it'">Italian</xsl:when><xsl:otherwise><xsl:value-of select="$lang"/></xsl:otherwise></xsl:choose>| format = | accessdate = | laysummary = | laysource = | laydate = | quote =
}}<xsl:choose><xsl:when test="$layout='ref'">&lt;/ref&gt;</xsl:when><xsl:otherwise><xsl:text>
</xsl:text></xsl:otherwise></xsl:choose></xsl:template>








<xsl:template match="PMID">| pmid = <xsl:value-of select="."/>
</xsl:template>

<xsl:template match="ArticleId[@IdType=&apos;doi&apos;]">
|doi = <xsl:value-of select="."/>
</xsl:template>

<xsl:template match="AuthorList">
<xsl:if test="count(Author)&gt;0">|last=<xsl:value-of select="Author[1]/LastName"/>
|first=<xsl:value-of select="Author[1]/ForeName"/>
|authorlink=</xsl:if>
<xsl:if test="count(Author)&gt;1">
|coauthors=<xsl:for-each select="Author">
<xsl:if test="position()&gt;1">
<xsl:value-of select="LastName"/><xsl:text> </xsl:text><xsl:value-of select="ForeName"/>
<xsl:if test="position()!=last()"><xsl:text>, </xsl:text></xsl:if>
</xsl:if>
</xsl:for-each>
</xsl:if>
</xsl:template>

<xsl:template match="PubDate">
|year=<xsl:if test="Year">[[<xsl:value-of select="Year"/>]]</xsl:if>|month=<xsl:if test="Month"><xsl:value-of select="Month"/>.</xsl:if>
</xsl:template>


<xsl:template match="ArticleTitle">
|title=<xsl:choose>
<xsl:when test="substring(.,string-length(.))='.'">
<xsl:value-of select="substring(.,1,string-length(.)-1)"/></xsl:when>
<xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
</xsl:choose></xsl:template>

<xsl:template match="ISOAbbreviation"><xsl:call-template name="periodical">
<xsl:with-param name="J" select="."/>
</xsl:call-template>
</xsl:template>

<xsl:template name="periodical">
<xsl:param name="J"/>
|journal=<xsl:choose>
<xsl:when test="$J='JAMA'">[[Journal of the American Medical Association|JAMA]]</xsl:when>
<xsl:when test="$J='Science'">[[Science (journal)|Science]]</xsl:when>
<xsl:when test="$J='Nature'">[[Nature (journal)|Nature]]</xsl:when>
<xsl:when test="$J='Endocrinology'">[[Endocrinology (journal)|Endocrinology]]</xsl:when>
<xsl:when test="$J='Genetics'">[[Genetics (journal)|Genetics]]</xsl:when>
<xsl:when test="$J='Lancet'">[[The_Lancet|Lancet]]</xsl:when>
<xsl:when test="$J='Journal of medical biography'">[[Journal of Medical Biography]]</xsl:when>
<xsl:when test="$J='Proc. Natl. Acad. Sci. U.S.A.'">[[PNAS|Proc. Natl. Acad. Sci. U.S.A.]]</xsl:when>
<xsl:when test="$J='Journal of the Royal Society of Medicine'">[[Journal of the Royal Society of Medicine]]</xsl:when>
<xsl:otherwise>[[<xsl:value-of select="$J"/>]]</xsl:otherwise>
</xsl:choose>
</xsl:template>



<xsl:template match="JournalIssue">
|volume=<xsl:value-of select="Volume"/>
|issue=<xsl:value-of select="Issue"/>
</xsl:template>


<xsl:template match="Pagination">
|pages=<xsl:value-of select="MedlinePgn"/>
</xsl:template>


</xsl:stylesheet>

Change log

r371 by plindenbaum on Oct 18, 2009   Diff
mv tinytools to mwtools
Go to: 
Project members, sign in to write a code review

Older revisions

r362 by plindenbaum on Sep 17, 2009   Diff
berkeley
r346 by plindenbaum on Jul 16, 2009   Diff
cont
r107 by plindenbaum on Jul 14, 2008   Diff
continue scifoaf.
pubmed2wiki updated
All revisions of this file

File info

Size: 5770 bytes, 150 lines
Powered by Google Project Hosting