source: BOOK/stylesheets/lfs-xsl/docbook-xsl-snapshot/xhtml/formal.xsl@ ccd51bc

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since ccd51bc was d7c9f58, checked in by Manuel Canales Esparcia <manuel@…>, 17 years ago

Updated DocBook-XSL code to version 1.73.2

  • Property mode set to 100644
File size: 12.5 KB
RevLine 
[f8c4e94]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>
[d7c9f58]106 <xsl:call-template name="anchor"/>
[f8c4e94]107 <xsl:apply-templates/>
108
109 <!-- HACK: This doesn't belong inside formal.object; it
110 should be done by the table template, but I want
111 the link to be inside the DIV, so... -->
112 <xsl:if test="local-name(.) = 'informaltable'">
113 <xsl:call-template name="table.longdesc"/>
114 </xsl:if>
115
116 <xsl:if test="$spacing.paras != 0"><p/></xsl:if>
117 </div>
118 </xsl:variable>
119
120 <xsl:variable name="floatstyle">
121 <xsl:call-template name="floatstyle"/>
122 </xsl:variable>
123
124 <xsl:choose>
125 <xsl:when test="$floatstyle != ''">
126 <xsl:call-template name="floater">
127 <xsl:with-param name="class"><xsl:value-of select="$class"/>-float</xsl:with-param>
128 <xsl:with-param name="floatstyle" select="$floatstyle"/>
129 <xsl:with-param name="content" select="$content"/>
130 </xsl:call-template>
131 </xsl:when>
132 <xsl:otherwise>
133 <xsl:copy-of select="$content"/>
134 </xsl:otherwise>
135 </xsl:choose>
136
137</xsl:template>
138
139<xsl:template name="semiformal.object">
140 <xsl:param name="placement" select="'before'"/>
141 <xsl:param name="class" select="local-name(.)"/>
142
143 <xsl:choose>
144 <xsl:when test="title">
145 <xsl:call-template name="formal.object">
146 <xsl:with-param name="placement" select="$placement"/>
147 <xsl:with-param name="class" select="$class"/>
148 </xsl:call-template>
149 </xsl:when>
150 <xsl:otherwise>
151 <xsl:call-template name="informal.object">
152 <xsl:with-param name="class" select="$class"/>
153 </xsl:call-template>
154 </xsl:otherwise>
155 </xsl:choose>
156</xsl:template>
157
158<xsl:template match="figure">
159 <xsl:variable name="param.placement" select="substring-after(normalize-space($formal.title.placement), concat(local-name(.), ' '))"/>
160
161 <xsl:variable name="placement">
162 <xsl:choose>
163 <xsl:when test="contains($param.placement, ' ')">
164 <xsl:value-of select="substring-before($param.placement, ' ')"/>
165 </xsl:when>
166 <xsl:when test="$param.placement = ''">before</xsl:when>
167 <xsl:otherwise>
168 <xsl:value-of select="$param.placement"/>
169 </xsl:otherwise>
170 </xsl:choose>
171 </xsl:variable>
172
173 <xsl:call-template name="formal.object">
174 <xsl:with-param name="placement" select="$placement"/>
175 </xsl:call-template>
176
177</xsl:template>
178
179<xsl:template match="table">
180 <xsl:choose>
181 <xsl:when test="tgroup|mediaobject|graphic">
182 <xsl:call-template name="calsTable"/>
183 </xsl:when>
184 <xsl:otherwise>
185 <xsl:copy>
186 <xsl:copy-of select="@*[not(local-name()='id')]"/>
187 <xsl:attribute name="id">
188 <xsl:call-template name="object.id"/>
189 </xsl:attribute>
190 <xsl:call-template name="htmlTable"/>
191 </xsl:copy>
192 </xsl:otherwise>
193 </xsl:choose>
194</xsl:template>
195
196<xsl:template name="calsTable">
197 <xsl:if test="tgroup/tbody/tr |tgroup/thead/tr |tgroup/tfoot/tr">
198 <xsl:message terminate="yes">Broken table: tr descendent of CALS Table.</xsl:message>
199 </xsl:if>
200
201 <xsl:variable name="param.placement" select="substring-after(normalize-space($formal.title.placement), concat(local-name(.), ' '))"/>
202
203 <xsl:variable name="placement">
204 <xsl:choose>
205 <xsl:when test="contains($param.placement, ' ')">
206 <xsl:value-of select="substring-before($param.placement, ' ')"/>
207 </xsl:when>
208 <xsl:when test="$param.placement = ''">before</xsl:when>
209 <xsl:otherwise>
210 <xsl:value-of select="$param.placement"/>
211 </xsl:otherwise>
212 </xsl:choose>
213 </xsl:variable>
214
215 <xsl:call-template name="formal.object">
216 <xsl:with-param name="placement" select="$placement"/>
217 <xsl:with-param name="class">
218 <xsl:choose>
219 <xsl:when test="@tabstyle">
220 <!-- hack, this will only ever occur on table, not example -->
221 <xsl:value-of select="@tabstyle"/>
222 </xsl:when>
223 <xsl:otherwise>
224 <xsl:value-of select="local-name(.)"/>
225 </xsl:otherwise>
226 </xsl:choose>
227 </xsl:with-param>
228 </xsl:call-template>
229</xsl:template>
230
231<xsl:template name="htmlTable">
232 <xsl:if test="tgroup/tbody/row |tgroup/thead/row |tgroup/tfoot/row">
233 <xsl:message terminate="yes">Broken table: row descendent of HTML table.</xsl:message>
234 </xsl:if>
235
236 <xsl:apply-templates mode="htmlTable"/>
237</xsl:template>
238
239<xsl:template match="example">
240 <xsl:variable name="param.placement" select="substring-after(normalize-space($formal.title.placement), concat(local-name(.), ' '))"/>
241
242 <xsl:variable name="placement">
243 <xsl:choose>
244 <xsl:when test="contains($param.placement, ' ')">
245 <xsl:value-of select="substring-before($param.placement, ' ')"/>
246 </xsl:when>
247 <xsl:when test="$param.placement = ''">before</xsl:when>
248 <xsl:otherwise>
249 <xsl:value-of select="$param.placement"/>
250 </xsl:otherwise>
251 </xsl:choose>
252 </xsl:variable>
253
254 <xsl:call-template name="formal.object">
255 <xsl:with-param name="placement" select="$placement"/>
256 </xsl:call-template>
257
258</xsl:template>
259
260<xsl:template match="equation">
261 <xsl:variable name="param.placement" select="substring-after(normalize-space($formal.title.placement), concat(local-name(.), ' '))"/>
262
263 <xsl:variable name="placement">
264 <xsl:choose>
265 <xsl:when test="contains($param.placement, ' ')">
266 <xsl:value-of select="substring-before($param.placement, ' ')"/>
267 </xsl:when>
268 <xsl:when test="$param.placement = ''">before</xsl:when>
269 <xsl:otherwise>
270 <xsl:value-of select="$param.placement"/>
271 </xsl:otherwise>
272 </xsl:choose>
273 </xsl:variable>
274
275 <xsl:call-template name="formal.object">
276 <xsl:with-param name="placement" select="$placement"/>
277 </xsl:call-template>
278
279</xsl:template>
280
281<xsl:template match="figure/title"/>
282<xsl:template match="figure/titleabbrev"/>
283<xsl:template match="table/title"/>
284<xsl:template match="table/titleabbrev"/>
285<xsl:template match="table/textobject"/>
286<xsl:template match="example/title"/>
287<xsl:template match="example/titleabbrev"/>
288<xsl:template match="equation/title"/>
289<xsl:template match="equation/titleabbrev"/>
290
291<xsl:template match="informalfigure">
292 <xsl:call-template name="informal.object"/>
293</xsl:template>
294
295<xsl:template match="informalexample">
296 <xsl:call-template name="informal.object"/>
297</xsl:template>
298
299<xsl:template match="informaltable">
300 <xsl:choose>
301 <xsl:when test="tgroup|mediaobject|graphic">
302 <xsl:call-template name="informal.object">
303 <xsl:with-param name="class">
304 <xsl:choose>
305 <xsl:when test="@tabstyle">
306 <xsl:value-of select="@tabstyle"/>
307 </xsl:when>
308 <xsl:otherwise>
309 <xsl:value-of select="local-name(.)"/>
310 </xsl:otherwise>
311 </xsl:choose>
312 </xsl:with-param>
313 </xsl:call-template>
314 </xsl:when>
315 <xsl:otherwise>
316 <table>
317 <xsl:copy-of select="@*"/>
318 <xsl:call-template name="htmlTable"/>
319 </table>
320 </xsl:otherwise>
321 </xsl:choose>
322</xsl:template>
323
324<xsl:template match="informaltable/textobject"/>
325
326<xsl:template name="table.longdesc">
327 <!-- HACK: This doesn't belong inside formal.objectt; it should be done by -->
328 <!-- the table template, but I want the link to be inside the DIV, so... -->
329 <xsl:variable name="longdesc.uri">
330 <xsl:call-template name="longdesc.uri">
331 <xsl:with-param name="mediaobject" select="."/>
332 </xsl:call-template>
333 </xsl:variable>
334
335 <xsl:variable name="irrelevant">
336 <!-- write.longdesc returns the filename ... -->
337 <xsl:call-template name="write.longdesc">
338 <xsl:with-param name="mediaobject" select="."/>
339 </xsl:call-template>
340 </xsl:variable>
341
342 <xsl:if test="$html.longdesc != 0 and $html.longdesc.link != 0 and textobject[not(phrase)]">
343 <xsl:call-template name="longdesc.link">
344 <xsl:with-param name="longdesc.uri" select="$longdesc.uri"/>
345 </xsl:call-template>
346 </xsl:if>
347</xsl:template>
348
349<xsl:template match="informalequation">
350 <xsl:call-template name="informal.object"/>
351</xsl:template>
352
353<xsl:template name="floatstyle">
354 <xsl:if test="(@float and @float != '0') or @floatstyle != ''">
355 <xsl:choose>
356 <xsl:when test="@floatstyle != ''">
357 <xsl:value-of select="@floatstyle"/>
358 </xsl:when>
359 <xsl:when test="@float = '1'">
360 <xsl:value-of select="$default.float.class"/>
361 </xsl:when>
362 <xsl:otherwise>
363 <xsl:value-of select="@float"/>
364 </xsl:otherwise>
365 </xsl:choose>
366 </xsl:if>
367</xsl:template>
368
369<xsl:template name="floater">
370 <xsl:param name="content"/>
371 <xsl:param name="class" select="'float'"/>
372 <xsl:param name="floatstyle" select="'left'"/>
373
374 <div class="{$class}">
375 <xsl:if test="$floatstyle = 'left' or $floatstyle = 'right'">
376 <xsl:attribute name="style">
377 <xsl:text>float: </xsl:text>
378 <xsl:value-of select="$floatstyle"/>
379 <xsl:text>;</xsl:text>
380 </xsl:attribute>
381 </xsl:if>
382 <xsl:copy-of select="$content"/>
383 </div>
384</xsl:template>
385
386</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.