1 <?xml version="1.0" encoding="ASCII"?><!--This file was created automatically by html2xhtml--><!--from the HTML stylesheets.--><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:d="http://docbook.org/ns/docbook" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns="http://www.w3.org/1999/xhtml" exclude-result-prefixes="mml d" version="1.0">
3 <!-- ********************************************************************
5 This file is part of the XSL DocBook Stylesheet distribution.
6 See ../README or http://cdn.docbook.org/release/xsl/current/ for
7 copyright and other information.
9 ******************************************************************** -->
11 <xsl:template match="d:inlineequation">
12 <xsl:apply-templates/>
15 <xsl:template match="d:alt">
18 <xsl:template match="d:mathphrase">
20 <xsl:apply-templates select="." mode="common.html.attributes"/>
21 <xsl:call-template name="id.attribute"/>
22 <xsl:apply-templates/>
26 <!-- "Support" for MathML -->
28 <xsl:template match="mml:*">
30 <xsl:copy-of select="@*"/>
31 <xsl:apply-templates/>
35 <!-- Support for TeX math in alt -->
37 <xsl:template match="*" mode="collect.tex.math">
38 <xsl:call-template name="write.text.chunk">
39 <xsl:with-param name="filename" select="$tex.math.file"/>
40 <xsl:with-param name="method" select="'text'"/>
41 <xsl:with-param name="content">
43 <xsl:when test="$tex.math.in.alt = 'plain'">
44 <xsl:call-template name="tex.math.plain.head"/>
45 <xsl:apply-templates select="." mode="collect.tex.math.plain"/>
46 <xsl:call-template name="tex.math.plain.tail"/>
48 <xsl:when test="$tex.math.in.alt = 'latex'">
49 <xsl:call-template name="tex.math.latex.head"/>
50 <xsl:apply-templates select="." mode="collect.tex.math.latex"/>
51 <xsl:call-template name="tex.math.latex.tail"/>
55 Unsupported TeX math notation:
56 <xsl:value-of select="$tex.math.in.alt"/>
61 <xsl:with-param name="encoding" select="$chunker.output.encoding"/>
67 <xsl:template name="tex.math.plain.head">
68 <xsl:text>\nopagenumbers
72 <xsl:template name="tex.math.plain.tail">
77 <xsl:template match="d:inlineequation" mode="collect.tex.math.plain">
78 <xsl:variable name="filename">
80 <xsl:when test="d:graphic">
81 <xsl:call-template name="mediaobject.filename">
82 <xsl:with-param name="object" select="d:graphic"/>
86 <xsl:call-template name="select.mediaobject.filename">
87 <xsl:with-param name="olist" select="d:inlinemediaobject/*"/>
92 <xsl:variable name="output.delims">
93 <xsl:call-template name="tex.math.output.delims"/>
95 <xsl:variable name="tex" select="d:alt[@role='tex'] | d:inlinemediaobject/d:textobject[@role='tex']"/>
97 <xsl:text>\special{dvi2bitmap outputfile </xsl:text>
98 <xsl:value-of select="$filename"/>
101 <xsl:if test="$output.delims != 0">
102 <xsl:text>$</xsl:text>
104 <xsl:value-of select="$tex"/>
105 <xsl:if test="$output.delims != 0">
109 <xsl:text>\vfill\eject
114 <xsl:template match="d:equation|d:informalequation" mode="collect.tex.math.plain">
115 <xsl:variable name="filename">
117 <xsl:when test="d:graphic">
118 <xsl:call-template name="mediaobject.filename">
119 <xsl:with-param name="object" select="d:graphic"/>
123 <xsl:call-template name="select.mediaobject.filename">
124 <xsl:with-param name="olist" select="d:mediaobject/*"/>
129 <xsl:variable name="output.delims">
130 <xsl:call-template name="tex.math.output.delims"/>
132 <xsl:variable name="tex" select="d:alt[@role='tex'] | d:mediaobject/d:textobject[@role='tex']"/>
134 <xsl:text>\special{dvi2bitmap outputfile </xsl:text>
135 <xsl:value-of select="$filename"/>
138 <xsl:if test="$output.delims != 0">
139 <xsl:text>$$</xsl:text>
141 <xsl:value-of select="$tex"/>
142 <xsl:if test="$output.delims != 0">
146 <xsl:text>\vfill\eject
151 <xsl:template match="text()" mode="collect.tex.math.plain"/>
155 <xsl:template name="tex.math.latex.head">
156 <xsl:text>\documentclass{article}
158 <xsl:text>\pagestyle{empty}
160 <xsl:text>\begin{document}
164 <xsl:template name="tex.math.latex.tail">
165 <xsl:text>\end{document}
169 <xsl:template match="d:inlineequation" mode="collect.tex.math.latex">
170 <xsl:variable name="filename">
172 <xsl:when test="d:graphic">
173 <xsl:call-template name="mediaobject.filename">
174 <xsl:with-param name="object" select="d:graphic"/>
178 <xsl:call-template name="select.mediaobject.filename">
179 <xsl:with-param name="olist" select="d:inlinemediaobject/*"/>
184 <xsl:variable name="output.delims">
185 <xsl:call-template name="tex.math.output.delims"/>
187 <xsl:variable name="tex" select="d:alt[@role='tex'] | d:inlinemediaobject/d:textobject[@role='tex']"/>
189 <xsl:text>\special{dvi2bitmap outputfile </xsl:text>
190 <xsl:value-of select="$filename"/>
193 <xsl:if test="$output.delims != 0">
194 <xsl:text>$</xsl:text>
196 <xsl:value-of select="$tex"/>
197 <xsl:if test="$output.delims != 0">
206 <xsl:template match="d:equation|d:informalequation" mode="collect.tex.math.latex">
207 <xsl:variable name="filename">
209 <xsl:when test="d:graphic">
210 <xsl:call-template name="mediaobject.filename">
211 <xsl:with-param name="object" select="d:graphic"/>
215 <xsl:call-template name="select.mediaobject.filename">
216 <xsl:with-param name="olist" select="d:mediaobject/*"/>
221 <xsl:variable name="output.delims">
222 <xsl:call-template name="tex.math.output.delims"/>
224 <xsl:variable name="tex" select="d:alt[@role='tex'] | d:mediaobject/d:textobject[@role='tex']"/>
226 <xsl:text>\special{dvi2bitmap outputfile </xsl:text>
227 <xsl:value-of select="$filename"/>
230 <xsl:if test="$output.delims != 0">
231 <xsl:text>$$</xsl:text>
233 <xsl:value-of select="$tex"/>
234 <xsl:if test="$output.delims != 0">
243 <xsl:template match="text()" mode="collect.tex.math.latex"/>
245 <!-- Extracting image filename from mediaobject and graphic elements -->
247 <xsl:template name="select.mediaobject.filename">
248 <xsl:param name="olist" select="d:imageobject|d:imageobjectco |d:videoobject|d:audioobject|d:textobject"/>
250 <xsl:variable name="mediaobject.index">
251 <xsl:call-template name="select.mediaobject.index">
252 <xsl:with-param name="olist" select="$olist"/>
253 <xsl:with-param name="count" select="1"/>
257 <xsl:if test="$mediaobject.index != ''">
258 <xsl:call-template name="mediaobject.filename">
259 <xsl:with-param name="object" select="$olist[position() = $mediaobject.index]"/>
264 <xsl:template name="tex.math.output.delims">
265 <xsl:variable name="pi.delims">
266 <xsl:call-template name="pi.dbtex_delims">
267 <xsl:with-param name="node" select="descendant-or-self::*"/>
270 <xsl:variable name="result">
272 <xsl:when test="$pi.delims = 'no'">0</xsl:when>
273 <xsl:when test="$pi.delims = '' and $tex.math.delims = 0">0</xsl:when>
274 <xsl:otherwise>1</xsl:otherwise>
277 <xsl:value-of select="$result"/>