1 <?xml version="1.0" encoding="ASCII"?><!--This file was created automatically by html2xhtml--><!--from the HTML stylesheets.--><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:d="http://docbook.org/ns/docbook" xmlns="http://www.w3.org/1999/xhtml" exclude-result-prefixes="d" version="1.0">
3 <!-- ********************************************************************
5 This file is part of the XSL DocBook Stylesheet distribution.
6 See ../README or http://cdn.docbook.org/release/xsl/current/ for
7 copyright and other information.
9 ******************************************************************** -->
11 <xsl:param name="formal.object.break.after">1</xsl:param>
13 <xsl:template name="formal.object">
14 <xsl:param name="placement" select="'before'"/>
15 <xsl:param name="class">
16 <xsl:apply-templates select="." mode="class.value"/>
19 <xsl:call-template name="id.warning"/>
21 <xsl:variable name="content">
22 <div class="{$class}">
23 <xsl:call-template name="id.attribute">
24 <xsl:with-param name="conditional" select="0"/>
26 <xsl:call-template name="anchor">
27 <xsl:with-param name="conditional" select="0"/>
31 <xsl:when test="$placement = 'before'">
32 <xsl:call-template name="formal.object.heading"/>
33 <div class="{$class}-contents">
34 <xsl:apply-templates/>
36 <!-- HACK: This doesn't belong inside formal.object; it
37 should be done by the table template, but I want
38 the link to be inside the DIV, so... -->
39 <xsl:if test="local-name(.) = 'table'">
40 <xsl:call-template name="table.longdesc"/>
43 <xsl:if test="$spacing.paras != 0"><p/></xsl:if>
46 <xsl:if test="$spacing.paras != 0"><p/></xsl:if>
47 <div class="{$class}-contents"><xsl:apply-templates/></div>
48 <!-- HACK: This doesn't belong inside formal.object; it
49 should be done by the table template, but I want
50 the link to be inside the DIV, so... -->
51 <xsl:if test="local-name(.) = 'table'">
52 <xsl:call-template name="table.longdesc"/>
55 <xsl:call-template name="formal.object.heading"/>
59 <xsl:if test="not($formal.object.break.after = '0')">
60 <br class="{$class}-break"/>
64 <xsl:variable name="floatstyle">
65 <xsl:call-template name="floatstyle"/>
69 <xsl:when test="$floatstyle != ''">
70 <xsl:call-template name="floater">
71 <xsl:with-param name="class"><xsl:value-of select="$class"/>-float</xsl:with-param>
72 <xsl:with-param name="floatstyle" select="$floatstyle"/>
73 <xsl:with-param name="content" select="$content"/>
77 <xsl:copy-of select="$content"/>
83 <xsl:template name="formal.object.heading">
84 <xsl:param name="object" select="."/>
85 <xsl:param name="title">
86 <xsl:apply-templates select="$object" mode="object.title.markup">
87 <xsl:with-param name="allow-anchors" select="1"/>
88 </xsl:apply-templates>
93 <xsl:when test="$make.clean.html != 0">
94 <xsl:variable name="html.class" select="concat(local-name($object),'-title')"/>
95 <div class="{$html.class}">
96 <xsl:copy-of select="$title"/>
102 <xsl:copy-of select="$title"/>
109 <xsl:template name="informal.object">
110 <xsl:param name="class">
111 <xsl:apply-templates select="." mode="class.value"/>
114 <xsl:variable name="content">
115 <div class="{$class}">
116 <xsl:call-template name="id.attribute"/>
117 <xsl:if test="$spacing.paras != 0"><p/></xsl:if>
118 <xsl:call-template name="anchor"/>
119 <xsl:apply-templates/>
121 <!-- HACK: This doesn't belong inside formal.object; it
122 should be done by the table template, but I want
123 the link to be inside the DIV, so... -->
124 <xsl:if test="local-name(.) = 'informaltable'">
125 <xsl:call-template name="table.longdesc"/>
128 <xsl:if test="$spacing.paras != 0"><p/></xsl:if>
132 <xsl:variable name="floatstyle">
133 <xsl:call-template name="floatstyle"/>
137 <xsl:when test="$floatstyle != ''">
138 <xsl:call-template name="floater">
139 <xsl:with-param name="class"><xsl:value-of select="$class"/>-float</xsl:with-param>
140 <xsl:with-param name="floatstyle" select="$floatstyle"/>
141 <xsl:with-param name="content" select="$content"/>
145 <xsl:copy-of select="$content"/>
151 <xsl:template name="semiformal.object">
152 <xsl:param name="placement" select="'before'"/>
153 <xsl:param name="class" select="local-name(.)"/>
156 <xsl:when test="d:title or d:info/d:title">
157 <xsl:call-template name="formal.object">
158 <xsl:with-param name="placement" select="$placement"/>
159 <xsl:with-param name="class" select="$class"/>
163 <xsl:call-template name="informal.object">
164 <xsl:with-param name="class" select="$class"/>
170 <xsl:template match="d:figure">
171 <xsl:variable name="param.placement" select="substring-after(normalize-space($formal.title.placement), concat(local-name(.), ' '))"/>
173 <xsl:variable name="placement">
175 <xsl:when test="contains($param.placement, ' ')">
176 <xsl:value-of select="substring-before($param.placement, ' ')"/>
178 <xsl:when test="$param.placement = ''">before</xsl:when>
180 <xsl:value-of select="$param.placement"/>
185 <xsl:call-template name="formal.object">
186 <xsl:with-param name="placement" select="$placement"/>
191 <xsl:template match="d:table">
193 <xsl:when test="d:tgroup|d:mediaobject|d:graphic">
194 <xsl:call-template name="calsTable"/>
196 <xsl:when test="d:caption">
197 <xsl:call-template name="htmlTable.with.caption"/>
200 <!-- do not use xsl:copy because of XHTML's needs -->
202 <xsl:call-template name="generate.class.attribute"/>
203 <xsl:call-template name="id.attribute"/>
204 <xsl:call-template name="anchor"/>
205 <xsl:element name="table" namespace="http://www.w3.org/1999/xhtml">
206 <xsl:apply-templates select="@*" mode="htmlTableAtt"/>
207 <xsl:call-template name="htmlTable"/>
214 <!-- Handle html markup table like formal.object -->
215 <xsl:template name="htmlTable.with.caption">
216 <xsl:param name="class">
217 <xsl:apply-templates select="." mode="class.value"/>
220 <xsl:variable name="param.placement" select="substring-after(normalize-space($formal.title.placement), concat(local-name(.), ' '))"/>
222 <xsl:variable name="placement">
224 <xsl:when test="contains($param.placement, ' ')">
225 <xsl:value-of select="substring-before($param.placement, ' ')"/>
227 <xsl:when test="$param.placement = ''">before</xsl:when>
229 <xsl:value-of select="$param.placement"/>
234 <xsl:call-template name="id.warning"/>
236 <xsl:variable name="content">
237 <div class="{$class}">
238 <xsl:call-template name="id.attribute">
239 <xsl:with-param name="conditional" select="0"/>
241 <xsl:call-template name="anchor">
242 <xsl:with-param name="conditional" select="0"/>
246 <xsl:when test="$placement = 'before'">
248 <xsl:call-template name="formal.object.heading"/>
250 <div class="{$class}-contents">
251 <xsl:apply-templates select="." mode="htmlTable"/>
254 <xsl:call-template name="table.longdesc"/>
256 <xsl:if test="$spacing.paras != 0"><p/></xsl:if>
259 <xsl:if test="$spacing.paras != 0"><p/></xsl:if>
261 <div class="{$class}-contents">
262 <xsl:apply-templates select="." mode="htmlTable"/>
265 <xsl:call-template name="table.longdesc"/>
267 <xsl:call-template name="formal.object.heading"/>
271 <xsl:if test="not($formal.object.break.after = '0')">
272 <br class="{$class}-break"/>
276 <xsl:variable name="floatstyle">
277 <xsl:call-template name="floatstyle"/>
281 <xsl:when test="$floatstyle != ''">
282 <xsl:call-template name="floater">
283 <xsl:with-param name="class"><xsl:value-of select="$class"/>-float</xsl:with-param>
284 <xsl:with-param name="floatstyle" select="$floatstyle"/>
285 <xsl:with-param name="content" select="$content"/>
289 <xsl:copy-of select="$content"/>
295 <xsl:template name="calsTable">
296 <xsl:if test="d:tgroup/d:tbody/d:tr |d:tgroup/d:thead/d:tr |d:tgroup/d:tfoot/d:tr">
297 <xsl:message terminate="yes">Broken table: tr descendent of CALS Table.</xsl:message>
300 <xsl:variable name="param.placement" select="substring-after(normalize-space($formal.title.placement), concat(local-name(.), ' '))"/>
302 <xsl:variable name="placement">
304 <xsl:when test="contains($param.placement, ' ')">
305 <xsl:value-of select="substring-before($param.placement, ' ')"/>
307 <xsl:when test="$param.placement = ''">before</xsl:when>
309 <xsl:value-of select="$param.placement"/>
314 <xsl:call-template name="formal.object">
315 <xsl:with-param name="placement" select="$placement"/>
319 <xsl:template match="d:table|d:informaltable" mode="class.value">
321 <xsl:when test="@tabstyle">
322 <xsl:value-of select="@tabstyle"/>
325 <xsl:value-of select="local-name(.)"/>
330 <xsl:template name="htmlTable">
331 <xsl:if test="d:tgroup/d:tbody/d:row |d:tgroup/d:thead/d:row |d:tgroup/d:tfoot/d:row">
332 <xsl:message terminate="yes">Broken table: row descendent of HTML table.</xsl:message>
335 <xsl:apply-templates mode="htmlTable"/>
337 <xsl:if test=".//d:footnote|../d:title//d:footnote">
338 <tbody class="footnotes">
341 <xsl:apply-templates select=".//d:footnote|../d:title//d:footnote" mode="table.footnote.mode"/>
348 <xsl:template match="d:example">
349 <xsl:variable name="param.placement" select="substring-after(normalize-space($formal.title.placement), concat(local-name(.), ' '))"/>
351 <xsl:variable name="placement">
353 <xsl:when test="contains($param.placement, ' ')">
354 <xsl:value-of select="substring-before($param.placement, ' ')"/>
356 <xsl:when test="$param.placement = ''">before</xsl:when>
358 <xsl:value-of select="$param.placement"/>
363 <xsl:call-template name="formal.object">
364 <xsl:with-param name="placement" select="$placement"/>
369 <xsl:template match="d:equation">
370 <xsl:variable name="param.placement" select="substring-after(normalize-space($formal.title.placement), concat(local-name(.), ' '))"/>
372 <xsl:variable name="placement">
374 <xsl:when test="contains($param.placement, ' ')">
375 <xsl:value-of select="substring-before($param.placement, ' ')"/>
377 <xsl:when test="$param.placement = ''">before</xsl:when>
379 <xsl:value-of select="$param.placement"/>
384 <xsl:call-template name="formal.object">
385 <xsl:with-param name="placement" select="$placement"/>
390 <xsl:template match="d:figure/d:title"/>
391 <xsl:template match="d:figure/d:titleabbrev"/>
392 <xsl:template match="d:table/d:title"/>
393 <xsl:template match="d:table/d:titleabbrev"/>
394 <xsl:template match="d:table/d:textobject"/>
395 <xsl:template match="d:example/d:title"/>
396 <xsl:template match="d:example/d:titleabbrev"/>
397 <xsl:template match="d:equation/d:title"/>
398 <xsl:template match="d:equation/d:titleabbrev"/>
400 <xsl:template match="d:informalfigure">
401 <xsl:call-template name="informal.object"/>
404 <xsl:template match="d:informalexample">
405 <xsl:call-template name="informal.object"/>
408 <xsl:template match="d:informaltable">
410 <xsl:when test="d:tgroup|d:mediaobject|d:graphic">
411 <xsl:call-template name="informal.object"/>
415 <xsl:call-template name="generate.class.attribute"/>
416 <xsl:call-template name="id.attribute"/>
417 <xsl:call-template name="anchor"/>
418 <xsl:element name="table" namespace="http://www.w3.org/1999/xhtml">
419 <xsl:apply-templates select="@*" mode="htmlTableAtt"/>
420 <xsl:call-template name="htmlTable"/>
427 <xsl:template match="d:informaltable/d:textobject"/>
429 <xsl:template name="table.longdesc">
430 <!-- HACK: This doesn't belong inside formal.objectt; it should be done by -->
431 <!-- the table template, but I want the link to be inside the DIV, so... -->
432 <xsl:variable name="longdesc.uri">
433 <xsl:call-template name="longdesc.uri">
434 <xsl:with-param name="mediaobject" select="."/>
438 <xsl:variable name="irrelevant">
439 <!-- write.longdesc returns the filename ... -->
440 <xsl:call-template name="write.longdesc">
441 <xsl:with-param name="mediaobject" select="."/>
445 <xsl:if test="$html.longdesc != 0 and $html.longdesc.link != 0 and d:textobject[not(d:phrase)]">
446 <xsl:call-template name="longdesc.link">
447 <xsl:with-param name="longdesc.uri" select="$longdesc.uri"/>
452 <xsl:template match="d:informalequation">
453 <xsl:call-template name="informal.object"/>
456 <xsl:template name="floatstyle">
457 <xsl:if test="(@float and @float != '0') or @floatstyle != ''">
459 <xsl:when test="@floatstyle != ''">
460 <xsl:value-of select="@floatstyle"/>
462 <xsl:when test="@float = '1'">
463 <xsl:value-of select="$default.float.class"/>
466 <xsl:value-of select="@float"/>
472 <xsl:template name="floater">
473 <xsl:param name="content"/>
474 <xsl:param name="class" select="'float'"/>
475 <xsl:param name="floatstyle" select="'left'"/>
477 <div class="{$class}">
478 <xsl:if test="$floatstyle = 'left' or $floatstyle = 'right'">
479 <xsl:attribute name="style">
480 <xsl:text>float: </xsl:text>
481 <xsl:value-of select="$floatstyle"/>
482 <xsl:text>;</xsl:text>
485 <xsl:copy-of select="$content"/>