~todd-deshane/openstack-manuals/working

« back to all changes in this revision

Viewing changes to doc/build/docbook-xsl-1.76.1/fo/math.xsl

  • Committer: Anne Gentle
  • Date: 2011-04-04 17:54:52 UTC
  • Revision ID: anne@openstack.org-20110404175452-gtth3hfrniqhpp5o
Switching from Ant builds to Maven, still working out kinks but should be functional

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?xml version='1.0'?>
2
 
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3
 
                xmlns:fo="http://www.w3.org/1999/XSL/Format"
4
 
                xmlns:mml="http://www.w3.org/1998/Math/MathML"
5
 
                exclude-result-prefixes="mml"
6
 
                version='1.0'>
7
 
 
8
 
<!-- ********************************************************************
9
 
     $Id: math.xsl 7503 2007-10-08 01:57:30Z xmldoc $
10
 
     ********************************************************************
11
 
 
12
 
     This file is part of the XSL DocBook Stylesheet distribution.
13
 
     See ../README or http://docbook.sf.net/release/xsl/current/ for
14
 
     copyright and other information.
15
 
 
16
 
     ******************************************************************** -->
17
 
 
18
 
<xsl:template match="inlineequation">
19
 
  <xsl:choose>
20
 
    <xsl:when test="$passivetex.extensions != 0 and $tex.math.in.alt != ''">
21
 
      <xsl:apply-templates select="alt[@role='tex'] | inlinemediaobject/textobject[@role='tex']">
22
 
        <xsl:with-param name="output.delims">
23
 
          <xsl:call-template name="tex.math.output.delims"/>
24
 
        </xsl:with-param>
25
 
      </xsl:apply-templates>
26
 
    </xsl:when>
27
 
    <xsl:otherwise>
28
 
      <xsl:apply-templates/>
29
 
    </xsl:otherwise>
30
 
  </xsl:choose>
31
 
</xsl:template>
32
 
 
33
 
<xsl:template match="alt">
34
 
</xsl:template>
35
 
 
36
 
<xsl:template match="mathphrase">
37
 
  <fo:inline>
38
 
    <xsl:apply-templates/>
39
 
  </fo:inline>
40
 
</xsl:template>
41
 
 
42
 
<!-- "Support" for MathML -->
43
 
 
44
 
<xsl:template match="mml:math" xmlns:mml="http://www.w3.org/1998/Math/MathML">
45
 
  <xsl:choose>
46
 
    <!-- * If user is using passivetex, we don't wrap the output in -->
47
 
    <!-- * fo:instream-foreign-object (which passivetex doesn't support). -->
48
 
    <xsl:when test="not($passivetex.extensions = 0)">
49
 
      <xsl:copy>
50
 
        <xsl:copy-of select="@*"/>
51
 
        <xsl:apply-templates/>
52
 
      </xsl:copy>
53
 
    </xsl:when>
54
 
    <xsl:otherwise>
55
 
      <fo:instream-foreign-object>
56
 
        <xsl:copy>
57
 
          <xsl:copy-of select="@*"/>
58
 
          <xsl:apply-templates/>
59
 
        </xsl:copy>
60
 
      </fo:instream-foreign-object>
61
 
    </xsl:otherwise>
62
 
  </xsl:choose>
63
 
</xsl:template>
64
 
 
65
 
<xsl:template match="mml:*" xmlns:mml="http://www.w3.org/1998/Math/MathML">
66
 
  <xsl:copy>
67
 
    <xsl:copy-of select="@*"/>
68
 
    <xsl:apply-templates/>
69
 
  </xsl:copy>
70
 
</xsl:template>
71
 
 
72
 
<xsl:template match="equation/graphic | informalequation/graphic">
73
 
  <xsl:if test="$passivetex.extensions = 0 or $tex.math.in.alt = ''">
74
 
    <fo:block>
75
 
      <xsl:call-template name="process.image"/>
76
 
    </fo:block>
77
 
  </xsl:if>
78
 
</xsl:template>
79
 
 
80
 
<xsl:template match="inlineequation/alt[@role='tex'] | 
81
 
                     inlineequation/inlinemediaobject/textobject[@role='tex']" priority="1">
82
 
  <xsl:param name="output.delims" select="1"/>
83
 
  <xsl:if test="$passivetex.extensions != 0 and $tex.math.in.alt != ''">
84
 
    <xsl:processing-instruction name="xmltex">
85
 
      <xsl:if test="$output.delims != 0">
86
 
        <xsl:text>$</xsl:text>
87
 
      </xsl:if>
88
 
      <xsl:value-of select="."/>
89
 
      <xsl:if test="$output.delims != 0">
90
 
        <xsl:text>$</xsl:text>
91
 
      </xsl:if>
92
 
    </xsl:processing-instruction>
93
 
  </xsl:if>
94
 
</xsl:template>
95
 
 
96
 
<xsl:template match="equation/alt[@role='tex'] | informalequation/alt[@role='tex'] |
97
 
                     equation/mediaobject/textobject[@role='tex'] |
98
 
                     informalequation/mediaobject/textobject[@role='tex']" priority="1">
99
 
  <xsl:variable name="output.delims">
100
 
    <xsl:call-template name="tex.math.output.delims"/>
101
 
  </xsl:variable>
102
 
  <xsl:if test="$passivetex.extensions != 0 and $tex.math.in.alt != ''">
103
 
    <xsl:processing-instruction name="xmltex">
104
 
      <xsl:if test="$output.delims != 0">
105
 
        <xsl:text>$$</xsl:text>
106
 
      </xsl:if>
107
 
      <xsl:value-of select="."/>
108
 
      <xsl:if test="$output.delims != 0">
109
 
        <xsl:text>$$</xsl:text>
110
 
      </xsl:if>
111
 
    </xsl:processing-instruction>
112
 
  </xsl:if>
113
 
</xsl:template>
114
 
 
115
 
<xsl:template match="alt[@role='tex']">
116
 
  <xsl:if test="$passivetex.extensions != 0 and $tex.math.in.alt != ''">
117
 
    <xsl:message>
118
 
      Your equation is misplaced. It should be in inlineequation, equation or informalequation.
119
 
    </xsl:message>
120
 
  </xsl:if>
121
 
</xsl:template>
122
 
 
123
 
<xsl:template name="tex.math.output.delims">
124
 
  <xsl:variable name="pi.delims">
125
 
    <xsl:call-template name="pi-attribute">
126
 
      <xsl:with-param name="pis" select=".//processing-instruction('dbtex')"/>
127
 
      <xsl:with-param name="attribute" select="'delims'"/>
128
 
    </xsl:call-template>
129
 
  </xsl:variable>
130
 
  <xsl:variable name="result">
131
 
    <xsl:choose>
132
 
      <xsl:when test="$pi.delims = 'no'">0</xsl:when>
133
 
      <xsl:when test="$pi.delims = '' and $tex.math.delims = 0">0</xsl:when>
134
 
      <xsl:otherwise>1</xsl:otherwise>
135
 
    </xsl:choose>
136
 
  </xsl:variable>
137
 
  <xsl:value-of select="$result"/>
138
 
</xsl:template>
139
 
 
140
 
</xsl:stylesheet>