1
<?xml version='1.0' encoding='utf-8'?>
3
<!-- XHTML-to-Article converter by Fletcher Penney
4
specifically designed for use with Markdown created XHTML
6
Uses the LaTeX article class for output
12
/=======================================================================
13
| Minor modifications by Timothy Vismor
15
|=======================================================================
17
| This file generates an article (one-sided) with a table of contents,
18
| a list of figures, a list of tables, and a list of algorithms.
20
| Most of the grunt work is delegated to the stylesheet:
21
| article_aft_xhtml2latex.xslt
23
| Modifications are intended to make output more compatible with
24
| the static page maintenance workflow at vismor.com.
26
| For a more complete picture of the changes, diff this file against
27
| article.xslt in the standard MMD distribution. You can also search
28
| this file for "vismor" to find modifed areas.
29
\=======================================================================
33
# Copyright (C) 2005 Fletcher T. Penney <fletcher@freeshell.org>
35
# This program is free software; you can redistribute it and/or modify
36
# it under the terms of the GNU General Public License as published by
37
# the Free Software Foundation; either version 2 of the License, or
38
# (at your option) any later version.
40
# This program is distributed in the hope that it will be useful,
41
# but WITHOUT ANY WARRANTY; without even the implied warranty of
42
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
43
# GNU General Public License for more details.
45
# You should have received a copy of the GNU General Public License
46
# along with this program; if not, write to the
47
# Free Software Foundation, Inc.
48
# 59 Temple Place, Suite 330
49
# Boston, MA 02111-1307 USA
56
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
57
xmlns:html="http://www.w3.org/1999/xhtml"
60
<!-- ===== vismor ===== -->
61
<xsl:import href="vismor_article_w_alg_fig_tab_xhtml2latex.xslt"/>
62
<!-- ================== -->
64
<xsl:output method='text' encoding='utf-8' omit-xml-declaration = 'yes'/>
66
<xsl:strip-space elements="*" />
68
<xsl:template match="/">
69
<xsl:apply-templates select="html:html/html:head"/>
70
<xsl:apply-templates select="html:html/html:body"/>
71
<xsl:call-template name="latex-footer"/>
74
<xsl:template name="latex-document-class">
75
<xsl:text>\documentclass[11pt,oneside]{article}
79
<!-- Convert headers into sections, etc -->
81
<xsl:template match="html:h1">
82
<xsl:text>\section{</xsl:text>
83
<xsl:apply-templates select="node()"/>
84
<xsl:text>}</xsl:text>
85
<xsl:value-of select="$newline"/>
86
<xsl:text>\label{</xsl:text>
87
<xsl:value-of select="@id"/>
88
<xsl:text>}</xsl:text>
89
<xsl:value-of select="$newline"/>
90
<xsl:value-of select="$newline"/>
93
<xsl:template match="html:h2">
94
<xsl:text>\subsection{</xsl:text>
95
<xsl:apply-templates select="node()"/>
96
<xsl:text>}</xsl:text>
97
<xsl:value-of select="$newline"/>
98
<xsl:text>\label{</xsl:text>
99
<xsl:value-of select="@id"/>
100
<xsl:text>}</xsl:text>
101
<xsl:value-of select="$newline"/>
102
<xsl:value-of select="$newline"/>
105
<xsl:template match="html:h3">
106
<xsl:text>\subsubsection{</xsl:text>
107
<xsl:apply-templates select="node()"/>
108
<xsl:text>}</xsl:text>
109
<xsl:value-of select="$newline"/>
110
<xsl:text>\label{</xsl:text>
111
<xsl:value-of select="@id"/>
112
<xsl:text>}</xsl:text>
113
<xsl:value-of select="$newline"/>
114
<xsl:value-of select="$newline"/>
117
<xsl:template match="html:h4">
118
<xsl:text>\textbf{</xsl:text>
119
<xsl:apply-templates select="node()"/>
120
<xsl:text>}</xsl:text>
121
<xsl:value-of select="$newline"/>
122
<xsl:text>\label{</xsl:text>
123
<xsl:value-of select="@id"/>
124
<xsl:text>}</xsl:text>
125
<xsl:value-of select="$newline"/>
126
<xsl:value-of select="$newline"/>
129
<xsl:template match="html:h5">
130
<xsl:text>{\itshape </xsl:text>
131
<xsl:apply-templates select="node()"/>
132
<xsl:value-of select="$newline"/>
133
<xsl:text>\label{</xsl:text>
134
<xsl:value-of select="@id"/>
135
<xsl:text>}</xsl:text>
136
<xsl:value-of select="$newline"/>
137
<xsl:value-of select="$newline"/>
140
<xsl:template match="html:h6">
141
<xsl:apply-templates select="node()"/>
142
<xsl:value-of select="$newline"/>
143
<xsl:text>\label{</xsl:text>
144
<xsl:value-of select="@id"/>
145
<xsl:text>}</xsl:text>
146
<xsl:value-of select="$newline"/>
147
<xsl:value-of select="$newline"/>
151
<xsl:template match="html:pre[child::html:code]">
152
<xsl:text>\begin{verbatim}
155
<xsl:value-of select="./html:code"/>
163
<!-- support for abstracts -->
165
<xsl:template match="html:h1[1][translate(.,'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
166
'abcdefghijklmnopqrstuvwxyz') = 'abstract']">
167
<xsl:text>\begin{abstract}</xsl:text>
168
<xsl:value-of select="$newline"/>
169
<xsl:text>\label{</xsl:text>
170
<xsl:value-of select="@id"/>
171
<xsl:text>}</xsl:text>
172
<xsl:value-of select="$newline"/>
173
<xsl:value-of select="$newline"/>
176
<xsl:template match="html:h1[position()='2'][preceding-sibling::html:h1[position()='1'][translate(.,'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
177
'abcdefghijklmnopqrstuvwxyz') = 'abstract']]">
178
<xsl:text>\end{abstract}</xsl:text>
179
<xsl:value-of select="$newline"/>
180
<xsl:value-of select="$newline"/>
182
<xsl:when test="substring(node(), (string-length(node()) - string-length('*')) + 1) = '*'">
183
<xsl:text>\section*{}</xsl:text>
186
<xsl:text>\section{</xsl:text>
187
<xsl:apply-templates select="node()"/>
188
<xsl:text>}</xsl:text>
191
<xsl:value-of select="$newline"/>
192
<xsl:text>\label{</xsl:text>
193
<xsl:value-of select="@id"/>
194
<xsl:text>}</xsl:text>
195
<xsl:value-of select="$newline"/>
196
<xsl:value-of select="$newline"/>