This commit was manufactured by cvs2svn to create branch 'SAMBA_3_0'.
[ira/wip.git] / docs / docbook / xslt / db2latex / texmath.mod.xsl
1 <?xml version='1.0'?>
2 <!--############################################################################# 
3 |       $Id: texmath.mod.xsl,v 1.1 2003/04/30 21:39:49 ab Exp $
4 |- #############################################################################
5 |       $Author: ab $
6 |                                                                                                               
7 |   PURPOSE:
8 + ############################################################################## -->
9
10
11 <xsl:stylesheet 
12     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
13     xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
14     exclude-result-prefixes="doc" version='1.0'>
15
16
17
18     <!--############################################################################# -->
19     <!-- DOCUMENTATION                                                                -->
20     <doc:reference id="texmath" xmlns="">
21         <referenceinfo>
22             <releaseinfo role="meta">
23                 $Id: texmath.mod.xsl,v 1.1 2003/04/30 21:39:49 ab Exp $
24             </releaseinfo>
25         <authorgroup>
26             <author> <firstname>Ramon</firstname> <surname>Casellas</surname> </author>
27             <author> <firstname>James</firstname> <surname>Devenish</surname> </author>
28         </authorgroup>
29             <copyright>
30                 <year>2000</year> <year>2001</year> <year>2002</year> <year>2003</year>
31                 <holder>Ramon Casellas</holder>
32             </copyright>
33         </referenceinfo>
34
35         <title>LaTeX Only Commands <filename>texmath.mod.xsl</filename></title>
36         <partintro>
37             <section><title>Introduction</title>
38                 <para></para>
39             </section>
40         </partintro>
41     </doc:reference>
42
43     <xsl:template match="alt">
44         <xsl:choose>
45                 <xsl:when test="ancestor::inlineequation and (@role='tex' or @role='latex' or $latex.alt.is.latex='1')">
46                         <xsl:text>\ensuremath{</xsl:text>
47                         <xsl:value-of select="."/>
48                         <xsl:text>}</xsl:text>
49                 </xsl:when>
50                 <xsl:when test="ancestor::equation|ancestor::informalequation and (@role='tex' or @role='latex' or $latex.alt.is.latex='1')">
51                         <xsl:text>\begin{displaymath}</xsl:text>
52                         <xsl:call-template name="label.id"/>
53                         <xsl:value-of select="."/>
54                         <xsl:text>\end{displaymath}&#10;</xsl:text>
55                 </xsl:when>
56                 <xsl:when test="$latex.alt.is.latex='1'">
57                         <xsl:value-of select="."/>
58                 </xsl:when>
59                 <xsl:otherwise>
60                         <xsl:apply-templates/>
61                 </xsl:otherwise>
62         </xsl:choose>
63     </xsl:template>
64
65     <xsl:template match="latex|tex">
66         <xsl:value-of select="."/>
67     </xsl:template>
68
69     <xsl:template match="latex[@fileref]">
70         <xsl:text>\input{</xsl:text><xsl:value-of select="@fileref"/><xsl:text>}&#10;</xsl:text>
71     </xsl:template>
72
73     <xsl:template match="tex[@fileref]">
74         <xsl:text>\input{</xsl:text><xsl:value-of select="@fileref"/><xsl:text>}&#10;</xsl:text>
75     </xsl:template>
76
77
78     <xsl:template match="tm[@fileref]">
79         <xsl:text>\input{</xsl:text><xsl:value-of select="@fileref"/><xsl:text>}&#10;</xsl:text>
80     </xsl:template>
81
82     <xsl:template match="tm[@tex]">
83         <xsl:value-of select="@tex"/>
84     </xsl:template>
85
86     <xsl:template match="inlinetm[@fileref]">
87         <xsl:text>\input{</xsl:text><xsl:value-of select="@fileref"/><xsl:text>}&#10;</xsl:text>
88     </xsl:template>
89
90     <xsl:template match="inlinetm[@tex]">
91         <xsl:value-of select="@tex"/>
92     </xsl:template>
93
94
95         <xsl:template match="inlineequation">
96         <xsl:variable name="tex" select="alt[@role='tex' or @role='latex']|inlinemediaobject/textobject[@role='tex' or @role='latex']|inlinemediaobject/textobject/phrase[@role='tex' or @role='latex']" />
97         <xsl:choose>
98                 <xsl:when test="$tex">
99                         <xsl:apply-templates select="$tex"/>
100                 </xsl:when>
101                 <xsl:when test="alt and $latex.alt.is.preferred='1'">
102                         <xsl:apply-templates select="alt"/>
103                 </xsl:when>
104                 <xsl:when test="inlinemediaobject">
105                         <xsl:apply-templates select="inlinemediaobject"/>
106                 </xsl:when>
107                 <xsl:when test="alt">
108                         <xsl:apply-templates select="alt"/>
109                 </xsl:when>
110                 <xsl:otherwise>
111                         <xsl:apply-templates select="graphic"/>
112                 </xsl:otherwise>
113         </xsl:choose>
114         </xsl:template>
115
116
117
118
119
120 </xsl:stylesheet>