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 8806 2010-08-09 18:25:58Z 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="anchor">
29 <xsl:with-param name="conditional" select="0"/>
33 <xsl:when test="$placement = 'before'">
34 <xsl:call-template name="formal.object.heading"/>
35 <div class="{$class}-contents">
36 <xsl:apply-templates/>
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"/>
45 <xsl:if test="$spacing.paras != 0"><p/></xsl:if>
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"/>
57 <xsl:call-template name="formal.object.heading"/>
61 <xsl:if test="not($formal.object.break.after = '0')">
62 <br class="{$class}-break"/>
66 <xsl:variable name="floatstyle">
67 <xsl:call-template name="floatstyle"/>
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"/>
79 <xsl:copy-of select="$content"/>
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>
95 <xsl:when test="$make.clean.html != 0">
96 <xsl:variable name="html.class" select="concat(local-name($object),'-title')"/>
97 <div class="{$html.class}">
98 <xsl:copy-of select="$title"/>
103 <strong xmlns:xslo="http://www.w3.org/1999/XSL/Transform">
104 <xsl:copy-of select="$title"/>
111 <xsl:template name="informal.object">
112 <xsl:param name="class" select="local-name(.)"/>
114 <xsl:variable name="content">
115 <div class="{$class}">
116 <xsl:if test="$spacing.paras != 0"><p/></xsl:if>
117 <xsl:call-template name="anchor"/>
118 <xsl:apply-templates/>
120 <!-- HACK: This doesn't belong inside formal.object; it
121 should be done by the table template, but I want
122 the link to be inside the DIV, so... -->
123 <xsl:if test="local-name(.) = 'informaltable'">
124 <xsl:call-template name="table.longdesc"/>
127 <xsl:if test="$spacing.paras != 0"><p/></xsl:if>
131 <xsl:variable name="floatstyle">
132 <xsl:call-template name="floatstyle"/>
136 <xsl:when test="$floatstyle != ''">
137 <xsl:call-template name="floater">
138 <xsl:with-param name="class"><xsl:value-of select="$class"/>-float</xsl:with-param>
139 <xsl:with-param name="floatstyle" select="$floatstyle"/>
140 <xsl:with-param name="content" select="$content"/>
144 <xsl:copy-of select="$content"/>
150 <xsl:template name="semiformal.object">
151 <xsl:param name="placement" select="'before'"/>
152 <xsl:param name="class" select="local-name(.)"/>
155 <xsl:when test="title or info/title">
156 <xsl:call-template name="formal.object">
157 <xsl:with-param name="placement" select="$placement"/>
158 <xsl:with-param name="class" select="$class"/>
162 <xsl:call-template name="informal.object">
163 <xsl:with-param name="class" select="$class"/>
169 <xsl:template match="figure">
170 <xsl:variable name="param.placement" select="substring-after(normalize-space($formal.title.placement), concat(local-name(.), ' '))"/>
172 <xsl:variable name="placement">
174 <xsl:when test="contains($param.placement, ' ')">
175 <xsl:value-of select="substring-before($param.placement, ' ')"/>
177 <xsl:when test="$param.placement = ''">before</xsl:when>
179 <xsl:value-of select="$param.placement"/>
184 <xsl:call-template name="formal.object">
185 <xsl:with-param name="placement" select="$placement"/>
190 <xsl:template match="table">
192 <xsl:when test="tgroup|mediaobject|graphic">
193 <xsl:call-template name="calsTable"/>
196 <!-- do not use xsl:copy because of XHTML's needs -->
197 <xsl:element name="table" namespace="http://www.w3.org/1999/xhtml">
198 <xsl:apply-templates select="@*" mode="htmlTableAtt"/>
199 <xsl:attribute name="id">
200 <xsl:call-template name="object.id"/>
202 <xsl:call-template name="htmlTable"/>
208 <xsl:template name="calsTable">
209 <xsl:if test="tgroup/tbody/tr |tgroup/thead/tr |tgroup/tfoot/tr">
210 <xsl:message terminate="yes">Broken table: tr descendent of CALS Table.</xsl:message>
213 <xsl:variable name="param.placement" select="substring-after(normalize-space($formal.title.placement), concat(local-name(.), ' '))"/>
215 <xsl:variable name="placement">
217 <xsl:when test="contains($param.placement, ' ')">
218 <xsl:value-of select="substring-before($param.placement, ' ')"/>
220 <xsl:when test="$param.placement = ''">before</xsl:when>
222 <xsl:value-of select="$param.placement"/>
227 <xsl:call-template name="formal.object">
228 <xsl:with-param name="placement" select="$placement"/>
229 <xsl:with-param name="class">
231 <xsl:when test="@tabstyle">
232 <!-- hack, this will only ever occur on table, not example -->
233 <xsl:value-of select="@tabstyle"/>
236 <xsl:value-of select="local-name(.)"/>
243 <xsl:template name="htmlTable">
244 <xsl:if test="tgroup/tbody/row |tgroup/thead/row |tgroup/tfoot/row">
245 <xsl:message terminate="yes">Broken table: row descendent of HTML table.</xsl:message>
248 <xsl:apply-templates mode="htmlTable"/>
250 <xsl:if test=".//footnote|../title//footnote">
251 <tbody class="footnotes">
254 <xsl:apply-templates select=".//footnote|../title//footnote" mode="table.footnote.mode"/>
261 <xsl:template match="example">
262 <xsl:variable name="param.placement" select="substring-after(normalize-space($formal.title.placement), concat(local-name(.), ' '))"/>
264 <xsl:variable name="placement">
266 <xsl:when test="contains($param.placement, ' ')">
267 <xsl:value-of select="substring-before($param.placement, ' ')"/>
269 <xsl:when test="$param.placement = ''">before</xsl:when>
271 <xsl:value-of select="$param.placement"/>
276 <xsl:call-template name="formal.object">
277 <xsl:with-param name="placement" select="$placement"/>
282 <xsl:template match="equation">
283 <xsl:variable name="param.placement" select="substring-after(normalize-space($formal.title.placement), concat(local-name(.), ' '))"/>
285 <xsl:variable name="placement">
287 <xsl:when test="contains($param.placement, ' ')">
288 <xsl:value-of select="substring-before($param.placement, ' ')"/>
290 <xsl:when test="$param.placement = ''">before</xsl:when>
292 <xsl:value-of select="$param.placement"/>
297 <xsl:call-template name="formal.object">
298 <xsl:with-param name="placement" select="$placement"/>
303 <xsl:template match="figure/title"/>
304 <xsl:template match="figure/titleabbrev"/>
305 <xsl:template match="table/title"/>
306 <xsl:template match="table/titleabbrev"/>
307 <xsl:template match="table/textobject"/>
308 <xsl:template match="example/title"/>
309 <xsl:template match="example/titleabbrev"/>
310 <xsl:template match="equation/title"/>
311 <xsl:template match="equation/titleabbrev"/>
313 <xsl:template match="informalfigure">
314 <xsl:call-template name="informal.object"/>
317 <xsl:template match="informalexample">
318 <xsl:call-template name="informal.object"/>
321 <xsl:template match="informaltable">
323 <xsl:when test="tgroup|mediaobject|graphic">
324 <xsl:call-template name="informal.object">
325 <xsl:with-param name="class">
327 <xsl:when test="@tabstyle">
328 <xsl:value-of select="@tabstyle"/>
331 <xsl:value-of select="local-name(.)"/>
338 <xsl:element name="table" namespace="http://www.w3.org/1999/xhtml">
339 <xsl:apply-templates select="@*" mode="htmlTableAtt"/>
340 <xsl:attribute name="id">
341 <xsl:call-template name="object.id"/>
343 <xsl:call-template name="htmlTable"/>
349 <xsl:template match="informaltable/textobject"/>
351 <xsl:template name="table.longdesc">
352 <!-- HACK: This doesn't belong inside formal.objectt; it should be done by -->
353 <!-- the table template, but I want the link to be inside the DIV, so... -->
354 <xsl:variable name="longdesc.uri">
355 <xsl:call-template name="longdesc.uri">
356 <xsl:with-param name="mediaobject" select="."/>
360 <xsl:variable name="irrelevant">
361 <!-- write.longdesc returns the filename ... -->
362 <xsl:call-template name="write.longdesc">
363 <xsl:with-param name="mediaobject" select="."/>
367 <xsl:if test="$html.longdesc != 0 and $html.longdesc.link != 0 and textobject[not(phrase)]">
368 <xsl:call-template name="longdesc.link">
369 <xsl:with-param name="longdesc.uri" select="$longdesc.uri"/>
374 <xsl:template match="informalequation">
375 <xsl:call-template name="informal.object"/>
378 <xsl:template name="floatstyle">
379 <xsl:if test="(@float and @float != '0') or @floatstyle != ''">
381 <xsl:when test="@floatstyle != ''">
382 <xsl:value-of select="@floatstyle"/>
384 <xsl:when test="@float = '1'">
385 <xsl:value-of select="$default.float.class"/>
388 <xsl:value-of select="@float"/>
394 <xsl:template name="floater">
395 <xsl:param name="content"/>
396 <xsl:param name="class" select="'float'"/>
397 <xsl:param name="floatstyle" select="'left'"/>
399 <div class="{$class}">
400 <xsl:if test="$floatstyle = 'left' or $floatstyle = 'right'">
401 <xsl:attribute name="style">
402 <xsl:text>float: </xsl:text>
403 <xsl:value-of select="$floatstyle"/>
404 <xsl:text>;</xsl:text>
407 <xsl:copy-of select="$content"/>