123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284 |
- <?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:mml="http://www.w3.org/1998/Math/MathML" xmlns="http://www.w3.org/1999/xhtml" exclude-result-prefixes="mml" version="1.0">
- <!-- ********************************************************************
- $Id$
- ********************************************************************
- This file is part of the XSL DocBook Stylesheet distribution.
- See ../README or http://docbook.sf.net/release/xsl/current/ for
- copyright and other information.
- ******************************************************************** -->
- <xsl:template match="inlineequation">
- <xsl:apply-templates/>
- </xsl:template>
- <xsl:template match="alt">
- </xsl:template>
- <xsl:template match="mathphrase">
- <span>
- <xsl:apply-templates select="." mode="class.attribute"/>
- <xsl:apply-templates/>
- </span>
- </xsl:template>
- <!-- "Support" for MathML -->
- <xsl:template match="mml:*">
- <xsl:copy>
- <xsl:copy-of select="@*"/>
- <xsl:apply-templates/>
- </xsl:copy>
- </xsl:template>
- <!-- Support for TeX math in alt -->
- <xsl:template match="*" mode="collect.tex.math">
- <xsl:call-template name="write.text.chunk">
- <xsl:with-param name="filename" select="$tex.math.file"/>
- <xsl:with-param name="method" select="'text'"/>
- <xsl:with-param name="content">
- <xsl:choose>
- <xsl:when test="$tex.math.in.alt = 'plain'">
- <xsl:call-template name="tex.math.plain.head"/>
- <xsl:apply-templates select="." mode="collect.tex.math.plain"/>
- <xsl:call-template name="tex.math.plain.tail"/>
- </xsl:when>
- <xsl:when test="$tex.math.in.alt = 'latex'">
- <xsl:call-template name="tex.math.latex.head"/>
- <xsl:apply-templates select="." mode="collect.tex.math.latex"/>
- <xsl:call-template name="tex.math.latex.tail"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:message>
- Unsupported TeX math notation:
- <xsl:value-of select="$tex.math.in.alt"/>
- </xsl:message>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:with-param>
- <xsl:with-param name="encoding" select="$chunker.output.encoding"/>
- </xsl:call-template>
- </xsl:template>
- <!-- PlainTeX -->
- <xsl:template name="tex.math.plain.head">
- <xsl:text>\nopagenumbers
- </xsl:text>
- </xsl:template>
- <xsl:template name="tex.math.plain.tail">
- <xsl:text>\bye
- </xsl:text>
- </xsl:template>
- <xsl:template match="inlineequation" mode="collect.tex.math.plain">
- <xsl:variable name="filename">
- <xsl:choose>
- <xsl:when test="graphic">
- <xsl:call-template name="mediaobject.filename">
- <xsl:with-param name="object" select="graphic"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="select.mediaobject.filename">
- <xsl:with-param name="olist" select="inlinemediaobject/*"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="output.delims">
- <xsl:call-template name="tex.math.output.delims"/>
- </xsl:variable>
- <xsl:variable name="tex" select="alt[@role='tex'] | inlinemediaobject/textobject[@role='tex']"/>
- <xsl:if test="$tex">
- <xsl:text>\special{dvi2bitmap outputfile </xsl:text>
- <xsl:value-of select="$filename"/>
- <xsl:text>}
- </xsl:text>
- <xsl:if test="$output.delims != 0">
- <xsl:text>$</xsl:text>
- </xsl:if>
- <xsl:value-of select="$tex"/>
- <xsl:if test="$output.delims != 0">
- <xsl:text>$
- </xsl:text>
- </xsl:if>
- <xsl:text>\vfill\eject
- </xsl:text>
- </xsl:if>
- </xsl:template>
- <xsl:template match="equation|informalequation" mode="collect.tex.math.plain">
- <xsl:variable name="filename">
- <xsl:choose>
- <xsl:when test="graphic">
- <xsl:call-template name="mediaobject.filename">
- <xsl:with-param name="object" select="graphic"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="select.mediaobject.filename">
- <xsl:with-param name="olist" select="mediaobject/*"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="output.delims">
- <xsl:call-template name="tex.math.output.delims"/>
- </xsl:variable>
- <xsl:variable name="tex" select="alt[@role='tex'] | mediaobject/textobject[@role='tex']"/>
- <xsl:if test="$tex">
- <xsl:text>\special{dvi2bitmap outputfile </xsl:text>
- <xsl:value-of select="$filename"/>
- <xsl:text>}
- </xsl:text>
- <xsl:if test="$output.delims != 0">
- <xsl:text>$$</xsl:text>
- </xsl:if>
- <xsl:value-of select="$tex"/>
- <xsl:if test="$output.delims != 0">
- <xsl:text>$$
- </xsl:text>
- </xsl:if>
- <xsl:text>\vfill\eject
- </xsl:text>
- </xsl:if>
- </xsl:template>
- <xsl:template match="text()" mode="collect.tex.math.plain"/>
- <!-- LaTeX -->
- <xsl:template name="tex.math.latex.head">
- <xsl:text>\documentclass{article}
- </xsl:text>
- <xsl:text>\pagestyle{empty}
- </xsl:text>
- <xsl:text>\begin{document}
- </xsl:text>
- </xsl:template>
- <xsl:template name="tex.math.latex.tail">
- <xsl:text>\end{document}
- </xsl:text>
- </xsl:template>
- <xsl:template match="inlineequation" mode="collect.tex.math.latex">
- <xsl:variable name="filename">
- <xsl:choose>
- <xsl:when test="graphic">
- <xsl:call-template name="mediaobject.filename">
- <xsl:with-param name="object" select="graphic"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="select.mediaobject.filename">
- <xsl:with-param name="olist" select="inlinemediaobject/*"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="output.delims">
- <xsl:call-template name="tex.math.output.delims"/>
- </xsl:variable>
- <xsl:variable name="tex" select="alt[@role='tex'] | inlinemediaobject/textobject[@role='tex']"/>
- <xsl:if test="$tex">
- <xsl:text>\special{dvi2bitmap outputfile </xsl:text>
- <xsl:value-of select="$filename"/>
- <xsl:text>}
- </xsl:text>
- <xsl:if test="$output.delims != 0">
- <xsl:text>$</xsl:text>
- </xsl:if>
- <xsl:value-of select="$tex"/>
- <xsl:if test="$output.delims != 0">
- <xsl:text>$
- </xsl:text>
- </xsl:if>
- <xsl:text>\newpage
- </xsl:text>
- </xsl:if>
- </xsl:template>
- <xsl:template match="equation|informalequation" mode="collect.tex.math.latex">
- <xsl:variable name="filename">
- <xsl:choose>
- <xsl:when test="graphic">
- <xsl:call-template name="mediaobject.filename">
- <xsl:with-param name="object" select="graphic"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="select.mediaobject.filename">
- <xsl:with-param name="olist" select="mediaobject/*"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="output.delims">
- <xsl:call-template name="tex.math.output.delims"/>
- </xsl:variable>
- <xsl:variable name="tex" select="alt[@role='tex'] | mediaobject/textobject[@role='tex']"/>
- <xsl:if test="$tex">
- <xsl:text>\special{dvi2bitmap outputfile </xsl:text>
- <xsl:value-of select="$filename"/>
- <xsl:text>}
- </xsl:text>
- <xsl:if test="$output.delims != 0">
- <xsl:text>$$</xsl:text>
- </xsl:if>
- <xsl:value-of select="$tex"/>
- <xsl:if test="$output.delims != 0">
- <xsl:text>$$
- </xsl:text>
- </xsl:if>
- <xsl:text>\newpage
- </xsl:text>
- </xsl:if>
- </xsl:template>
- <xsl:template match="text()" mode="collect.tex.math.latex"/>
- <!-- Extracting image filename from mediaobject and graphic elements -->
- <xsl:template name="select.mediaobject.filename">
- <xsl:param name="olist" select="imageobject|imageobjectco |videoobject|audioobject|textobject"/>
- <xsl:variable name="mediaobject.index">
- <xsl:call-template name="select.mediaobject.index">
- <xsl:with-param name="olist" select="$olist"/>
- <xsl:with-param name="count" select="1"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:if test="$mediaobject.index != ''">
- <xsl:call-template name="mediaobject.filename">
- <xsl:with-param name="object" select="$olist[position() = $mediaobject.index]"/>
- </xsl:call-template>
- </xsl:if>
- </xsl:template>
- <xsl:template name="tex.math.output.delims">
- <xsl:variable name="pi.delims">
- <xsl:call-template name="pi.dbtex_delims">
- <xsl:with-param name="node" select="descendant-or-self::*"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="result">
- <xsl:choose>
- <xsl:when test="$pi.delims = 'no'">0</xsl:when>
- <xsl:when test="$pi.delims = '' and $tex.math.delims = 0">0</xsl:when>
- <xsl:otherwise>1</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:value-of select="$result"/>
- </xsl:template>
- </xsl:stylesheet>
|