1
<?xml version='1.0' encoding='utf-8'?>
2
3
<!-- XHTML-to-Article converter by Fletcher Penney
4
specifically designed for use with Markdown created XHTML
5
6
Uses the LaTeX article class for output
7
8
Version 2.1.1
9
-->
10
11
<!--
12
/=======================================================================
13
| Minor modifications by Timothy Vismor
14
| May 2010
15
|=======================================================================
16
|
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.
19
|
20
| Most of the grunt work is delegated to the stylesheet:
21
| article_aft_xhtml2latex.xslt
22
|
23
| Modifications are intended to make output more compatible with
24
| the static page maintenance workflow at vismor.com.
25
|
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
\=======================================================================
30
-->
31
32
<!--
33
# Copyright (C) 2005 Fletcher T. Penney <fletcher@freeshell.org>
34
#
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.
39
#
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.
44
#
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
50
-->
51
52
<!-- To Do
53
-->
54
55
<xsl:stylesheet
56
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
57
xmlns:html="http://www.w3.org/1999/xhtml"
58
version="1.0">
59
60
<!-- ===== vismor ===== -->
61
<xsl:import href="vismor_article_w_alg_fig_tab_xhtml2latex.xslt"/>
62
<!-- ================== -->
63
64
<xsl:output method='text' encoding='utf-8' omit-xml-declaration = 'yes'/>
65
66
<xsl:strip-space elements="*" />
67
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"/>
72
</xsl:template>
73
74
<xsl:template name="latex-document-class">
75
<xsl:text>\documentclass[11pt,oneside]{article}
76
</xsl:text>
77
</xsl:template>
78
79
<!-- Convert headers into sections, etc -->
80
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"/>
91
</xsl:template>
92
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"/>
103
</xsl:template>
104
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"/>
115
</xsl:template>
116
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"/>
127
</xsl:template>
128
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"/>
138
</xsl:template>
139
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"/>
148
</xsl:template>
149
150
<!-- code block -->
151
<xsl:template match="html:pre[child::html:code]">
152
<xsl:text>\begin{verbatim}
153
154
</xsl:text>
155
<xsl:value-of select="./html:code"/>
156
<xsl:text>
157
158
\end{verbatim}
159
160
</xsl:text>
161
</xsl:template>
162
163
<!-- support for abstracts -->
164
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"/>
174
</xsl:template>
175
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"/>
181
<xsl:choose>
182
<xsl:when test="substring(node(), (string-length(node()) - string-length('*')) + 1) = '*'">
183
<xsl:text>\section*{}</xsl:text>
184
</xsl:when>
185
<xsl:otherwise>
186
<xsl:text>\section{</xsl:text>
187
<xsl:apply-templates select="node()"/>
188
<xsl:text>}</xsl:text>
189
</xsl:otherwise>
190
</xsl:choose>
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"/>
197
</xsl:template>
198
199
</xsl:stylesheet>