source: stylesheets/lfs-xsl/docbook-xsl-1.78.1/xhtml/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" 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: formal.xsl 9501 2012-07-16 00:14:50Z bobstayton $
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="id.attribute">
29 <xsl:with-param name="conditional" select="0"/>
30 </xsl:call-template>
31 <xsl:call-template name="anchor">
32 <xsl:with-param name="conditional" select="0"/>
33 </xsl:call-template>
34
35 <xsl:choose>
36 <xsl:when test="$placement = 'before'">
37 <xsl:call-template name="formal.object.heading"/>
38 <div class="{$class}-contents">
39 <xsl:apply-templates/>
40 </div>
41 <!-- HACK: This doesn't belong inside formal.object; it
42 should be done by the table template, but I want
43 the link to be inside the DIV, so... -->
44 <xsl:if test="local-name(.) = 'table'">
45 <xsl:call-template name="table.longdesc"/>
46 </xsl:if>
47
48 <xsl:if test="$spacing.paras != 0"><p/></xsl:if>
49 </xsl:when>
50 <xsl:otherwise>
51 <xsl:if test="$spacing.paras != 0"><p/></xsl:if>
52 <div class="{$class}-contents"><xsl:apply-templates/></div>
53 <!-- HACK: This doesn't belong inside formal.object; it
54 should be done by the table template, but I want
55 the link to be inside the DIV, so... -->
56 <xsl:if test="local-name(.) = 'table'">
57 <xsl:call-template name="table.longdesc"/>
58 </xsl:if>
59
60 <xsl:call-template name="formal.object.heading"/>
61 </xsl:otherwise>
62 </xsl:choose>
63 </div>
64 <xsl:if test="not($formal.object.break.after = '0')">
65 <br class="{$class}-break"/>
66 </xsl:if>
67 </xsl:variable>
68
69 <xsl:variable name="floatstyle">
70 <xsl:call-template name="floatstyle"/>
71 </xsl:variable>
72
73 <xsl:choose>
74 <xsl:when test="$floatstyle != ''">
75 <xsl:call-template name="floater">
76 <xsl:with-param name="class"><xsl:value-of 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 <strong xmlns:xslo="http://www.w3.org/1999/XSL/Transform">
107 <xsl:copy-of select="$title"/>
108 </strong>
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 select="$class"/>-float</xsl:with-param>
145 <xsl:with-param name="floatstyle" select="$floatstyle"/>
146 <xsl:with-param name="content" select="$content"/>
147 </xsl:call-template>
148 </xsl:when>
149 <xsl:otherwise>
150 <xsl:copy-of select="$content"/>
151 </xsl:otherwise>
152 </xsl:choose>
153
154</xsl:template>
155
156<xsl:template name="semiformal.object">
157 <xsl:param name="placement" select="'before'"/>
158 <xsl:param name="class" select="local-name(.)"/>
159
160 <xsl:choose>
161 <xsl:when test="title or info/title">
162 <xsl:call-template name="formal.object">
163 <xsl:with-param name="placement" select="$placement"/>
164 <xsl:with-param name="class" select="$class"/>
165 </xsl:call-template>
166 </xsl:when>
167 <xsl:otherwise>
168 <xsl:call-template name="informal.object">
169 <xsl:with-param name="class" select="$class"/>
170 </xsl:call-template>
171 </xsl:otherwise>
172 </xsl:choose>
173</xsl:template>
174
175<xsl:template match="figure">
176 <xsl:variable name="param.placement" select="substring-after(normalize-space($formal.title.placement), concat(local-name(.), ' '))"/>
177
178 <xsl:variable name="placement">
179 <xsl:choose>
180 <xsl:when test="contains($param.placement, ' ')">
181 <xsl:value-of select="substring-before($param.placement, ' ')"/>
182 </xsl:when>
183 <xsl:when test="$param.placement = ''">before</xsl:when>
184 <xsl:otherwise>
185 <xsl:value-of select="$param.placement"/>
186 </xsl:otherwise>
187 </xsl:choose>
188 </xsl:variable>
189
190 <xsl:call-template name="formal.object">
191 <xsl:with-param name="placement" select="$placement"/>
192 </xsl:call-template>
193
194</xsl:template>
195
196<xsl:template match="table">
197 <xsl:choose>
198 <xsl:when test="tgroup|mediaobject|graphic">
199 <xsl:call-template name="calsTable"/>
200 </xsl:when>
201 <xsl:when test="caption">
202 <xsl:call-template name="htmlTable.with.caption"/>
203 </xsl:when>
204 <xsl:otherwise>
205 <!-- do not use xsl:copy because of XHTML's needs -->
206 <div>
207 <xsl:call-template name="generate.class.attribute"/>
208 <xsl:call-template name="id.attribute"/>
209 <xsl:call-template name="anchor"/>
210 <xsl:element name="table" namespace="http://www.w3.org/1999/xhtml">
211 <xsl:apply-templates select="@*" mode="htmlTableAtt"/>
212 <xsl:call-template name="htmlTable"/>
213 </xsl:element>
214 </div>
215 </xsl:otherwise>
216 </xsl:choose>
217</xsl:template>
218
219<!-- Handle html markup table like formal.object -->
220<xsl:template name="htmlTable.with.caption">
221 <xsl:param name="class">
222 <xsl:apply-templates select="." mode="class.value"/>
223 </xsl:param>
224
225 <xsl:variable name="param.placement" select="substring-after(normalize-space($formal.title.placement), concat(local-name(.), ' '))"/>
226
227 <xsl:variable name="placement">
228 <xsl:choose>
229 <xsl:when test="contains($param.placement, ' ')">
230 <xsl:value-of select="substring-before($param.placement, ' ')"/>
231 </xsl:when>
232 <xsl:when test="$param.placement = ''">before</xsl:when>
233 <xsl:otherwise>
234 <xsl:value-of select="$param.placement"/>
235 </xsl:otherwise>
236 </xsl:choose>
237 </xsl:variable>
238
239 <xsl:call-template name="id.warning"/>
240
241 <xsl:variable name="content">
242 <div class="{$class}">
243 <xsl:call-template name="id.attribute">
244 <xsl:with-param name="conditional" select="0"/>
245 </xsl:call-template>
246 <xsl:call-template name="anchor">
247 <xsl:with-param name="conditional" select="0"/>
248 </xsl:call-template>
249
250 <xsl:choose>
251 <xsl:when test="$placement = 'before'">
252
253 <xsl:call-template name="formal.object.heading"/>
254
255 <div class="{$class}-contents">
256 <xsl:apply-templates select="." mode="htmlTable"/>
257 </div>
258
259 <xsl:call-template name="table.longdesc"/>
260
261 <xsl:if test="$spacing.paras != 0"><p/></xsl:if>
262 </xsl:when>
263 <xsl:otherwise>
264 <xsl:if test="$spacing.paras != 0"><p/></xsl:if>
265
266 <div class="{$class}-contents">
267 <xsl:apply-templates select="." mode="htmlTable"/>
268 </div>
269
270 <xsl:call-template name="table.longdesc"/>
271
272 <xsl:call-template name="formal.object.heading"/>
273 </xsl:otherwise>
274 </xsl:choose>
275 </div>
276 <xsl:if test="not($formal.object.break.after = '0')">
277 <br class="{$class}-break"/>
278 </xsl:if>
279 </xsl:variable>
280
281 <xsl:variable name="floatstyle">
282 <xsl:call-template name="floatstyle"/>
283 </xsl:variable>
284
285 <xsl:choose>
286 <xsl:when test="$floatstyle != ''">
287 <xsl:call-template name="floater">
288 <xsl:with-param name="class"><xsl:value-of select="$class"/>-float</xsl:with-param>
289 <xsl:with-param name="floatstyle" select="$floatstyle"/>
290 <xsl:with-param name="content" select="$content"/>
291 </xsl:call-template>
292 </xsl:when>
293 <xsl:otherwise>
294 <xsl:copy-of select="$content"/>
295 </xsl:otherwise>
296 </xsl:choose>
297
298</xsl:template>
299
300<xsl:template name="calsTable">
301 <xsl:if test="tgroup/tbody/tr |tgroup/thead/tr |tgroup/tfoot/tr">
302 <xsl:message terminate="yes">Broken table: tr descendent of CALS Table.</xsl:message>
303 </xsl:if>
304
305 <xsl:variable name="param.placement" select="substring-after(normalize-space($formal.title.placement), concat(local-name(.), ' '))"/>
306
307 <xsl:variable name="placement">
308 <xsl:choose>
309 <xsl:when test="contains($param.placement, ' ')">
310 <xsl:value-of select="substring-before($param.placement, ' ')"/>
311 </xsl:when>
312 <xsl:when test="$param.placement = ''">before</xsl:when>
313 <xsl:otherwise>
314 <xsl:value-of select="$param.placement"/>
315 </xsl:otherwise>
316 </xsl:choose>
317 </xsl:variable>
318
319 <xsl:call-template name="formal.object">
320 <xsl:with-param name="placement" select="$placement"/>
321 </xsl:call-template>
322</xsl:template>
323
324<xsl:template match="table|informaltable" mode="class.value">
325 <xsl:choose>
326 <xsl:when test="@tabstyle">
327 <xsl:value-of select="@tabstyle"/>
328 </xsl:when>
329 <xsl:otherwise>
330 <xsl:value-of select="local-name(.)"/>
331 </xsl:otherwise>
332 </xsl:choose>
333</xsl:template>
334
335<xsl:template name="htmlTable">
336 <xsl:if test="tgroup/tbody/row |tgroup/thead/row |tgroup/tfoot/row">
337 <xsl:message terminate="yes">Broken table: row descendent of HTML table.</xsl:message>
338 </xsl:if>
339
340 <xsl:apply-templates mode="htmlTable"/>
341
342 <xsl:if test=".//footnote|../title//footnote">
343 <tbody class="footnotes">
344 <tr>
345 <td colspan="50">
346 <xsl:apply-templates select=".//footnote|../title//footnote" mode="table.footnote.mode"/>
347 </td>
348 </tr>
349 </tbody>
350 </xsl:if>
351</xsl:template>
352
353<xsl:template match="example">
354 <xsl:variable name="param.placement" select="substring-after(normalize-space($formal.title.placement), concat(local-name(.), ' '))"/>
355
356 <xsl:variable name="placement">
357 <xsl:choose>
358 <xsl:when test="contains($param.placement, ' ')">
359 <xsl:value-of select="substring-before($param.placement, ' ')"/>
360 </xsl:when>
361 <xsl:when test="$param.placement = ''">before</xsl:when>
362 <xsl:otherwise>
363 <xsl:value-of select="$param.placement"/>
364 </xsl:otherwise>
365 </xsl:choose>
366 </xsl:variable>
367
368 <xsl:call-template name="formal.object">
369 <xsl:with-param name="placement" select="$placement"/>
370 </xsl:call-template>
371
372</xsl:template>
373
374<xsl:template match="equation">
375 <xsl:variable name="param.placement" select="substring-after(normalize-space($formal.title.placement), concat(local-name(.), ' '))"/>
376
377 <xsl:variable name="placement">
378 <xsl:choose>
379 <xsl:when test="contains($param.placement, ' ')">
380 <xsl:value-of select="substring-before($param.placement, ' ')"/>
381 </xsl:when>
382 <xsl:when test="$param.placement = ''">before</xsl:when>
383 <xsl:otherwise>
384 <xsl:value-of select="$param.placement"/>
385 </xsl:otherwise>
386 </xsl:choose>
387 </xsl:variable>
388
389 <xsl:call-template name="formal.object">
390 <xsl:with-param name="placement" select="$placement"/>
391 </xsl:call-template>
392
393</xsl:template>
394
395<xsl:template match="figure/title"/>
396<xsl:template match="figure/titleabbrev"/>
397<xsl:template match="table/title"/>
398<xsl:template match="table/titleabbrev"/>
399<xsl:template match="table/textobject"/>
400<xsl:template match="example/title"/>
401<xsl:template match="example/titleabbrev"/>
402<xsl:template match="equation/title"/>
403<xsl:template match="equation/titleabbrev"/>
404
405<xsl:template match="informalfigure">
406 <xsl:call-template name="informal.object"/>
407</xsl:template>
408
409<xsl:template match="informalexample">
410 <xsl:call-template name="informal.object"/>
411</xsl:template>
412
413<xsl:template match="informaltable">
414 <xsl:choose>
415 <xsl:when test="tgroup|mediaobject|graphic">
416 <xsl:call-template name="informal.object"/>
417 </xsl:when>
418 <xsl:otherwise>
419 <div>
420 <xsl:call-template name="generate.class.attribute"/>
421 <xsl:call-template name="id.attribute"/>
422 <xsl:call-template name="anchor"/>
423 <xsl:element name="table" namespace="http://www.w3.org/1999/xhtml">
424 <xsl:apply-templates select="@*" mode="htmlTableAtt"/>
425 <xsl:call-template name="htmlTable"/>
426 </xsl:element>
427 </div>
428 </xsl:otherwise>
429 </xsl:choose>
430</xsl:template>
431
432<xsl:template match="informaltable/textobject"/>
433
434<xsl:template name="table.longdesc">
435 <!-- HACK: This doesn't belong inside formal.objectt; it should be done by -->
436 <!-- the table template, but I want the link to be inside the DIV, so... -->
437 <xsl:variable name="longdesc.uri">
438 <xsl:call-template name="longdesc.uri">
439 <xsl:with-param name="mediaobject" select="."/>
440 </xsl:call-template>
441 </xsl:variable>
442
443 <xsl:variable name="irrelevant">
444 <!-- write.longdesc returns the filename ... -->
445 <xsl:call-template name="write.longdesc">
446 <xsl:with-param name="mediaobject" select="."/>
447 </xsl:call-template>
448 </xsl:variable>
449
450 <xsl:if test="$html.longdesc != 0 and $html.longdesc.link != 0 and textobject[not(phrase)]">
451 <xsl:call-template name="longdesc.link">
452 <xsl:with-param name="longdesc.uri" select="$longdesc.uri"/>
453 </xsl:call-template>
454 </xsl:if>
455</xsl:template>
456
457<xsl:template match="informalequation">
458 <xsl:call-template name="informal.object"/>
459</xsl:template>
460
461<xsl:template name="floatstyle">
462 <xsl:if test="(@float and @float != '0') or @floatstyle != ''">
463 <xsl:choose>
464 <xsl:when test="@floatstyle != ''">
465 <xsl:value-of select="@floatstyle"/>
466 </xsl:when>
467 <xsl:when test="@float = '1'">
468 <xsl:value-of select="$default.float.class"/>
469 </xsl:when>
470 <xsl:otherwise>
471 <xsl:value-of select="@float"/>
472 </xsl:otherwise>
473 </xsl:choose>
474 </xsl:if>
475</xsl:template>
476
477<xsl:template name="floater">
478 <xsl:param name="content"/>
479 <xsl:param name="class" select="'float'"/>
480 <xsl:param name="floatstyle" select="'left'"/>
481
482 <div class="{$class}">
483 <xsl:if test="$floatstyle = 'left' or $floatstyle = 'right'">
484 <xsl:attribute name="style">
485 <xsl:text>float: </xsl:text>
486 <xsl:value-of select="$floatstyle"/>
487 <xsl:text>;</xsl:text>
488 </xsl:attribute>
489 </xsl:if>
490 <xsl:copy-of select="$content"/>
491 </div>
492</xsl:template>
493
494</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.