1
<?xml version="1.0" encoding="ASCII"?>
2
<!--This file was created automatically by html2xhtml-->
3
<!--from the HTML stylesheets.-->
4
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns="http://www.w3.org/1999/xhtml" exclude-result-prefixes="mml" version="1.0">
6
<!-- ********************************************************************
7
$Id: math.xsl 8421 2009-05-04 07:49:49Z bobstayton $
8
********************************************************************
10
This file is part of the XSL DocBook Stylesheet distribution.
11
See ../README or http://docbook.sf.net/release/xsl/current/ for
12
copyright and other information.
14
******************************************************************** -->
16
<xsl:template match="inlineequation">
17
<xsl:apply-templates/>
20
<xsl:template match="alt">
23
<xsl:template match="mathphrase">
25
<xsl:apply-templates select="." mode="common.html.attributes"/>
26
<xsl:apply-templates/>
30
<!-- "Support" for MathML -->
32
<xsl:template match="mml:*">
34
<xsl:copy-of select="@*"/>
35
<xsl:apply-templates/>
39
<!-- Support for TeX math in alt -->
41
<xsl:template match="*" mode="collect.tex.math">
42
<xsl:call-template name="write.text.chunk">
43
<xsl:with-param name="filename" select="$tex.math.file"/>
44
<xsl:with-param name="method" select="'text'"/>
45
<xsl:with-param name="content">
47
<xsl:when test="$tex.math.in.alt = 'plain'">
48
<xsl:call-template name="tex.math.plain.head"/>
49
<xsl:apply-templates select="." mode="collect.tex.math.plain"/>
50
<xsl:call-template name="tex.math.plain.tail"/>
52
<xsl:when test="$tex.math.in.alt = 'latex'">
53
<xsl:call-template name="tex.math.latex.head"/>
54
<xsl:apply-templates select="." mode="collect.tex.math.latex"/>
55
<xsl:call-template name="tex.math.latex.tail"/>
59
Unsupported TeX math notation:
60
<xsl:value-of select="$tex.math.in.alt"/>
65
<xsl:with-param name="encoding" select="$chunker.output.encoding"/>
71
<xsl:template name="tex.math.plain.head">
72
<xsl:text>\nopagenumbers
76
<xsl:template name="tex.math.plain.tail">
81
<xsl:template match="inlineequation" mode="collect.tex.math.plain">
82
<xsl:variable name="filename">
84
<xsl:when test="graphic">
85
<xsl:call-template name="mediaobject.filename">
86
<xsl:with-param name="object" select="graphic"/>
90
<xsl:call-template name="select.mediaobject.filename">
91
<xsl:with-param name="olist" select="inlinemediaobject/*"/>
96
<xsl:variable name="output.delims">
97
<xsl:call-template name="tex.math.output.delims"/>
99
<xsl:variable name="tex" select="alt[@role='tex'] | inlinemediaobject/textobject[@role='tex']"/>
101
<xsl:text>\special{dvi2bitmap outputfile </xsl:text>
102
<xsl:value-of select="$filename"/>
105
<xsl:if test="$output.delims != 0">
106
<xsl:text>$</xsl:text>
108
<xsl:value-of select="$tex"/>
109
<xsl:if test="$output.delims != 0">
113
<xsl:text>\vfill\eject
118
<xsl:template match="equation|informalequation" mode="collect.tex.math.plain">
119
<xsl:variable name="filename">
121
<xsl:when test="graphic">
122
<xsl:call-template name="mediaobject.filename">
123
<xsl:with-param name="object" select="graphic"/>
127
<xsl:call-template name="select.mediaobject.filename">
128
<xsl:with-param name="olist" select="mediaobject/*"/>
133
<xsl:variable name="output.delims">
134
<xsl:call-template name="tex.math.output.delims"/>
136
<xsl:variable name="tex" select="alt[@role='tex'] | mediaobject/textobject[@role='tex']"/>
138
<xsl:text>\special{dvi2bitmap outputfile </xsl:text>
139
<xsl:value-of select="$filename"/>
142
<xsl:if test="$output.delims != 0">
143
<xsl:text>$$</xsl:text>
145
<xsl:value-of select="$tex"/>
146
<xsl:if test="$output.delims != 0">
150
<xsl:text>\vfill\eject
155
<xsl:template match="text()" mode="collect.tex.math.plain"/>
159
<xsl:template name="tex.math.latex.head">
160
<xsl:text>\documentclass{article}
162
<xsl:text>\pagestyle{empty}
164
<xsl:text>\begin{document}
168
<xsl:template name="tex.math.latex.tail">
169
<xsl:text>\end{document}
173
<xsl:template match="inlineequation" mode="collect.tex.math.latex">
174
<xsl:variable name="filename">
176
<xsl:when test="graphic">
177
<xsl:call-template name="mediaobject.filename">
178
<xsl:with-param name="object" select="graphic"/>
182
<xsl:call-template name="select.mediaobject.filename">
183
<xsl:with-param name="olist" select="inlinemediaobject/*"/>
188
<xsl:variable name="output.delims">
189
<xsl:call-template name="tex.math.output.delims"/>
191
<xsl:variable name="tex" select="alt[@role='tex'] | inlinemediaobject/textobject[@role='tex']"/>
193
<xsl:text>\special{dvi2bitmap outputfile </xsl:text>
194
<xsl:value-of select="$filename"/>
197
<xsl:if test="$output.delims != 0">
198
<xsl:text>$</xsl:text>
200
<xsl:value-of select="$tex"/>
201
<xsl:if test="$output.delims != 0">
210
<xsl:template match="equation|informalequation" mode="collect.tex.math.latex">
211
<xsl:variable name="filename">
213
<xsl:when test="graphic">
214
<xsl:call-template name="mediaobject.filename">
215
<xsl:with-param name="object" select="graphic"/>
219
<xsl:call-template name="select.mediaobject.filename">
220
<xsl:with-param name="olist" select="mediaobject/*"/>
225
<xsl:variable name="output.delims">
226
<xsl:call-template name="tex.math.output.delims"/>
228
<xsl:variable name="tex" select="alt[@role='tex'] | mediaobject/textobject[@role='tex']"/>
230
<xsl:text>\special{dvi2bitmap outputfile </xsl:text>
231
<xsl:value-of select="$filename"/>
234
<xsl:if test="$output.delims != 0">
235
<xsl:text>$$</xsl:text>
237
<xsl:value-of select="$tex"/>
238
<xsl:if test="$output.delims != 0">
247
<xsl:template match="text()" mode="collect.tex.math.latex"/>
249
<!-- Extracting image filename from mediaobject and graphic elements -->
251
<xsl:template name="select.mediaobject.filename">
252
<xsl:param name="olist" select="imageobject|imageobjectco |videoobject|audioobject|textobject"/>
254
<xsl:variable name="mediaobject.index">
255
<xsl:call-template name="select.mediaobject.index">
256
<xsl:with-param name="olist" select="$olist"/>
257
<xsl:with-param name="count" select="1"/>
261
<xsl:if test="$mediaobject.index != ''">
262
<xsl:call-template name="mediaobject.filename">
263
<xsl:with-param name="object" select="$olist[position() = $mediaobject.index]"/>
268
<xsl:template name="tex.math.output.delims">
269
<xsl:variable name="pi.delims">
270
<xsl:call-template name="pi.dbtex_delims">
271
<xsl:with-param name="node" select="descendant-or-self::*"/>
274
<xsl:variable name="result">
276
<xsl:when test="$pi.delims = 'no'">0</xsl:when>
277
<xsl:when test="$pi.delims = '' and $tex.math.delims = 0">0</xsl:when>
278
<xsl:otherwise>1</xsl:otherwise>
281
<xsl:value-of select="$result"/>