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 8310 2009-03-11 08:29:45Z 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:copy-of select="$title"/>
100 <xsl:template name="informal.object">
101 <xsl:param name="class" select="local-name(.)"/>
103 <xsl:variable name="content">
104 <div class="{$class}">
105 <xsl:if test="$spacing.paras != 0"><p/></xsl:if>
106 <xsl:call-template name="anchor"/>
107 <xsl:apply-templates/>
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"/>
116 <xsl:if test="$spacing.paras != 0"><p/></xsl:if>
120 <xsl:variable name="floatstyle">
121 <xsl:call-template name="floatstyle"/>
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"/>
133 <xsl:copy-of select="$content"/>
139 <xsl:template name="semiformal.object">
140 <xsl:param name="placement" select="'before'"/>
141 <xsl:param name="class" select="local-name(.)"/>
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"/>
151 <xsl:call-template name="informal.object">
152 <xsl:with-param name="class" select="$class"/>
158 <xsl:template match="figure">
159 <xsl:variable name="param.placement" select="substring-after(normalize-space($formal.title.placement), concat(local-name(.), ' '))"/>
161 <xsl:variable name="placement">
163 <xsl:when test="contains($param.placement, ' ')">
164 <xsl:value-of select="substring-before($param.placement, ' ')"/>
166 <xsl:when test="$param.placement = ''">before</xsl:when>
168 <xsl:value-of select="$param.placement"/>
173 <xsl:call-template name="formal.object">
174 <xsl:with-param name="placement" select="$placement"/>
179 <xsl:template match="table">
181 <xsl:when test="tgroup|mediaobject|graphic">
182 <xsl:call-template name="calsTable"/>
185 <!-- do not use xsl:copy because of XHTML's needs -->
186 <xsl:element name="table" namespace="http://www.w3.org/1999/xhtml">
187 <xsl:apply-templates select="@*" mode="htmlTableAtt"/>
188 <xsl:attribute name="id">
189 <xsl:call-template name="object.id"/>
191 <xsl:call-template name="htmlTable"/>
197 <xsl:template name="calsTable">
198 <xsl:if test="tgroup/tbody/tr |tgroup/thead/tr |tgroup/tfoot/tr">
199 <xsl:message terminate="yes">Broken table: tr descendent of CALS Table.</xsl:message>
202 <xsl:variable name="param.placement" select="substring-after(normalize-space($formal.title.placement), concat(local-name(.), ' '))"/>
204 <xsl:variable name="placement">
206 <xsl:when test="contains($param.placement, ' ')">
207 <xsl:value-of select="substring-before($param.placement, ' ')"/>
209 <xsl:when test="$param.placement = ''">before</xsl:when>
211 <xsl:value-of select="$param.placement"/>
216 <xsl:call-template name="formal.object">
217 <xsl:with-param name="placement" select="$placement"/>
218 <xsl:with-param name="class">
220 <xsl:when test="@tabstyle">
221 <!-- hack, this will only ever occur on table, not example -->
222 <xsl:value-of select="@tabstyle"/>
225 <xsl:value-of select="local-name(.)"/>
232 <xsl:template name="htmlTable">
233 <xsl:if test="tgroup/tbody/row |tgroup/thead/row |tgroup/tfoot/row">
234 <xsl:message terminate="yes">Broken table: row descendent of HTML table.</xsl:message>
237 <xsl:apply-templates mode="htmlTable"/>
240 <xsl:template match="example">
241 <xsl:variable name="param.placement" select="substring-after(normalize-space($formal.title.placement), concat(local-name(.), ' '))"/>
243 <xsl:variable name="placement">
245 <xsl:when test="contains($param.placement, ' ')">
246 <xsl:value-of select="substring-before($param.placement, ' ')"/>
248 <xsl:when test="$param.placement = ''">before</xsl:when>
250 <xsl:value-of select="$param.placement"/>
255 <xsl:call-template name="formal.object">
256 <xsl:with-param name="placement" select="$placement"/>
261 <xsl:template match="equation">
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="figure/title"/>
283 <xsl:template match="figure/titleabbrev"/>
284 <xsl:template match="table/title"/>
285 <xsl:template match="table/titleabbrev"/>
286 <xsl:template match="table/textobject"/>
287 <xsl:template match="example/title"/>
288 <xsl:template match="example/titleabbrev"/>
289 <xsl:template match="equation/title"/>
290 <xsl:template match="equation/titleabbrev"/>
292 <xsl:template match="informalfigure">
293 <xsl:call-template name="informal.object"/>
296 <xsl:template match="informalexample">
297 <xsl:call-template name="informal.object"/>
300 <xsl:template match="informaltable">
302 <xsl:when test="tgroup|mediaobject|graphic">
303 <xsl:call-template name="informal.object">
304 <xsl:with-param name="class">
306 <xsl:when test="@tabstyle">
307 <xsl:value-of select="@tabstyle"/>
310 <xsl:value-of select="local-name(.)"/>
317 <xsl:element name="table" namespace="http://www.w3.org/1999/xhtml">
318 <xsl:apply-templates select="@*" mode="htmlTableAtt"/>
319 <xsl:attribute name="id">
320 <xsl:call-template name="object.id"/>
322 <xsl:call-template name="htmlTable"/>
328 <xsl:template match="informaltable/textobject"/>
330 <xsl:template name="table.longdesc">
331 <!-- HACK: This doesn't belong inside formal.objectt; it should be done by -->
332 <!-- the table template, but I want the link to be inside the DIV, so... -->
333 <xsl:variable name="longdesc.uri">
334 <xsl:call-template name="longdesc.uri">
335 <xsl:with-param name="mediaobject" select="."/>
339 <xsl:variable name="irrelevant">
340 <!-- write.longdesc returns the filename ... -->
341 <xsl:call-template name="write.longdesc">
342 <xsl:with-param name="mediaobject" select="."/>
346 <xsl:if test="$html.longdesc != 0 and $html.longdesc.link != 0 and textobject[not(phrase)]">
347 <xsl:call-template name="longdesc.link">
348 <xsl:with-param name="longdesc.uri" select="$longdesc.uri"/>
353 <xsl:template match="informalequation">
354 <xsl:call-template name="informal.object"/>
357 <xsl:template name="floatstyle">
358 <xsl:if test="(@float and @float != '0') or @floatstyle != ''">
360 <xsl:when test="@floatstyle != ''">
361 <xsl:value-of select="@floatstyle"/>
363 <xsl:when test="@float = '1'">
364 <xsl:value-of select="$default.float.class"/>
367 <xsl:value-of select="@float"/>
373 <xsl:template name="floater">
374 <xsl:param name="content"/>
375 <xsl:param name="class" select="'float'"/>
376 <xsl:param name="floatstyle" select="'left'"/>
378 <div class="{$class}">
379 <xsl:if test="$floatstyle = 'left' or $floatstyle = 'right'">
380 <xsl:attribute name="style">
381 <xsl:text>float: </xsl:text>
382 <xsl:value-of select="$floatstyle"/>
383 <xsl:text>;</xsl:text>
386 <xsl:copy-of select="$content"/>