trying to get HEAD building again. If you want the code
[abartlet/samba.git/.git] / docs / docbook / xslt / db2latex / formal.mod.xsl
1 <?xml version='1.0'?>
2 <!--############################################################################# 
3 |- #############################################################################
4 |                                                                                                               
5 |   PURPOSE:
6 + ############################################################################## -->
7 <xsl:stylesheet 
8     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
9     xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
10     exclude-result-prefixes="doc" version='1.0'>
11
12
13
14     <!--############################################################################# -->
15     <!-- DOCUMENTATION                                                                -->
16     <doc:reference id="formal" xmlns="">
17         <referenceinfo>
18             <releaseinfo role="meta">
19             </releaseinfo>
20         <authorgroup>
21             <author> <firstname>Ramon</firstname> <surname>Casellas</surname> </author>
22             <author> <firstname>James</firstname> <surname>Devenish</surname> </author>
23         </authorgroup>
24             <copyright>
25                 <year>2000</year> <year>2001</year> <year>2002</year> <year>2003</year>
26                 <holder>Ramon Casellas</holder>
27             </copyright>
28         </referenceinfo>
29
30         <title>Formal Objects <filename>formal.mod.xsl</filename></title>
31         <partintro>
32             <section><title>Introduction</title>
33                 <para></para>
34             </section>
35         </partintro>
36     </doc:reference>
37
38
39
40
41     <xsl:template name="formal.object">
42         <xsl:call-template name="formal.object.heading">
43             <xsl:with-param name="title"><xsl:apply-templates select="." mode="title.ref"/></xsl:with-param>
44         </xsl:call-template>
45         <xsl:apply-templates/>
46     </xsl:template>
47
48     <xsl:template name="formal.object.heading">
49         <xsl:param name="title"></xsl:param>
50         <xsl:call-template name="label.id"/>
51         <xsl:copy-of select="$title"/>
52     </xsl:template>
53
54     <xsl:template name="informal.object">
55         <xsl:call-template name="label.id"/>
56         <xsl:apply-templates/>
57     </xsl:template>
58
59     <xsl:template name="semiformal.object">
60         <xsl:choose>
61             <xsl:when test="title">     <xsl:call-template name="formal.object"/>       </xsl:when>
62             <xsl:otherwise> <xsl:call-template name="informal.object"/></xsl:otherwise>
63         </xsl:choose>
64     </xsl:template>
65
66
67         <xsl:template name="generate.formal.title.placement">
68                 <xsl:param name="object" select="figure" />
69                 <xsl:variable name="param.placement" select="substring-after(normalize-space($formal.title.placement),concat($object, ' '))"/>
70                 <xsl:choose>
71                         <xsl:when test="contains($param.placement, ' ')">
72                                 <xsl:value-of select="substring-before($param.placement, ' ')"/>
73                         </xsl:when>
74                         <xsl:when test="$param.placement = ''">before</xsl:when>
75                         <xsl:otherwise>
76                                 <xsl:value-of select="$param.placement"/>
77                         </xsl:otherwise>
78                 </xsl:choose>
79         </xsl:template>
80
81
82
83
84 <!-- ========================================  -->
85 <!-- XSL Template for DocBook Equation Element -->
86 <!-- 2003/07/04 Applied patches from J.Pavlovic -->
87 <!-- ========================================  -->
88 <xsl:template match="equation">
89 <!-- Equation title placement -->
90 <xsl:variable name="placement">
91         <xsl:call-template name="generate.formal.title.placement">
92                 <xsl:with-param name="object" select="local-name(.)" />
93         </xsl:call-template>
94 </xsl:variable>
95 <!-- Equation caption -->
96 <xsl:variable name="caption">
97         <xsl:text>\caption{</xsl:text>
98         <xsl:apply-templates select="title" mode="caption.mode"/>
99         <xsl:text>}&#10;</xsl:text>
100 </xsl:variable>
101 <xsl:call-template name="map.begin"/>
102 <xsl:if test="$placement='before'">
103         <xsl:text>\captionswapskip{}</xsl:text>
104         <xsl:value-of select="$caption" />
105         <xsl:text>\captionswapskip{}</xsl:text>
106 </xsl:if>
107 <xsl:choose>
108         <xsl:when test="informalequation">
109                 <xsl:apply-templates select="informalequation"/>
110         </xsl:when>
111         <xsl:otherwise>
112                 <xsl:variable name="tex" select="alt[@role='tex' or @role='latex']|mediaobject/textobject[@role='tex' or @role='latex']|mediaobject/textobject/phrase[@role='tex' or @role='latex']"/>
113                 <xsl:choose>
114                         <xsl:when test="$tex">
115                                 <xsl:apply-templates select="$tex"/>
116                         </xsl:when>
117                         <xsl:when test="alt and $latex.alt.is.preferred='1'">
118                                 <xsl:apply-templates select="alt"/>
119                         </xsl:when>
120                         <xsl:when test="mediaobject">
121                                 <xsl:apply-templates select="mediaobject"/>
122                         </xsl:when>
123                         <xsl:when test="alt">
124                                 <xsl:apply-templates select="alt"/>
125                         </xsl:when>
126                         <xsl:otherwise>
127                                 <xsl:apply-templates select="graphic"/>
128                         </xsl:otherwise>
129                 </xsl:choose>
130         </xsl:otherwise>
131 </xsl:choose>
132 <xsl:if test="$placement!='before'"><xsl:value-of select="$caption" /></xsl:if>
133 <xsl:call-template name="map.end"/>
134 </xsl:template>
135
136
137 <xsl:template match="equation/title"/>
138
139
140
141
142
143 <xsl:template match="informalequation">
144 <xsl:variable name="tex" select="alt[@role='tex' or @role='latex']|mediaobject/textobject[@role='tex' or @role='latex']|mediaobject/textobject/phrase[@role='tex' or @role='latex']"/>
145 <xsl:text>&#10;</xsl:text>
146 <xsl:choose>
147         <xsl:when test="$tex">
148                 <xsl:apply-templates select="$tex"/>
149         </xsl:when>
150         <xsl:when test="alt and $latex.alt.is.preferred='1'">
151                 <xsl:apply-templates select="alt"/>
152         </xsl:when>
153         <xsl:when test="mediaobject">
154                 <xsl:apply-templates select="mediaobject"/>
155         </xsl:when>
156         <xsl:when test="alt">
157                 <xsl:apply-templates select="alt"/>
158         </xsl:when>
159         <xsl:otherwise>
160                 <xsl:apply-templates select="graphic"/>
161         </xsl:otherwise>
162 </xsl:choose>
163 <xsl:text>&#10;&#10;</xsl:text>
164 </xsl:template>
165
166
167
168
169
170
171
172
173 </xsl:stylesheet>