1 <?xml version='1.0' encoding='utf-8'?>
3 <!-- XHTML-to-Science converter by Fletcher Penney
4 specifically designed for use with MultiMarkdown created XHTML
6 Uses the LaTeX article class for output
8 MultiMarkdown Version 2.0.b5
10 $Id: science.xslt 479 2008-01-12 23:04:13Z fletcher $
12 TODO: The multicolumn layout broke
13 TODO: Top margin is short, bottom margin is long
14 TODO: Still needs work
18 # Copyright (C) 2005-2008 Fletcher T. Penney <fletcher@fletcherpenney.net>
20 # This program is free software; you can redistribute it and/or modify
21 # it under the terms of the GNU General Public License as published by
22 # the Free Software Foundation; either version 2 of the License, or
23 # (at your option) any later version.
25 # This program is distributed in the hope that it will be useful,
26 # but WITHOUT ANY WARRANTY; without even the implied warranty of
27 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 # GNU General Public License for more details.
30 # You should have received a copy of the GNU General Public License
31 # along with this program; if not, write to the
32 # Free Software Foundation, Inc.
33 # 59 Temple Place, Suite 330
34 # Boston, MA 02111-1307 USA
39 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
40 xmlns:html="http://www.w3.org/1999/xhtml"
43 <xsl:import href="article.xslt"/>
45 <xsl:output method='text' encoding='utf-8'/>
47 <xsl:strip-space elements="*" />
49 <xsl:template match="/">
50 <xsl:apply-templates select="html:html/html:head"/>
51 <xsl:apply-templates select="html:html/html:body"/>
52 <xsl:call-template name="latex-footer"/>
55 <xsl:template name="latex-document-class">
56 <xsl:text>\documentclass[oneside,article,9pt]{memoir}
57 \usepackage{layouts}[2001/04/29]
59 \usepackage{xmpincl} % Seems to be required to get the pdf to generate??
65 <!-- Science allows for an abstract -->
67 <!-- support for abstracts -->
68 <xsl:template match="html:h1[1]">
71 <xsl:when test="translate(.,'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
72 'abcdefghijklmnopqrstuvwxyz') = 'abstract'">
73 <xsl:text>\begin{abstract}</xsl:text>
74 <xsl:value-of select="$newline"/>
75 <xsl:text>\addcontentsline{toc}{section}{</xsl:text>
76 <xsl:apply-templates select="node()"/>
77 <xsl:text>}</xsl:text>
80 <xsl:text>\begin{body}
83 \setlength{\parindent}{1em}
86 <xsl:apply-templates select="node()"/>
87 <xsl:text>}</xsl:text>
90 <xsl:text>\label{</xsl:text>
91 <xsl:value-of select="@id"/>
92 <xsl:text>}</xsl:text>
93 <xsl:value-of select="$newline"/>
94 <xsl:value-of select="$newline"/>
95 <xsl:value-of select="$newline"/>
98 <xsl:template match="html:h1[position() = '2'][preceding-sibling::html:h1[position()='1'][translate(.,'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
99 'abcdefghijklmnopqrstuvwxyz') = 'abstract']]">
100 <xsl:text>\end{abstract}
105 \setlength{\parindent}{1em}</xsl:text>
106 <xsl:value-of select="$newline"/>
107 <xsl:value-of select="$newline"/>
108 <xsl:text>\section{</xsl:text>
109 <xsl:apply-templates select="node()"/>
110 <xsl:text>}</xsl:text>
111 <xsl:value-of select="$newline"/>
112 <xsl:text>\label{</xsl:text>
113 <xsl:value-of select="@id"/>
114 <xsl:text>}</xsl:text>
115 <xsl:value-of select="$newline"/>
116 <xsl:value-of select="$newline"/>
119 <xsl:template match="html:h2[count(preceding-sibling::html:h1) = '1'][preceding-sibling::html:h1[position()='1'][translate(.,'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
120 'abcdefghijklmnopqrstuvwxyz') = 'abstract']]">
121 <xsl:text>\subsection*{</xsl:text>
122 <xsl:apply-templates select="node()"/>
123 <xsl:text>}</xsl:text>
124 <xsl:value-of select="$newline"/>
125 <xsl:text>\label{</xsl:text>
126 <xsl:value-of select="@id"/>
127 <xsl:text>}</xsl:text>
128 <xsl:value-of select="$newline"/>
129 <xsl:value-of select="$newline"/>
133 <xsl:template match="html:pre/html:code">
134 <xsl:text>\begin{verbatim}
137 <xsl:value-of select="."/>