source: stylesheets/lfs-xsl/docbook-xsl-1.78.1/html/formal.xsl@ 15c7d39

10.0 10.0-rc1 10.1 10.1-rc1 11.0 11.0-rc1 11.0-rc2 11.0-rc3 11.1 11.1-rc1 11.2 11.2-rc1 11.3 11.3-rc1 12.0 12.0-rc1 12.1 12.1-rc1 7.5 7.6 7.7 7.8 7.9 8.0 8.1 8.2 8.3 8.4 9.0 9.1 arm bdubbs/gcc13 ml-11.0 multilib renodr/libudev-from-systemd s6-init trunk xry111/arm64 xry111/arm64-12.0 xry111/clfs-ng xry111/lfs-next xry111/loongarch xry111/loongarch-12.0 xry111/loongarch-12.1 xry111/mips64el xry111/pip3 xry111/rust-wip-20221008 xry111/update-glibc
Last change on this file since 15c7d39 was 15c7d39, checked in by Matthew Burgess <matthew@…>, 11 years ago

Update stylesheets to docbook-xsl-1.78.1.

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@10355 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

  • Property mode set to 100644
File size: 16.1 KB
Line 
1<?xml version='1.0'?>
2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 version='1.0'>
4
5<!-- ********************************************************************
6 $Id: formal.xsl 9501 2012-07-16 00:14:50Z bobstayton $
7 ********************************************************************
8
9 This file is part of the XSL DocBook Stylesheet distribution.
10 See ../README or http://docbook.sf.net/release/xsl/current/ for
11 copyright and other information.
12
13 ******************************************************************** -->
14
15<xsl:param name="formal.object.break.after">1</xsl:param>
16
17<xsl:template name="formal.object">
18 <xsl:param name="placement" select="'before'"/>
19 <xsl:param name="class">
20 <xsl:apply-templates select="." mode="class.value"/>
21 </xsl:param>
22
23 <xsl:call-template name="id.warning"/>
24
25 <xsl:variable name="content">
26 <div class="{$class}">
27 <xsl:call-template name="id.attribute">
28 <xsl:with-param name="conditional" select="0"/>
29 </xsl:call-template>
30 <xsl:call-template name="anchor">
31 <xsl:with-param name="conditional" select="0"/>
32 </xsl:call-template>
33
34 <xsl:choose>
35 <xsl:when test="$placement = 'before'">
36 <xsl:call-template name="formal.object.heading"/>
37 <div class="{$class}-contents">
38 <xsl:apply-templates/>
39 </div>
40 <!-- HACK: This doesn't belong inside formal.object; it
41 should be done by the table template, but I want
42 the link to be inside the DIV, so... -->
43 <xsl:if test="local-name(.) = 'table'">
44 <xsl:call-template name="table.longdesc"/>
45 </xsl:if>
46
47 <xsl:if test="$spacing.paras != 0"><p/></xsl:if>
48 </xsl:when>
49 <xsl:otherwise>
50 <xsl:if test="$spacing.paras != 0"><p/></xsl:if>
51 <div class="{$class}-contents"><xsl:apply-templates/></div>
52 <!-- HACK: This doesn't belong inside formal.object; it
53 should be done by the table template, but I want
54 the link to be inside the DIV, so... -->
55 <xsl:if test="local-name(.) = 'table'">
56 <xsl:call-template name="table.longdesc"/>
57 </xsl:if>
58
59 <xsl:call-template name="formal.object.heading"/>
60 </xsl:otherwise>
61 </xsl:choose>
62 </div>
63 <xsl:if test="not($formal.object.break.after = '0')">
64 <br class="{$class}-break"/>
65 </xsl:if>
66 </xsl:variable>
67
68 <xsl:variable name="floatstyle">
69 <xsl:call-template name="floatstyle"/>
70 </xsl:variable>
71
72 <xsl:choose>
73 <xsl:when test="$floatstyle != ''">
74 <xsl:call-template name="floater">
75 <xsl:with-param name="class"><xsl:value-of
76 select="$class"/>-float</xsl:with-param>
77 <xsl:with-param name="floatstyle" select="$floatstyle"/>
78 <xsl:with-param name="content" select="$content"/>
79 </xsl:call-template>
80 </xsl:when>
81 <xsl:otherwise>
82 <xsl:copy-of select="$content"/>
83 </xsl:otherwise>
84 </xsl:choose>
85
86</xsl:template>
87
88<xsl:template name="formal.object.heading">
89 <xsl:param name="object" select="."/>
90 <xsl:param name="title">
91 <xsl:apply-templates select="$object" mode="object.title.markup">
92 <xsl:with-param name="allow-anchors" select="1"/>
93 </xsl:apply-templates>
94 </xsl:param>
95
96
97 <xsl:choose>
98 <xsl:when test="$make.clean.html != 0">
99 <xsl:variable name="html.class" select="concat(local-name($object),'-title')"/>
100 <div class="{$html.class}">
101 <xsl:copy-of select="$title"/>
102 </div>
103 </xsl:when>
104 <xsl:otherwise>
105 <p class="title">
106 <b>
107 <xsl:copy-of select="$title"/>
108 </b>
109 </p>
110 </xsl:otherwise>
111 </xsl:choose>
112</xsl:template>
113
114<xsl:template name="informal.object">
115 <xsl:param name="class">
116 <xsl:apply-templates select="." mode="class.value"/>
117 </xsl:param>
118
119 <xsl:variable name="content">
120 <div class="{$class}">
121 <xsl:call-template name="id.attribute"/>
122 <xsl:if test="$spacing.paras != 0"><p/></xsl:if>
123 <xsl:call-template name="anchor"/>
124 <xsl:apply-templates/>
125
126 <!-- HACK: This doesn't belong inside formal.object; it
127 should be done by the table template, but I want
128 the link to be inside the DIV, so... -->
129 <xsl:if test="local-name(.) = 'informaltable'">
130 <xsl:call-template name="table.longdesc"/>
131 </xsl:if>
132
133 <xsl:if test="$spacing.paras != 0"><p/></xsl:if>
134 </div>
135 </xsl:variable>
136
137 <xsl:variable name="floatstyle">
138 <xsl:call-template name="floatstyle"/>
139 </xsl:variable>
140
141 <xsl:choose>
142 <xsl:when test="$floatstyle != ''">
143 <xsl:call-template name="floater">
144 <xsl:with-param name="class"><xsl:value-of
145 select="$class"/>-float</xsl:with-param>
146 <xsl:with-param name="floatstyle" select="$floatstyle"/>
147 <xsl:with-param name="content" select="$content"/>
148 </xsl:call-template>
149 </xsl:when>
150 <xsl:otherwise>
151 <xsl:copy-of select="$content"/>
152 </xsl:otherwise>
153 </xsl:choose>
154
155</xsl:template>
156
157<xsl:template name="semiformal.object">
158 <xsl:param name="placement" select="'before'"/>
159 <xsl:param name="class" select="local-name(.)"/>
160
161 <xsl:choose>
162 <xsl:when test="title or info/title">
163 <xsl:call-template name="formal.object">
164 <xsl:with-param name="placement" select="$placement"/>
165 <xsl:with-param name="class" select="$class"/>
166 </xsl:call-template>
167 </xsl:when>
168 <xsl:otherwise>
169 <xsl:call-template name="informal.object">
170 <xsl:with-param name="class" select="$class"/>
171 </xsl:call-template>
172 </xsl:otherwise>
173 </xsl:choose>
174</xsl:template>
175
176<xsl:template match="figure">
177 <xsl:variable name="param.placement"
178 select="substring-after(normalize-space($formal.title.placement),
179 concat(local-name(.), ' '))"/>
180
181 <xsl:variable name="placement">
182 <xsl:choose>
183 <xsl:when test="contains($param.placement, ' ')">
184 <xsl:value-of select="substring-before($param.placement, ' ')"/>
185 </xsl:when>
186 <xsl:when test="$param.placement = ''">before</xsl:when>
187 <xsl:otherwise>
188 <xsl:value-of select="$param.placement"/>
189 </xsl:otherwise>
190 </xsl:choose>
191 </xsl:variable>
192
193 <xsl:call-template name="formal.object">
194 <xsl:with-param name="placement" select="$placement"/>
195 </xsl:call-template>
196
197</xsl:template>
198
199<xsl:template match="table">
200 <xsl:choose>
201 <xsl:when test="tgroup|mediaobject|graphic">
202 <xsl:call-template name="calsTable"/>
203 </xsl:when>
204 <xsl:when test="caption">
205 <xsl:call-template name="htmlTable.with.caption"/>
206 </xsl:when>
207 <xsl:otherwise>
208 <!-- do not use xsl:copy because of XHTML's needs -->
209 <div>
210 <xsl:call-template name="generate.class.attribute"/>
211 <xsl:call-template name="id.attribute"/>
212 <xsl:call-template name="anchor"/>
213 <xsl:element name="table" namespace="">
214 <xsl:apply-templates select="@*" mode="htmlTableAtt"/>
215 <xsl:call-template name="htmlTable"/>
216 </xsl:element>
217 </div>
218 </xsl:otherwise>
219 </xsl:choose>
220</xsl:template>
221
222<!-- Handle html markup table like formal.object -->
223<xsl:template name="htmlTable.with.caption">
224 <xsl:param name="class">
225 <xsl:apply-templates select="." mode="class.value"/>
226 </xsl:param>
227
228 <xsl:variable name="param.placement"
229 select="substring-after(normalize-space($formal.title.placement),
230 concat(local-name(.), ' '))"/>
231
232 <xsl:variable name="placement">
233 <xsl:choose>
234 <xsl:when test="contains($param.placement, ' ')">
235 <xsl:value-of select="substring-before($param.placement, ' ')"/>
236 </xsl:when>
237 <xsl:when test="$param.placement = ''">before</xsl:when>
238 <xsl:otherwise>
239 <xsl:value-of select="$param.placement"/>
240 </xsl:otherwise>
241 </xsl:choose>
242 </xsl:variable>
243
244 <xsl:call-template name="id.warning"/>
245
246 <xsl:variable name="content">
247 <div class="{$class}">
248 <xsl:call-template name="id.attribute">
249 <xsl:with-param name="conditional" select="0"/>
250 </xsl:call-template>
251 <xsl:call-template name="anchor">
252 <xsl:with-param name="conditional" select="0"/>
253 </xsl:call-template>
254
255 <xsl:choose>
256 <xsl:when test="$placement = 'before'">
257
258 <xsl:call-template name="formal.object.heading"/>
259
260 <div class="{$class}-contents">
261 <xsl:apply-templates select="." mode="htmlTable"/>
262 </div>
263
264 <xsl:call-template name="table.longdesc"/>
265
266 <xsl:if test="$spacing.paras != 0"><p/></xsl:if>
267 </xsl:when>
268 <xsl:otherwise>
269 <xsl:if test="$spacing.paras != 0"><p/></xsl:if>
270
271 <div class="{$class}-contents">
272 <xsl:apply-templates select="." mode="htmlTable"/>
273 </div>
274
275 <xsl:call-template name="table.longdesc"/>
276
277 <xsl:call-template name="formal.object.heading"/>
278 </xsl:otherwise>
279 </xsl:choose>
280 </div>
281 <xsl:if test="not($formal.object.break.after = '0')">
282 <br class="{$class}-break"/>
283 </xsl:if>
284 </xsl:variable>
285
286 <xsl:variable name="floatstyle">
287 <xsl:call-template name="floatstyle"/>
288 </xsl:variable>
289
290 <xsl:choose>
291 <xsl:when test="$floatstyle != ''">
292 <xsl:call-template name="floater">
293 <xsl:with-param name="class"><xsl:value-of
294 select="$class"/>-float</xsl:with-param>
295 <xsl:with-param name="floatstyle" select="$floatstyle"/>
296 <xsl:with-param name="content" select="$content"/>
297 </xsl:call-template>
298 </xsl:when>
299 <xsl:otherwise>
300 <xsl:copy-of select="$content"/>
301 </xsl:otherwise>
302 </xsl:choose>
303
304</xsl:template>
305
306<xsl:template name="calsTable">
307 <xsl:if test="tgroup/tbody/tr
308 |tgroup/thead/tr
309 |tgroup/tfoot/tr">
310 <xsl:message terminate="yes">Broken table: tr descendent of CALS Table.</xsl:message>
311 </xsl:if>
312
313 <xsl:variable name="param.placement"
314 select="substring-after(normalize-space($formal.title.placement),
315 concat(local-name(.), ' '))"/>
316
317 <xsl:variable name="placement">
318 <xsl:choose>
319 <xsl:when test="contains($param.placement, ' ')">
320 <xsl:value-of select="substring-before($param.placement, ' ')"/>
321 </xsl:when>
322 <xsl:when test="$param.placement = ''">before</xsl:when>
323 <xsl:otherwise>
324 <xsl:value-of select="$param.placement"/>
325 </xsl:otherwise>
326 </xsl:choose>
327 </xsl:variable>
328
329 <xsl:call-template name="formal.object">
330 <xsl:with-param name="placement" select="$placement"/>
331 </xsl:call-template>
332</xsl:template>
333
334<xsl:template match="table|informaltable" mode="class.value">
335 <xsl:choose>
336 <xsl:when test="@tabstyle">
337 <xsl:value-of select="@tabstyle"/>
338 </xsl:when>
339 <xsl:otherwise>
340 <xsl:value-of select="local-name(.)"/>
341 </xsl:otherwise>
342 </xsl:choose>
343</xsl:template>
344
345<xsl:template name="htmlTable">
346 <xsl:if test="tgroup/tbody/row
347 |tgroup/thead/row
348 |tgroup/tfoot/row">
349 <xsl:message terminate="yes">Broken table: row descendent of HTML table.</xsl:message>
350 </xsl:if>
351
352 <xsl:apply-templates mode="htmlTable"/>
353
354 <xsl:if test=".//footnote|../title//footnote">
355 <tbody class="footnotes">
356 <tr>
357 <td colspan="50">
358 <xsl:apply-templates select=".//footnote|../title//footnote" mode="table.footnote.mode"/>
359 </td>
360 </tr>
361 </tbody>
362 </xsl:if>
363</xsl:template>
364
365<xsl:template match="example">
366 <xsl:variable name="param.placement"
367 select="substring-after(normalize-space($formal.title.placement),
368 concat(local-name(.), ' '))"/>
369
370 <xsl:variable name="placement">
371 <xsl:choose>
372 <xsl:when test="contains($param.placement, ' ')">
373 <xsl:value-of select="substring-before($param.placement, ' ')"/>
374 </xsl:when>
375 <xsl:when test="$param.placement = ''">before</xsl:when>
376 <xsl:otherwise>
377 <xsl:value-of select="$param.placement"/>
378 </xsl:otherwise>
379 </xsl:choose>
380 </xsl:variable>
381
382 <xsl:call-template name="formal.object">
383 <xsl:with-param name="placement" select="$placement"/>
384 </xsl:call-template>
385
386</xsl:template>
387
388<xsl:template match="equation">
389 <xsl:variable name="param.placement"
390 select="substring-after(normalize-space($formal.title.placement),
391 concat(local-name(.), ' '))"/>
392
393 <xsl:variable name="placement">
394 <xsl:choose>
395 <xsl:when test="contains($param.placement, ' ')">
396 <xsl:value-of select="substring-before($param.placement, ' ')"/>
397 </xsl:when>
398 <xsl:when test="$param.placement = ''">before</xsl:when>
399 <xsl:otherwise>
400 <xsl:value-of select="$param.placement"/>
401 </xsl:otherwise>
402 </xsl:choose>
403 </xsl:variable>
404
405 <xsl:call-template name="formal.object">
406 <xsl:with-param name="placement" select="$placement"/>
407 </xsl:call-template>
408
409</xsl:template>
410
411<xsl:template match="figure/title"></xsl:template>
412<xsl:template match="figure/titleabbrev"></xsl:template>
413<xsl:template match="table/title"></xsl:template>
414<xsl:template match="table/titleabbrev"></xsl:template>
415<xsl:template match="table/textobject"></xsl:template>
416<xsl:template match="example/title"></xsl:template>
417<xsl:template match="example/titleabbrev"></xsl:template>
418<xsl:template match="equation/title"></xsl:template>
419<xsl:template match="equation/titleabbrev"></xsl:template>
420
421<xsl:template match="informalfigure">
422 <xsl:call-template name="informal.object"/>
423</xsl:template>
424
425<xsl:template match="informalexample">
426 <xsl:call-template name="informal.object"/>
427</xsl:template>
428
429<xsl:template match="informaltable">
430 <xsl:choose>
431 <xsl:when test="tgroup|mediaobject|graphic">
432 <xsl:call-template name="informal.object"/>
433 </xsl:when>
434 <xsl:otherwise>
435 <div>
436 <xsl:call-template name="generate.class.attribute"/>
437 <xsl:call-template name="id.attribute"/>
438 <xsl:call-template name="anchor"/>
439 <xsl:element name="table" namespace="">
440 <xsl:apply-templates select="@*" mode="htmlTableAtt"/>
441 <xsl:call-template name="htmlTable"/>
442 </xsl:element>
443 </div>
444 </xsl:otherwise>
445 </xsl:choose>
446</xsl:template>
447
448<xsl:template match="informaltable/textobject"></xsl:template>
449
450<xsl:template name="table.longdesc">
451 <!-- HACK: This doesn't belong inside formal.objectt; it should be done by -->
452 <!-- the table template, but I want the link to be inside the DIV, so... -->
453 <xsl:variable name="longdesc.uri">
454 <xsl:call-template name="longdesc.uri">
455 <xsl:with-param name="mediaobject" select="."/>
456 </xsl:call-template>
457 </xsl:variable>
458
459 <xsl:variable name="irrelevant">
460 <!-- write.longdesc returns the filename ... -->
461 <xsl:call-template name="write.longdesc">
462 <xsl:with-param name="mediaobject" select="."/>
463 </xsl:call-template>
464 </xsl:variable>
465
466 <xsl:if test="$html.longdesc != 0 and $html.longdesc.link != 0
467 and textobject[not(phrase)]">
468 <xsl:call-template name="longdesc.link">
469 <xsl:with-param name="longdesc.uri" select="$longdesc.uri"/>
470 </xsl:call-template>
471 </xsl:if>
472</xsl:template>
473
474<xsl:template match="informalequation">
475 <xsl:call-template name="informal.object"/>
476</xsl:template>
477
478<xsl:template name="floatstyle">
479 <xsl:if test="(@float and @float != '0') or @floatstyle != ''">
480 <xsl:choose>
481 <xsl:when test="@floatstyle != ''">
482 <xsl:value-of select="@floatstyle"/>
483 </xsl:when>
484 <xsl:when test="@float = '1'">
485 <xsl:value-of select="$default.float.class"/>
486 </xsl:when>
487 <xsl:otherwise>
488 <xsl:value-of select="@float"/>
489 </xsl:otherwise>
490 </xsl:choose>
491 </xsl:if>
492</xsl:template>
493
494<xsl:template name="floater">
495 <xsl:param name="content"/>
496 <xsl:param name="class" select="'float'"/>
497 <xsl:param name="floatstyle" select="'left'"/>
498
499 <div class="{$class}">
500 <xsl:if test="$floatstyle = 'left' or $floatstyle = 'right'">
501 <xsl:attribute name="style">
502 <xsl:text>float: </xsl:text>
503 <xsl:value-of select="$floatstyle"/>
504 <xsl:text>;</xsl:text>
505 </xsl:attribute>
506 </xsl:if>
507 <xsl:copy-of select="$content"/>
508 </div>
509</xsl:template>
510
511</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.