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">
6 <!-- ********************************************************************
7 $Id: formal.xsl 9501 2012-07-16 00:14:50Z bobstayton $
8 ********************************************************************
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.
14 ******************************************************************** -->
16 <xsl:param name="formal.object.break.after">1</xsl:param>
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"/>
24 <xsl:call-template name="id.warning"/>
26 <xsl:variable name="content">
27 <div class="{$class}">
28 <xsl:call-template name="id.attribute">
29 <xsl:with-param name="conditional" select="0"/>
31 <xsl:call-template name="anchor">
32 <xsl:with-param name="conditional" select="0"/>
36 <xsl:when test="$placement = 'before'">
37 <xsl:call-template name="formal.object.heading"/>
38 <div class="{$class}-contents">
39 <xsl:apply-templates/>
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"/>
48 <xsl:if test="$spacing.paras != 0"><p/></xsl:if>
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"/>
60 <xsl:call-template name="formal.object.heading"/>
64 <xsl:if test="not($formal.object.break.after = '0')">
65 <br class="{$class}-break"/>
69 <xsl:variable name="floatstyle">
70 <xsl:call-template name="floatstyle"/>
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"/>
82 <xsl:copy-of select="$content"/>
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>
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"/>
106 <strong xmlns:xslo="http://www.w3.org/1999/XSL/Transform">
107 <xsl:copy-of select="$title"/>
114 <xsl:template name="informal.object">
115 <xsl:param name="class">
116 <xsl:apply-templates select="." mode="class.value"/>
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/>
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"/>
133 <xsl:if test="$spacing.paras != 0"><p/></xsl:if>
137 <xsl:variable name="floatstyle">
138 <xsl:call-template name="floatstyle"/>
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"/>
150 <xsl:copy-of select="$content"/>
156 <xsl:template name="semiformal.object">
157 <xsl:param name="placement" select="'before'"/>
158 <xsl:param name="class" select="local-name(.)"/>
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"/>
168 <xsl:call-template name="informal.object">
169 <xsl:with-param name="class" select="$class"/>
175 <xsl:template match="figure">
176 <xsl:variable name="param.placement" select="substring-after(normalize-space($formal.title.placement), concat(local-name(.), ' '))"/>
178 <xsl:variable name="placement">
180 <xsl:when test="contains($param.placement, ' ')">
181 <xsl:value-of select="substring-before($param.placement, ' ')"/>
183 <xsl:when test="$param.placement = ''">before</xsl:when>
185 <xsl:value-of select="$param.placement"/>
190 <xsl:call-template name="formal.object">
191 <xsl:with-param name="placement" select="$placement"/>
196 <xsl:template match="table">
198 <xsl:when test="tgroup|mediaobject|graphic">
199 <xsl:call-template name="calsTable"/>
201 <xsl:when test="caption">
202 <xsl:call-template name="htmlTable.with.caption"/>
205 <!-- do not use xsl:copy because of XHTML's needs -->
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"/>
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"/>
225 <xsl:variable name="param.placement" select="substring-after(normalize-space($formal.title.placement), concat(local-name(.), ' '))"/>
227 <xsl:variable name="placement">
229 <xsl:when test="contains($param.placement, ' ')">
230 <xsl:value-of select="substring-before($param.placement, ' ')"/>
232 <xsl:when test="$param.placement = ''">before</xsl:when>
234 <xsl:value-of select="$param.placement"/>
239 <xsl:call-template name="id.warning"/>
241 <xsl:variable name="content">
242 <div class="{$class}">
243 <xsl:call-template name="id.attribute">
244 <xsl:with-param name="conditional" select="0"/>
246 <xsl:call-template name="anchor">
247 <xsl:with-param name="conditional" select="0"/>
251 <xsl:when test="$placement = 'before'">
253 <xsl:call-template name="formal.object.heading"/>
255 <div class="{$class}-contents">
256 <xsl:apply-templates select="." mode="htmlTable"/>
259 <xsl:call-template name="table.longdesc"/>
261 <xsl:if test="$spacing.paras != 0"><p/></xsl:if>
264 <xsl:if test="$spacing.paras != 0"><p/></xsl:if>
266 <div class="{$class}-contents">
267 <xsl:apply-templates select="." mode="htmlTable"/>
270 <xsl:call-template name="table.longdesc"/>
272 <xsl:call-template name="formal.object.heading"/>
276 <xsl:if test="not($formal.object.break.after = '0')">
277 <br class="{$class}-break"/>
281 <xsl:variable name="floatstyle">
282 <xsl:call-template name="floatstyle"/>
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"/>
294 <xsl:copy-of select="$content"/>
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>
305 <xsl:variable name="param.placement" select="substring-after(normalize-space($formal.title.placement), concat(local-name(.), ' '))"/>
307 <xsl:variable name="placement">
309 <xsl:when test="contains($param.placement, ' ')">
310 <xsl:value-of select="substring-before($param.placement, ' ')"/>
312 <xsl:when test="$param.placement = ''">before</xsl:when>
314 <xsl:value-of select="$param.placement"/>
319 <xsl:call-template name="formal.object">
320 <xsl:with-param name="placement" select="$placement"/>
324 <xsl:template match="table|informaltable" mode="class.value">
326 <xsl:when test="@tabstyle">
327 <xsl:value-of select="@tabstyle"/>
330 <xsl:value-of select="local-name(.)"/>
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>
340 <xsl:apply-templates mode="htmlTable"/>
342 <xsl:if test=".//footnote|../title//footnote">
343 <tbody class="footnotes">
346 <xsl:apply-templates select=".//footnote|../title//footnote" mode="table.footnote.mode"/>
353 <xsl:template match="example">
354 <xsl:variable name="param.placement" select="substring-after(normalize-space($formal.title.placement), concat(local-name(.), ' '))"/>
356 <xsl:variable name="placement">
358 <xsl:when test="contains($param.placement, ' ')">
359 <xsl:value-of select="substring-before($param.placement, ' ')"/>
361 <xsl:when test="$param.placement = ''">before</xsl:when>
363 <xsl:value-of select="$param.placement"/>
368 <xsl:call-template name="formal.object">
369 <xsl:with-param name="placement" select="$placement"/>
374 <xsl:template match="equation">
375 <xsl:variable name="param.placement" select="substring-after(normalize-space($formal.title.placement), concat(local-name(.), ' '))"/>
377 <xsl:variable name="placement">
379 <xsl:when test="contains($param.placement, ' ')">
380 <xsl:value-of select="substring-before($param.placement, ' ')"/>
382 <xsl:when test="$param.placement = ''">before</xsl:when>
384 <xsl:value-of select="$param.placement"/>
389 <xsl:call-template name="formal.object">
390 <xsl:with-param name="placement" select="$placement"/>
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"/>
405 <xsl:template match="informalfigure">
406 <xsl:call-template name="informal.object"/>
409 <xsl:template match="informalexample">
410 <xsl:call-template name="informal.object"/>
413 <xsl:template match="informaltable">
415 <xsl:when test="tgroup|mediaobject|graphic">
416 <xsl:call-template name="informal.object"/>
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"/>
432 <xsl:template match="informaltable/textobject"/>
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="."/>
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="."/>
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"/>
457 <xsl:template match="informalequation">
458 <xsl:call-template name="informal.object"/>
461 <xsl:template name="floatstyle">
462 <xsl:if test="(@float and @float != '0') or @floatstyle != ''">
464 <xsl:when test="@floatstyle != ''">
465 <xsl:value-of select="@floatstyle"/>
467 <xsl:when test="@float = '1'">
468 <xsl:value-of select="$default.float.class"/>
471 <xsl:value-of select="@float"/>
477 <xsl:template name="floater">
478 <xsl:param name="content"/>
479 <xsl:param name="class" select="'float'"/>
480 <xsl:param name="floatstyle" select="'left'"/>
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>
490 <xsl:copy-of select="$content"/>