2
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
5
<!-- ********************************************************************
6
$Id: formal.xsl 1341 2006-08-02 16:35:13Z telrod $
7
********************************************************************
9
This file is part of the XSL DocBook Stylesheet distribution.
10
See ../README or http://nwalsh.com/docbook/xsl/ for copyright
11
and other information.
13
******************************************************************** -->
15
<xsl:template name="formal.object">
16
<xsl:param name="placement" select="'before'"/>
17
<xsl:param name="class" select="local-name(.)"/>
19
<div class="{$class}">
20
<xsl:call-template name="anchor">
21
<xsl:with-param name="conditional" select="0"/>
25
<xsl:when test="$placement = 'before'">
26
<xsl:call-template name="formal.object.heading"/>
27
<xsl:apply-templates/>
29
<!-- HACK: This doesn't belong inside formal.object; it should be done by -->
30
<!-- the table template, but I want the link to be inside the DIV, so... -->
31
<xsl:if test="local-name(.) = 'table'">
32
<xsl:call-template name="table.longdesc"/>
35
<xsl:if test="$spacing.paras != 0"><p/></xsl:if>
38
<xsl:if test="$spacing.paras != 0"><p/></xsl:if>
39
<xsl:apply-templates/>
41
<!-- HACK: This doesn't belong inside formal.object; it should be done by -->
42
<!-- the table template, but I want the link to be inside the DIV, so... -->
43
<xsl:if test="local-name(.) = 'table'">
44
<xsl:call-template name="table.longdesc"/>
47
<xsl:call-template name="formal.object.heading"/>
53
<xsl:template name="formal.object.heading">
54
<xsl:param name="object" select="."/>
57
<xsl:apply-templates select="$object" mode="object.title.markup">
58
<xsl:with-param name="allow-anchors" select="1"/>
59
</xsl:apply-templates>
64
<xsl:template name="informal.object">
65
<xsl:param name="class" select="local-name(.)"/>
67
<div class="{$class}">
68
<xsl:if test="$spacing.paras != 0"><p/></xsl:if>
69
<xsl:call-template name="anchor"/>
70
<xsl:apply-templates/>
72
<!-- HACK: This doesn't belong inside formal.object; it should be done by -->
73
<!-- the table template, but I want the link to be inside the DIV, so... -->
74
<xsl:if test="local-name(.) = 'informaltable'">
75
<xsl:call-template name="table.longdesc"/>
78
<xsl:if test="$spacing.paras != 0"><p/></xsl:if>
82
<xsl:template name="semiformal.object">
83
<xsl:param name="placement" select="'before'"/>
84
<xsl:param name="class" select="local-name(.)"/>
87
<xsl:when test="title">
88
<xsl:call-template name="formal.object">
89
<xsl:with-param name="placement" select="$placement"/>
90
<xsl:with-param name="class" select="$class"/>
94
<xsl:call-template name="informal.object">
95
<xsl:with-param name="class" select="$class"/>
101
<xsl:template match="figure">
102
<xsl:variable name="param.placement"
103
select="substring-after(normalize-space($formal.title.placement),
104
concat(local-name(.), ' '))"/>
106
<xsl:variable name="placement">
108
<xsl:when test="contains($param.placement, ' ')">
109
<xsl:value-of select="substring-before($param.placement, ' ')"/>
111
<xsl:when test="$param.placement = ''">before</xsl:when>
113
<xsl:value-of select="$param.placement"/>
119
<xsl:when test="@float and @float != 0">
120
<xsl:variable name="float">
122
<xsl:when test="@float = 1">
123
<xsl:value-of select="$default.float.class"/>
126
<xsl:value-of select="@float"/>
131
<div class="figure-float">
132
<xsl:if test="$float = 'left' or $float = 'right'">
133
<xsl:attribute name="style">
134
<xsl:text>float: </xsl:text>
135
<xsl:value-of select="$float"/>
136
<xsl:text>;</xsl:text>
139
<xsl:call-template name="formal.object">
140
<xsl:with-param name="placement" select="$placement"/>
145
<xsl:call-template name="formal.object">
146
<xsl:with-param name="placement" select="$placement"/>
152
<xsl:template match="table">
154
<xsl:when test="tgroup|mediaobject|graphic">
155
<xsl:call-template name="calsTable"/>
159
<xsl:copy-of select="@*"/>
160
<xsl:call-template name="htmlTable"/>
166
<xsl:template name="calsTable">
167
<xsl:if test="tgroup/tbody/tr
170
<xsl:message terminate="yes">Broken table: tr descendent of CALS Table.</xsl:message>
173
<xsl:variable name="param.placement"
174
select="substring-after(normalize-space($formal.title.placement),
175
concat(local-name(.), ' '))"/>
177
<xsl:variable name="placement">
179
<xsl:when test="contains($param.placement, ' ')">
180
<xsl:value-of select="substring-before($param.placement, ' ')"/>
182
<xsl:when test="$param.placement = ''">before</xsl:when>
184
<xsl:value-of select="$param.placement"/>
189
<xsl:call-template name="formal.object">
190
<xsl:with-param name="placement" select="$placement"/>
191
<xsl:with-param name="class">
193
<xsl:when test="@tabstyle">
194
<!-- hack, this will only ever occur on table, not example -->
195
<xsl:value-of select="@tabstyle"/>
198
<xsl:value-of select="local-name(.)"/>
205
<xsl:template name="htmlTable">
206
<xsl:if test="tgroup/tbody/row
209
<xsl:message terminate="yes">Broken table: row descendent of HTML table.</xsl:message>
212
<xsl:apply-templates mode="htmlTable"/>
215
<xsl:template match="example">
216
<xsl:variable name="param.placement"
217
select="substring-after(normalize-space($formal.title.placement),
218
concat(local-name(.), ' '))"/>
220
<xsl:variable name="placement">
222
<xsl:when test="contains($param.placement, ' ')">
223
<xsl:value-of select="substring-before($param.placement, ' ')"/>
225
<xsl:when test="$param.placement = ''">before</xsl:when>
227
<xsl:value-of select="$param.placement"/>
232
<xsl:call-template name="formal.object">
233
<xsl:with-param name="placement" select="$placement"/>
234
<xsl:with-param name="class" select="local-name(.)"/>
238
<xsl:template match="equation">
239
<xsl:variable name="param.placement"
240
select="substring-after(normalize-space($formal.title.placement),
241
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="semiformal.object">
256
<xsl:with-param name="placement" select="$placement"/>
260
<xsl:template match="figure/title"></xsl:template>
261
<xsl:template match="figure/titleabbrev"></xsl:template>
262
<xsl:template match="table/title"></xsl:template>
263
<xsl:template match="table/titleabbrev"></xsl:template>
264
<xsl:template match="table/textobject"></xsl:template>
265
<xsl:template match="example/title"></xsl:template>
266
<xsl:template match="example/titleabbrev"></xsl:template>
267
<xsl:template match="equation/title"></xsl:template>
268
<xsl:template match="equation/titleabbrev"></xsl:template>
270
<xsl:template match="informalfigure">
271
<xsl:call-template name="informal.object"/>
274
<xsl:template match="informalexample">
275
<xsl:call-template name="informal.object"/>
278
<xsl:template match="informaltable">
280
<xsl:when test="tgroup|mediaobject|graphic">
281
<xsl:call-template name="informal.object">
282
<xsl:with-param name="class">
284
<xsl:when test="@tabstyle">
285
<xsl:value-of select="@tabstyle"/>
288
<xsl:value-of select="local-name(.)"/>
296
<xsl:copy-of select="@*"/>
297
<xsl:call-template name="htmlTable"/>
303
<xsl:template match="informaltable/textobject"></xsl:template>
305
<xsl:template name="table.longdesc">
306
<!-- HACK: This doesn't belong inside formal.objectt; it should be done by -->
307
<!-- the table template, but I want the link to be inside the DIV, so... -->
308
<xsl:variable name="longdesc.uri">
309
<xsl:call-template name="longdesc.uri">
310
<xsl:with-param name="mediaobject" select="."/>
314
<xsl:variable name="irrelevant">
315
<!-- write.longdesc returns the filename ... -->
316
<xsl:call-template name="write.longdesc">
317
<xsl:with-param name="mediaobject" select="."/>
321
<xsl:if test="$html.longdesc != 0 and $html.longdesc.link != 0
322
and textobject[not(phrase)]">
323
<xsl:call-template name="longdesc.link">
324
<xsl:with-param name="longdesc.uri" select="$longdesc.uri"/>
329
<xsl:template match="informalequation">
330
<xsl:call-template name="informal.object"/>