Accept attributes in inline image syntax
[multimarkdown] / XSLT / natbib-support.xslt
1 <?xml version='1.0' encoding='utf-8'?>
2
3 <!-- XHTML-to-Article converter by Fletcher Penney
4         specifically designed for use with MultiMarkdown created XHTML
5         
6         Adds support for natbib citations.
7         
8         Requires that the following command (or equivalent) be included
9         in the header:
10         
11                 \usepackage[round]{natbib}
12         
13         
14         MultiMarkdown Version 2.0.b5
15         
16         $Id: natbib-support.xslt 479 2008-01-12 23:04:13Z fletcher $
17 -->
18
19 <!-- 
20 # Copyright (C) 2005-2008  Fletcher T. Penney <fletcher@fletcherpenney.net>
21 #
22 # This program is free software; you can redistribute it and/or modify
23 # it under the terms of the GNU General Public License as published by
24 # the Free Software Foundation; either version 2 of the License, or
25 # (at your option) any later version.
26 #
27 # This program is distributed in the hope that it will be useful,
28 # but WITHOUT ANY WARRANTY; without even the implied warranty of
29 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
30 # GNU General Public License for more details.
31 #
32 # You should have received a copy of the GNU General Public License
33 # along with this program; if not, write to the
34 #    Free Software Foundation, Inc.
35 #    59 Temple Place, Suite 330
36 #    Boston, MA 02111-1307 USA
37 -->
38
39         
40 <xsl:stylesheet
41         xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
42         xmlns:html="http://www.w3.org/1999/xhtml"
43         version="1.0">
44
45         <xsl:import href="xhtml2latex.xslt"/>
46         
47         <xsl:output method='text' encoding='utf-8'/>
48
49         <xsl:strip-space elements="*" />
50
51         <!-- use \citep by default -->
52         <xsl:template match="html:span[@class='externalcitation']">
53                 <xsl:text>\citep</xsl:text>
54                 <xsl:apply-templates select="html:span" mode="citation"/>
55                 <xsl:apply-templates select="html:a" mode="citation"/>
56                 <xsl:text>}</xsl:text>
57         </xsl:template>
58
59         <xsl:template match="html:span[@class='markdowncitation']">
60                 <xsl:text>~\citep</xsl:text>
61                 <xsl:apply-templates select="html:span" mode="citation"/>
62                 <xsl:apply-templates select="html:a" mode="markdowncitation"/>
63                 <xsl:text>}</xsl:text>
64         </xsl:template>
65
66         <!-- use \citet when indicated -->
67         <xsl:template match="html:span[@class='externalcitation'][child::html:span[position()='1'][@class='textual citation']]">
68                 <xsl:text>\citet</xsl:text>
69                 <xsl:apply-templates select="html:span" mode="citation"/>
70                 <xsl:apply-templates select="html:a" mode="citation"/>
71                 <xsl:text>}</xsl:text>
72         </xsl:template>
73
74         <xsl:template match="html:span[@class='markdowncitation'][child::html:span[position()='1'][@class='textual citation']]">
75                 <xsl:text>~\citet</xsl:text>
76                 <xsl:apply-templates select="html:span" mode="citation"/>
77                 <xsl:apply-templates select="html:a" mode="markdowncitation"/>
78                 <xsl:text>}</xsl:text>
79         </xsl:template>
80
81         <!-- Disable the text (not used for LaTeX output) -->
82         <xsl:template match="html:span[@class='textual citation']" mode="citation">
83                 <xsl:text></xsl:text>
84         </xsl:template>
85
86 </xsl:stylesheet>