| [f8c4e94] | 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">
 | 
|---|
 | 5 | 
 | 
|---|
 | 6 | <!-- ********************************************************************
 | 
|---|
 | 7 |      $Id$
 | 
|---|
 | 8 |      ********************************************************************
 | 
|---|
 | 9 | 
 | 
|---|
 | 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.
 | 
|---|
 | 13 | 
 | 
|---|
 | 14 |      ******************************************************************** -->
 | 
|---|
 | 15 | 
 | 
|---|
 | 16 | <xsl:template match="inlineequation">
 | 
|---|
 | 17 |   <xsl:apply-templates/>
 | 
|---|
 | 18 | </xsl:template>
 | 
|---|
 | 19 | 
 | 
|---|
 | 20 | <xsl:template match="alt">
 | 
|---|
 | 21 | </xsl:template>
 | 
|---|
 | 22 | 
 | 
|---|
 | 23 | <xsl:template match="mathphrase">
 | 
|---|
 | 24 |   <span>
 | 
|---|
 | 25 |     <xsl:apply-templates select="." mode="class.attribute"/>
 | 
|---|
 | 26 |     <xsl:apply-templates/>
 | 
|---|
 | 27 |   </span>
 | 
|---|
 | 28 | </xsl:template>
 | 
|---|
 | 29 | 
 | 
|---|
 | 30 | <!-- "Support" for MathML -->
 | 
|---|
 | 31 | 
 | 
|---|
 | 32 | <xsl:template match="mml:*">
 | 
|---|
 | 33 |   <xsl:copy>
 | 
|---|
 | 34 |     <xsl:copy-of select="@*"/>
 | 
|---|
 | 35 |     <xsl:apply-templates/>
 | 
|---|
 | 36 |   </xsl:copy>
 | 
|---|
 | 37 | </xsl:template>
 | 
|---|
 | 38 | 
 | 
|---|
 | 39 | <!-- Support for TeX math in alt -->
 | 
|---|
 | 40 | 
 | 
|---|
 | 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">
 | 
|---|
 | 46 |       <xsl:choose>
 | 
|---|
 | 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"/>
 | 
|---|
 | 51 |         </xsl:when>
 | 
|---|
 | 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"/>
 | 
|---|
 | 56 |         </xsl:when>
 | 
|---|
 | 57 |         <xsl:otherwise>
 | 
|---|
 | 58 |           <xsl:message>
 | 
|---|
 | 59 |             Unsupported TeX math notation: 
 | 
|---|
 | 60 |             <xsl:value-of select="$tex.math.in.alt"/>
 | 
|---|
 | 61 |           </xsl:message>
 | 
|---|
 | 62 |         </xsl:otherwise>
 | 
|---|
 | 63 |       </xsl:choose>
 | 
|---|
 | 64 |     </xsl:with-param>
 | 
|---|
 | 65 |     <xsl:with-param name="encoding" select="$chunker.output.encoding"/>
 | 
|---|
 | 66 |   </xsl:call-template>
 | 
|---|
 | 67 | </xsl:template>
 | 
|---|
 | 68 | 
 | 
|---|
 | 69 | <!-- PlainTeX -->
 | 
|---|
 | 70 | 
 | 
|---|
 | 71 | <xsl:template name="tex.math.plain.head">
 | 
|---|
 | 72 |   <xsl:text>\nopagenumbers 
 | 
|---|
 | 73 | </xsl:text>
 | 
|---|
 | 74 | </xsl:template>
 | 
|---|
 | 75 | 
 | 
|---|
 | 76 | <xsl:template name="tex.math.plain.tail">
 | 
|---|
 | 77 |   <xsl:text>\bye 
 | 
|---|
 | 78 | </xsl:text>
 | 
|---|
 | 79 | </xsl:template>
 | 
|---|
 | 80 | 
 | 
|---|
 | 81 | <xsl:template match="inlineequation" mode="collect.tex.math.plain">
 | 
|---|
 | 82 |   <xsl:variable name="filename">
 | 
|---|
 | 83 |     <xsl:choose>
 | 
|---|
 | 84 |       <xsl:when test="graphic">
 | 
|---|
 | 85 |         <xsl:call-template name="mediaobject.filename">
 | 
|---|
 | 86 |           <xsl:with-param name="object" select="graphic"/>
 | 
|---|
 | 87 |         </xsl:call-template>
 | 
|---|
 | 88 |       </xsl:when>
 | 
|---|
 | 89 |       <xsl:otherwise>
 | 
|---|
 | 90 |         <xsl:call-template name="select.mediaobject.filename">
 | 
|---|
 | 91 |           <xsl:with-param name="olist" select="inlinemediaobject/*"/>
 | 
|---|
 | 92 |         </xsl:call-template>
 | 
|---|
 | 93 |       </xsl:otherwise>
 | 
|---|
 | 94 |     </xsl:choose>
 | 
|---|
 | 95 |   </xsl:variable>
 | 
|---|
 | 96 |   <xsl:variable name="output.delims">
 | 
|---|
 | 97 |     <xsl:call-template name="tex.math.output.delims"/>
 | 
|---|
 | 98 |   </xsl:variable>
 | 
|---|
 | 99 |   <xsl:variable name="tex" select="alt[@role='tex'] | inlinemediaobject/textobject[@role='tex']"/>
 | 
|---|
 | 100 |   <xsl:if test="$tex">
 | 
|---|
 | 101 |     <xsl:text>\special{dvi2bitmap outputfile </xsl:text>
 | 
|---|
 | 102 |     <xsl:value-of select="$filename"/>
 | 
|---|
 | 103 |     <xsl:text>} 
 | 
|---|
 | 104 | </xsl:text>
 | 
|---|
 | 105 |     <xsl:if test="$output.delims != 0">
 | 
|---|
 | 106 |       <xsl:text>$</xsl:text>
 | 
|---|
 | 107 |     </xsl:if>
 | 
|---|
 | 108 |     <xsl:value-of select="$tex"/>
 | 
|---|
 | 109 |     <xsl:if test="$output.delims != 0">
 | 
|---|
 | 110 |       <xsl:text>$ 
 | 
|---|
 | 111 | </xsl:text>
 | 
|---|
 | 112 |     </xsl:if>
 | 
|---|
 | 113 |     <xsl:text>\vfill\eject 
 | 
|---|
 | 114 | </xsl:text>
 | 
|---|
 | 115 |   </xsl:if>
 | 
|---|
 | 116 | </xsl:template>
 | 
|---|
 | 117 | 
 | 
|---|
 | 118 | <xsl:template match="equation|informalequation" mode="collect.tex.math.plain">
 | 
|---|
 | 119 |   <xsl:variable name="filename">
 | 
|---|
 | 120 |     <xsl:choose>
 | 
|---|
 | 121 |       <xsl:when test="graphic">
 | 
|---|
 | 122 |         <xsl:call-template name="mediaobject.filename">
 | 
|---|
 | 123 |           <xsl:with-param name="object" select="graphic"/>
 | 
|---|
 | 124 |         </xsl:call-template>
 | 
|---|
 | 125 |       </xsl:when>
 | 
|---|
 | 126 |       <xsl:otherwise>
 | 
|---|
 | 127 |         <xsl:call-template name="select.mediaobject.filename">
 | 
|---|
 | 128 |           <xsl:with-param name="olist" select="mediaobject/*"/>
 | 
|---|
 | 129 |         </xsl:call-template>
 | 
|---|
 | 130 |       </xsl:otherwise>
 | 
|---|
 | 131 |     </xsl:choose>
 | 
|---|
 | 132 |   </xsl:variable>
 | 
|---|
 | 133 |   <xsl:variable name="output.delims">
 | 
|---|
 | 134 |     <xsl:call-template name="tex.math.output.delims"/>
 | 
|---|
 | 135 |   </xsl:variable>
 | 
|---|
 | 136 |   <xsl:variable name="tex" select="alt[@role='tex'] | mediaobject/textobject[@role='tex']"/>
 | 
|---|
 | 137 |   <xsl:if test="$tex">
 | 
|---|
 | 138 |     <xsl:text>\special{dvi2bitmap outputfile </xsl:text>
 | 
|---|
 | 139 |     <xsl:value-of select="$filename"/>
 | 
|---|
 | 140 |     <xsl:text>} 
 | 
|---|
 | 141 | </xsl:text>
 | 
|---|
 | 142 |     <xsl:if test="$output.delims != 0">
 | 
|---|
 | 143 |       <xsl:text>$$</xsl:text>
 | 
|---|
 | 144 |     </xsl:if>
 | 
|---|
 | 145 |     <xsl:value-of select="$tex"/>
 | 
|---|
 | 146 |     <xsl:if test="$output.delims != 0">
 | 
|---|
 | 147 |       <xsl:text>$$ 
 | 
|---|
 | 148 | </xsl:text>
 | 
|---|
 | 149 |     </xsl:if>
 | 
|---|
 | 150 |     <xsl:text>\vfill\eject 
 | 
|---|
 | 151 | </xsl:text>
 | 
|---|
 | 152 |   </xsl:if>
 | 
|---|
 | 153 | </xsl:template>
 | 
|---|
 | 154 | 
 | 
|---|
 | 155 | <xsl:template match="text()" mode="collect.tex.math.plain"/>
 | 
|---|
 | 156 | 
 | 
|---|
 | 157 | <!-- LaTeX -->
 | 
|---|
 | 158 | 
 | 
|---|
 | 159 | <xsl:template name="tex.math.latex.head">
 | 
|---|
 | 160 |   <xsl:text>\documentclass{article} 
 | 
|---|
 | 161 | </xsl:text>
 | 
|---|
 | 162 |   <xsl:text>\pagestyle{empty} 
 | 
|---|
 | 163 | </xsl:text>
 | 
|---|
 | 164 |   <xsl:text>\begin{document} 
 | 
|---|
 | 165 | </xsl:text>
 | 
|---|
 | 166 | </xsl:template>
 | 
|---|
 | 167 | 
 | 
|---|
 | 168 | <xsl:template name="tex.math.latex.tail">
 | 
|---|
 | 169 |   <xsl:text>\end{document} 
 | 
|---|
 | 170 | </xsl:text>
 | 
|---|
 | 171 | </xsl:template>
 | 
|---|
 | 172 | 
 | 
|---|
 | 173 | <xsl:template match="inlineequation" mode="collect.tex.math.latex">
 | 
|---|
 | 174 |   <xsl:variable name="filename">
 | 
|---|
 | 175 |     <xsl:choose>
 | 
|---|
 | 176 |       <xsl:when test="graphic">
 | 
|---|
 | 177 |         <xsl:call-template name="mediaobject.filename">
 | 
|---|
 | 178 |           <xsl:with-param name="object" select="graphic"/>
 | 
|---|
 | 179 |         </xsl:call-template>
 | 
|---|
 | 180 |       </xsl:when>
 | 
|---|
 | 181 |       <xsl:otherwise>
 | 
|---|
 | 182 |         <xsl:call-template name="select.mediaobject.filename">
 | 
|---|
 | 183 |           <xsl:with-param name="olist" select="inlinemediaobject/*"/>
 | 
|---|
 | 184 |         </xsl:call-template>
 | 
|---|
 | 185 |       </xsl:otherwise>
 | 
|---|
 | 186 |     </xsl:choose>
 | 
|---|
 | 187 |   </xsl:variable>
 | 
|---|
 | 188 |   <xsl:variable name="output.delims">
 | 
|---|
 | 189 |     <xsl:call-template name="tex.math.output.delims"/>
 | 
|---|
 | 190 |   </xsl:variable>
 | 
|---|
 | 191 |   <xsl:variable name="tex" select="alt[@role='tex'] | inlinemediaobject/textobject[@role='tex']"/>
 | 
|---|
 | 192 |   <xsl:if test="$tex">
 | 
|---|
 | 193 |     <xsl:text>\special{dvi2bitmap outputfile </xsl:text>
 | 
|---|
 | 194 |     <xsl:value-of select="$filename"/>
 | 
|---|
 | 195 |     <xsl:text>} 
 | 
|---|
 | 196 | </xsl:text>
 | 
|---|
 | 197 |     <xsl:if test="$output.delims != 0">  
 | 
|---|
 | 198 |       <xsl:text>$</xsl:text>
 | 
|---|
 | 199 |     </xsl:if>
 | 
|---|
 | 200 |     <xsl:value-of select="$tex"/>
 | 
|---|
 | 201 |     <xsl:if test="$output.delims != 0">  
 | 
|---|
 | 202 |       <xsl:text>$ 
 | 
|---|
 | 203 | </xsl:text>
 | 
|---|
 | 204 |     </xsl:if>
 | 
|---|
 | 205 |     <xsl:text>\newpage 
 | 
|---|
 | 206 | </xsl:text>
 | 
|---|
 | 207 |   </xsl:if>
 | 
|---|
 | 208 | </xsl:template>
 | 
|---|
 | 209 | 
 | 
|---|
 | 210 | <xsl:template match="equation|informalequation" mode="collect.tex.math.latex">
 | 
|---|
 | 211 |   <xsl:variable name="filename">
 | 
|---|
 | 212 |     <xsl:choose>
 | 
|---|
 | 213 |       <xsl:when test="graphic">
 | 
|---|
 | 214 |         <xsl:call-template name="mediaobject.filename">
 | 
|---|
 | 215 |           <xsl:with-param name="object" select="graphic"/>
 | 
|---|
 | 216 |         </xsl:call-template>
 | 
|---|
 | 217 |       </xsl:when>
 | 
|---|
 | 218 |       <xsl:otherwise>
 | 
|---|
 | 219 |         <xsl:call-template name="select.mediaobject.filename">
 | 
|---|
 | 220 |           <xsl:with-param name="olist" select="mediaobject/*"/>
 | 
|---|
 | 221 |         </xsl:call-template>
 | 
|---|
 | 222 |       </xsl:otherwise>
 | 
|---|
 | 223 |     </xsl:choose>
 | 
|---|
 | 224 |   </xsl:variable>
 | 
|---|
 | 225 |   <xsl:variable name="output.delims">
 | 
|---|
 | 226 |     <xsl:call-template name="tex.math.output.delims"/>
 | 
|---|
 | 227 |   </xsl:variable>
 | 
|---|
 | 228 |   <xsl:variable name="tex" select="alt[@role='tex'] | mediaobject/textobject[@role='tex']"/>
 | 
|---|
 | 229 |   <xsl:if test="$tex">
 | 
|---|
 | 230 |     <xsl:text>\special{dvi2bitmap outputfile </xsl:text>
 | 
|---|
 | 231 |     <xsl:value-of select="$filename"/>
 | 
|---|
 | 232 |     <xsl:text>} 
 | 
|---|
 | 233 | </xsl:text>
 | 
|---|
 | 234 |     <xsl:if test="$output.delims != 0">
 | 
|---|
 | 235 |       <xsl:text>$$</xsl:text>
 | 
|---|
 | 236 |     </xsl:if>
 | 
|---|
 | 237 |     <xsl:value-of select="$tex"/>
 | 
|---|
 | 238 |     <xsl:if test="$output.delims != 0">
 | 
|---|
 | 239 |       <xsl:text>$$ 
 | 
|---|
 | 240 | </xsl:text>
 | 
|---|
 | 241 |     </xsl:if>
 | 
|---|
 | 242 |     <xsl:text>\newpage 
 | 
|---|
 | 243 | </xsl:text>
 | 
|---|
 | 244 |   </xsl:if>
 | 
|---|
 | 245 | </xsl:template>
 | 
|---|
 | 246 | 
 | 
|---|
 | 247 | <xsl:template match="text()" mode="collect.tex.math.latex"/>
 | 
|---|
 | 248 | 
 | 
|---|
 | 249 | <!-- Extracting image filename from mediaobject and graphic elements -->
 | 
|---|
 | 250 | 
 | 
|---|
 | 251 | <xsl:template name="select.mediaobject.filename">
 | 
|---|
 | 252 |   <xsl:param name="olist" select="imageobject|imageobjectco                      |videoobject|audioobject|textobject"/>
 | 
|---|
 | 253 | 
 | 
|---|
 | 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"/>
 | 
|---|
 | 258 |     </xsl:call-template>
 | 
|---|
 | 259 |   </xsl:variable>
 | 
|---|
 | 260 | 
 | 
|---|
 | 261 |   <xsl:if test="$mediaobject.index != ''">
 | 
|---|
 | 262 |     <xsl:call-template name="mediaobject.filename">
 | 
|---|
 | 263 |       <xsl:with-param name="object" select="$olist[position() = $mediaobject.index]"/>
 | 
|---|
 | 264 |     </xsl:call-template>
 | 
|---|
 | 265 |   </xsl:if>
 | 
|---|
 | 266 | </xsl:template>
 | 
|---|
 | 267 | 
 | 
|---|
 | 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::*"/>
 | 
|---|
 | 272 |     </xsl:call-template>
 | 
|---|
 | 273 |   </xsl:variable>
 | 
|---|
 | 274 |   <xsl:variable name="result">
 | 
|---|
 | 275 |     <xsl:choose>
 | 
|---|
 | 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>
 | 
|---|
 | 279 |     </xsl:choose>
 | 
|---|
 | 280 |   </xsl:variable>
 | 
|---|
 | 281 |   <xsl:value-of select="$result"/>
 | 
|---|
 | 282 | </xsl:template>
 | 
|---|
 | 283 | 
 | 
|---|
 | 284 | </xsl:stylesheet>
 | 
|---|