source: trunk/Distribution/XSL/fo/math.xsl@ 2

Last change on this file since 2 was 2, checked in by jkacer, 18 years ago

Added all DocBook Framework stuff:

  • DocBook DTD
  • Transformation software FOP 0.20.5 and Saxon 6
  • XSL styles
  • Rexx scripts

Also added some WarpIN-related stuff for creation of WarpIN installation packages.
This state corresponds to version 1.0.0 from November 2005, just slightly modified to carry versioning information (Rexx scripts).

File size: 4.0 KB
Line 
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 version='1.0'>
6
7<!-- ********************************************************************
8 $Id: math.xsl,v 1.11 2005/04/04 13:34:23 nwalsh Exp $
9 ********************************************************************
10
11 This file is part of the XSL DocBook Stylesheet distribution.
12 See ../README or http://nwalsh.com/docbook/xsl/ for copyright
13 and other information.
14
15 ******************************************************************** -->
16
17<xsl:template match="inlineequation">
18 <xsl:choose>
19 <xsl:when test="$passivetex.extensions != 0 and $tex.math.in.alt != ''">
20 <xsl:apply-templates select="alt[@role='tex'] | inlinemediaobject/textobject[@role='tex']">
21 <xsl:with-param name="output.delims">
22 <xsl:call-template name="tex.math.output.delims"/>
23 </xsl:with-param>
24 </xsl:apply-templates>
25 </xsl:when>
26 <xsl:otherwise>
27 <xsl:apply-templates/>
28 </xsl:otherwise>
29 </xsl:choose>
30</xsl:template>
31
32<xsl:template match="alt">
33</xsl:template>
34
35<xsl:template match="mathphrase">
36 <fo:inline>
37 <xsl:apply-templates/>
38 </fo:inline>
39</xsl:template>
40
41<!-- "Support" for MathML -->
42
43<xsl:template match="mml:*" xmlns:mml="http://www.w3.org/1998/Math/MathML">
44 <xsl:copy>
45 <xsl:copy-of select="@*"/>
46 <xsl:apply-templates/>
47 </xsl:copy>
48</xsl:template>
49
50<xsl:template match="equation/graphic | informalequation/graphic">
51 <xsl:if test="$passivetex.extensions = 0 or $tex.math.in.alt = ''">
52 <fo:block>
53 <xsl:call-template name="process.image"/>
54 </fo:block>
55 </xsl:if>
56</xsl:template>
57
58<xsl:template match="inlineequation/alt[@role='tex'] |
59 inlineequation/inlinemediaobject/textobject[@role='tex']" priority="1">
60 <xsl:param name="output.delims" select="1"/>
61 <xsl:if test="$passivetex.extensions != 0 and $tex.math.in.alt != ''">
62 <xsl:processing-instruction name="xmltex">
63 <xsl:if test="$output.delims != 0">
64 <xsl:text>$</xsl:text>
65 </xsl:if>
66 <xsl:value-of select="."/>
67 <xsl:if test="$output.delims != 0">
68 <xsl:text>$</xsl:text>
69 </xsl:if>
70 </xsl:processing-instruction>
71 </xsl:if>
72</xsl:template>
73
74<xsl:template match="equation/alt[@role='tex'] | informalequation/alt[@role='tex'] |
75 equation/mediaobject/textobject[@role='tex'] |
76 informalequation/mediaobject/textobject[@role='tex']" priority="1">
77 <xsl:variable name="output.delims">
78 <xsl:call-template name="tex.math.output.delims"/>
79 </xsl:variable>
80 <xsl:if test="$passivetex.extensions != 0 and $tex.math.in.alt != ''">
81 <xsl:processing-instruction name="xmltex">
82 <xsl:if test="$output.delims != 0">
83 <xsl:text>$$</xsl:text>
84 </xsl:if>
85 <xsl:value-of select="."/>
86 <xsl:if test="$output.delims != 0">
87 <xsl:text>$$</xsl:text>
88 </xsl:if>
89 </xsl:processing-instruction>
90 </xsl:if>
91</xsl:template>
92
93<xsl:template match="alt[@role='tex']">
94 <xsl:if test="$passivetex.extensions != 0 and $tex.math.in.alt != ''">
95 <xsl:message>
96 Your equation is misplaced. It should be in inlineequation, equation or informalequation.
97 </xsl:message>
98 </xsl:if>
99</xsl:template>
100
101<xsl:template name="tex.math.output.delims">
102 <xsl:variable name="pi.delims">
103 <xsl:call-template name="pi-attribute">
104 <xsl:with-param name="pis" select=".//processing-instruction('dbtex')"/>
105 <xsl:with-param name="attribute" select="'delims'"/>
106 </xsl:call-template>
107 </xsl:variable>
108 <xsl:variable name="result">
109 <xsl:choose>
110 <xsl:when test="$pi.delims = 'no'">0</xsl:when>
111 <xsl:when test="$pi.delims = '' and $tex.math.delims = 0">0</xsl:when>
112 <xsl:otherwise>1</xsl:otherwise>
113 </xsl:choose>
114 </xsl:variable>
115 <xsl:value-of select="$result"/>
116</xsl:template>
117
118</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.