source: clfs-embedded/BOOK/stylesheets/lfs-xsl/docbook-xsl-snapshot/xhtml/formal.xsl@ a6966fa

Last change on this file since a6966fa was 00b1e11, checked in by Manuel Canales Esparcia <manuel@…>, 17 years ago

Merged r8226 from new-xsl branch.

  • Property mode set to 100644
File size: 12.6 KB
Line 
1<?xml version="1.0" encoding="ASCII"?>
2<!--This file was created automatically by html2xhtml-->
3<!--from the HTML stylesheets.-->
4<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="1.0">
5
6<!-- ********************************************************************
7 $Id$
8 ********************************************************************
9
10 This file is part of the XSL DocBook Stylesheet distribution.
11 See ../README or http://docbook.sf.net/release/xsl/current/ for
12 copyright and other information.
13
14 ******************************************************************** -->
15
16<xsl:param name="formal.object.break.after">1</xsl:param>
17
18<xsl:template name="formal.object">
19 <xsl:param name="placement" select="'before'"/>
20 <xsl:param name="class">
21 <xsl:apply-templates select="." mode="class.value"/>
22 </xsl:param>
23
24 <xsl:call-template name="id.warning"/>
25
26 <xsl:variable name="content">
27 <div class="{$class}">
28 <xsl:call-template name="anchor">
29 <xsl:with-param name="conditional" select="0"/>
30 </xsl:call-template>
31
32 <xsl:choose>
33 <xsl:when test="$placement = 'before'">
34 <xsl:call-template name="formal.object.heading"/>
35 <div class="{$class}-contents">
36 <xsl:apply-templates/>
37 </div>
38 <!-- HACK: This doesn't belong inside formal.object; it
39 should be done by the table template, but I want
40 the link to be inside the DIV, so... -->
41 <xsl:if test="local-name(.) = 'table'">
42 <xsl:call-template name="table.longdesc"/>
43 </xsl:if>
44
45 <xsl:if test="$spacing.paras != 0"><p/></xsl:if>
46 </xsl:when>
47 <xsl:otherwise>
48 <xsl:if test="$spacing.paras != 0"><p/></xsl:if>
49 <div class="{$class}-contents"><xsl:apply-templates/></div>
50 <!-- HACK: This doesn't belong inside formal.object; it
51 should be done by the table template, but I want
52 the link to be inside the DIV, so... -->
53 <xsl:if test="local-name(.) = 'table'">
54 <xsl:call-template name="table.longdesc"/>
55 </xsl:if>
56
57 <xsl:call-template name="formal.object.heading"/>
58 </xsl:otherwise>
59 </xsl:choose>
60 </div>
61 <xsl:if test="not($formal.object.break.after = '0')">
62 <br class="{$class}-break"/>
63 </xsl:if>
64 </xsl:variable>
65
66 <xsl:variable name="floatstyle">
67 <xsl:call-template name="floatstyle"/>
68 </xsl:variable>
69
70 <xsl:choose>
71 <xsl:when test="$floatstyle != ''">
72 <xsl:call-template name="floater">
73 <xsl:with-param name="class"><xsl:value-of select="$class"/>-float</xsl:with-param>
74 <xsl:with-param name="floatstyle" select="$floatstyle"/>
75 <xsl:with-param name="content" select="$content"/>
76 </xsl:call-template>
77 </xsl:when>
78 <xsl:otherwise>
79 <xsl:copy-of select="$content"/>
80 </xsl:otherwise>
81 </xsl:choose>
82
83</xsl:template>
84
85<xsl:template name="formal.object.heading">
86 <xsl:param name="object" select="."/>
87 <xsl:param name="title">
88 <xsl:apply-templates select="$object" mode="object.title.markup">
89 <xsl:with-param name="allow-anchors" select="1"/>
90 </xsl:apply-templates>
91 </xsl:param>
92
93 <p class="title">
94 <b>
95 <xsl:copy-of select="$title"/>
96 </b>
97 </p>
98</xsl:template>
99
100<xsl:template name="informal.object">
101 <xsl:param name="class" select="local-name(.)"/>
102
103 <xsl:variable name="content">
104 <div class="{$class}">
105 <xsl:if test="$spacing.paras != 0"><p/></xsl:if>
106 <xsl:call-template name="anchor">
107 <xsl:with-param name="conditional" select="0"/>
108 </xsl:call-template>
109 <xsl:apply-templates/>
110
111 <!-- HACK: This doesn't belong inside formal.object; it
112 should be done by the table template, but I want
113 the link to be inside the DIV, so... -->
114 <xsl:if test="local-name(.) = 'informaltable'">
115 <xsl:call-template name="table.longdesc"/>
116 </xsl:if>
117
118 <xsl:if test="$spacing.paras != 0"><p/></xsl:if>
119 </div>
120 </xsl:variable>
121
122 <xsl:variable name="floatstyle">
123 <xsl:call-template name="floatstyle"/>
124 </xsl:variable>
125
126 <xsl:choose>
127 <xsl:when test="$floatstyle != ''">
128 <xsl:call-template name="floater">
129 <xsl:with-param name="class"><xsl:value-of select="$class"/>-float</xsl:with-param>
130 <xsl:with-param name="floatstyle" select="$floatstyle"/>
131 <xsl:with-param name="content" select="$content"/>
132 </xsl:call-template>
133 </xsl:when>
134 <xsl:otherwise>
135 <xsl:copy-of select="$content"/>
136 </xsl:otherwise>
137 </xsl:choose>
138
139</xsl:template>
140
141<xsl:template name="semiformal.object">
142 <xsl:param name="placement" select="'before'"/>
143 <xsl:param name="class" select="local-name(.)"/>
144
145 <xsl:choose>
146 <xsl:when test="title">
147 <xsl:call-template name="formal.object">
148 <xsl:with-param name="placement" select="$placement"/>
149 <xsl:with-param name="class" select="$class"/>
150 </xsl:call-template>
151 </xsl:when>
152 <xsl:otherwise>
153 <xsl:call-template name="informal.object">
154 <xsl:with-param name="class" select="$class"/>
155 </xsl:call-template>
156 </xsl:otherwise>
157 </xsl:choose>
158</xsl:template>
159
160<xsl:template match="figure">
161 <xsl:variable name="param.placement" select="substring-after(normalize-space($formal.title.placement), concat(local-name(.), ' '))"/>
162
163 <xsl:variable name="placement">
164 <xsl:choose>
165 <xsl:when test="contains($param.placement, ' ')">
166 <xsl:value-of select="substring-before($param.placement, ' ')"/>
167 </xsl:when>
168 <xsl:when test="$param.placement = ''">before</xsl:when>
169 <xsl:otherwise>
170 <xsl:value-of select="$param.placement"/>
171 </xsl:otherwise>
172 </xsl:choose>
173 </xsl:variable>
174
175 <xsl:call-template name="formal.object">
176 <xsl:with-param name="placement" select="$placement"/>
177 </xsl:call-template>
178
179</xsl:template>
180
181<xsl:template match="table">
182 <xsl:choose>
183 <xsl:when test="tgroup|mediaobject|graphic">
184 <xsl:call-template name="calsTable"/>
185 </xsl:when>
186 <xsl:otherwise>
187 <xsl:copy>
188 <xsl:copy-of select="@*[not(local-name()='id')]"/>
189 <xsl:attribute name="id">
190 <xsl:call-template name="object.id"/>
191 </xsl:attribute>
192 <xsl:call-template name="htmlTable"/>
193 </xsl:copy>
194 </xsl:otherwise>
195 </xsl:choose>
196</xsl:template>
197
198<xsl:template name="calsTable">
199 <xsl:if test="tgroup/tbody/tr |tgroup/thead/tr |tgroup/tfoot/tr">
200 <xsl:message terminate="yes">Broken table: tr descendent of CALS Table.</xsl:message>
201 </xsl:if>
202
203 <xsl:variable name="param.placement" select="substring-after(normalize-space($formal.title.placement), concat(local-name(.), ' '))"/>
204
205 <xsl:variable name="placement">
206 <xsl:choose>
207 <xsl:when test="contains($param.placement, ' ')">
208 <xsl:value-of select="substring-before($param.placement, ' ')"/>
209 </xsl:when>
210 <xsl:when test="$param.placement = ''">before</xsl:when>
211 <xsl:otherwise>
212 <xsl:value-of select="$param.placement"/>
213 </xsl:otherwise>
214 </xsl:choose>
215 </xsl:variable>
216
217 <xsl:call-template name="formal.object">
218 <xsl:with-param name="placement" select="$placement"/>
219 <xsl:with-param name="class">
220 <xsl:choose>
221 <xsl:when test="@tabstyle">
222 <!-- hack, this will only ever occur on table, not example -->
223 <xsl:value-of select="@tabstyle"/>
224 </xsl:when>
225 <xsl:otherwise>
226 <xsl:value-of select="local-name(.)"/>
227 </xsl:otherwise>
228 </xsl:choose>
229 </xsl:with-param>
230 </xsl:call-template>
231</xsl:template>
232
233<xsl:template name="htmlTable">
234 <xsl:if test="tgroup/tbody/row |tgroup/thead/row |tgroup/tfoot/row">
235 <xsl:message terminate="yes">Broken table: row descendent of HTML table.</xsl:message>
236 </xsl:if>
237
238 <xsl:apply-templates mode="htmlTable"/>
239</xsl:template>
240
241<xsl:template match="example">
242 <xsl:variable name="param.placement" select="substring-after(normalize-space($formal.title.placement), concat(local-name(.), ' '))"/>
243
244 <xsl:variable name="placement">
245 <xsl:choose>
246 <xsl:when test="contains($param.placement, ' ')">
247 <xsl:value-of select="substring-before($param.placement, ' ')"/>
248 </xsl:when>
249 <xsl:when test="$param.placement = ''">before</xsl:when>
250 <xsl:otherwise>
251 <xsl:value-of select="$param.placement"/>
252 </xsl:otherwise>
253 </xsl:choose>
254 </xsl:variable>
255
256 <xsl:call-template name="formal.object">
257 <xsl:with-param name="placement" select="$placement"/>
258 </xsl:call-template>
259
260</xsl:template>
261
262<xsl:template match="equation">
263 <xsl:variable name="param.placement" select="substring-after(normalize-space($formal.title.placement), concat(local-name(.), ' '))"/>
264
265 <xsl:variable name="placement">
266 <xsl:choose>
267 <xsl:when test="contains($param.placement, ' ')">
268 <xsl:value-of select="substring-before($param.placement, ' ')"/>
269 </xsl:when>
270 <xsl:when test="$param.placement = ''">before</xsl:when>
271 <xsl:otherwise>
272 <xsl:value-of select="$param.placement"/>
273 </xsl:otherwise>
274 </xsl:choose>
275 </xsl:variable>
276
277 <xsl:call-template name="formal.object">
278 <xsl:with-param name="placement" select="$placement"/>
279 </xsl:call-template>
280
281</xsl:template>
282
283<xsl:template match="figure/title"/>
284<xsl:template match="figure/titleabbrev"/>
285<xsl:template match="table/title"/>
286<xsl:template match="table/titleabbrev"/>
287<xsl:template match="table/textobject"/>
288<xsl:template match="example/title"/>
289<xsl:template match="example/titleabbrev"/>
290<xsl:template match="equation/title"/>
291<xsl:template match="equation/titleabbrev"/>
292
293<xsl:template match="informalfigure">
294 <xsl:call-template name="informal.object"/>
295</xsl:template>
296
297<xsl:template match="informalexample">
298 <xsl:call-template name="informal.object"/>
299</xsl:template>
300
301<xsl:template match="informaltable">
302 <xsl:choose>
303 <xsl:when test="tgroup|mediaobject|graphic">
304 <xsl:call-template name="informal.object">
305 <xsl:with-param name="class">
306 <xsl:choose>
307 <xsl:when test="@tabstyle">
308 <xsl:value-of select="@tabstyle"/>
309 </xsl:when>
310 <xsl:otherwise>
311 <xsl:value-of select="local-name(.)"/>
312 </xsl:otherwise>
313 </xsl:choose>
314 </xsl:with-param>
315 </xsl:call-template>
316 </xsl:when>
317 <xsl:otherwise>
318 <table>
319 <xsl:copy-of select="@*"/>
320 <xsl:call-template name="htmlTable"/>
321 </table>
322 </xsl:otherwise>
323 </xsl:choose>
324</xsl:template>
325
326<xsl:template match="informaltable/textobject"/>
327
328<xsl:template name="table.longdesc">
329 <!-- HACK: This doesn't belong inside formal.objectt; it should be done by -->
330 <!-- the table template, but I want the link to be inside the DIV, so... -->
331 <xsl:variable name="longdesc.uri">
332 <xsl:call-template name="longdesc.uri">
333 <xsl:with-param name="mediaobject" select="."/>
334 </xsl:call-template>
335 </xsl:variable>
336
337 <xsl:variable name="irrelevant">
338 <!-- write.longdesc returns the filename ... -->
339 <xsl:call-template name="write.longdesc">
340 <xsl:with-param name="mediaobject" select="."/>
341 </xsl:call-template>
342 </xsl:variable>
343
344 <xsl:if test="$html.longdesc != 0 and $html.longdesc.link != 0 and textobject[not(phrase)]">
345 <xsl:call-template name="longdesc.link">
346 <xsl:with-param name="longdesc.uri" select="$longdesc.uri"/>
347 </xsl:call-template>
348 </xsl:if>
349</xsl:template>
350
351<xsl:template match="informalequation">
352 <xsl:call-template name="informal.object"/>
353</xsl:template>
354
355<xsl:template name="floatstyle">
356 <xsl:if test="(@float and @float != '0') or @floatstyle != ''">
357 <xsl:choose>
358 <xsl:when test="@floatstyle != ''">
359 <xsl:value-of select="@floatstyle"/>
360 </xsl:when>
361 <xsl:when test="@float = '1'">
362 <xsl:value-of select="$default.float.class"/>
363 </xsl:when>
364 <xsl:otherwise>
365 <xsl:value-of select="@float"/>
366 </xsl:otherwise>
367 </xsl:choose>
368 </xsl:if>
369</xsl:template>
370
371<xsl:template name="floater">
372 <xsl:param name="content"/>
373 <xsl:param name="class" select="'float'"/>
374 <xsl:param name="floatstyle" select="'left'"/>
375
376 <div class="{$class}">
377 <xsl:if test="$floatstyle = 'left' or $floatstyle = 'right'">
378 <xsl:attribute name="style">
379 <xsl:text>float: </xsl:text>
380 <xsl:value-of select="$floatstyle"/>
381 <xsl:text>;</xsl:text>
382 </xsl:attribute>
383 </xsl:if>
384 <xsl:copy-of select="$content"/>
385 </div>
386</xsl:template>
387
388</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.