2 <!DOCTYPE xsl:stylesheet [ <!ENTITY % xsldoc.ent SYSTEM "./xsldoc.ent"> %xsldoc.ent; ]>
3 <!--#############################################################################
4 | $Id: block.mod.xsl,v 1.15 2004/01/26 09:44:38 j-devenish Exp $
5 |- #############################################################################
6 | $Author: j-devenish $
7 + ############################################################################## -->
10 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
11 xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
12 exclude-result-prefixes="doc" version='1.0'>
14 <doc:reference id="block" xmlns="">
16 <releaseinfo role="meta">
17 $Id: block.mod.xsl,v 1.15 2004/01/26 09:44:38 j-devenish Exp $
24 <year>2000</year><year>2001</year><year>2002</year><year>2003</year><year>2004</year>
25 <holder>Ramon Casellas</holder>
28 <doc:revision rcasver="1.6">&rev_2003_05;</doc:revision>
31 <title>Block Objects <filename>block.mod.xsl</filename></title>
33 <para>The file <filename>block.mod.xsl</filename> contains the
34 XSL templates for sundry block-formatted components.</para>
38 <doc:template xmlns="">
40 Generic handler for interior elements of block-formatted components
44 Applies all templates, excluding from <doc:db>title</doc:db>-related
45 and <doc:db>blockinfo</doc:db>-like elements.
55 The name of the &DocBook; <quote>info</quote>-type
56 element for this component. By default, this is equal
57 to the name of the component with <literal>info</literal>
58 appended. For example: <doc:db>sectioninfo</doc:db>
59 for <doc:db>section</doc:db>.
68 <xsl:template name="content-templates">
69 <xsl:param name="info" select="concat(local-name(.),'info')"/>
70 <xsl:apply-templates select="node()[not(self::title or self::subtitle or self::titleabbrev or self::blockinfo or self::docinfo or local-name(.)=$info)]"/>
73 <xsl:template name="content-templates-rootid">
75 <xsl:message>Rootid <xsl:value-of select="$rootid"/></xsl:message>
76 <xsl:message>local-name(.) <xsl:value-of select="local-name(.)"/></xsl:message>
77 <xsl:message>count(ancestor::*) <xsl:value-of select="count(ancestor::*)"/></xsl:message>
80 <xsl:when test="$rootid != '' and count(ancestor::*) = 0">
81 <xsl:variable name="node" select="key('id', $rootid)"/>
82 <xsl:message>count($node) <xsl:value-of select="count($node)"/></xsl:message>
84 <xsl:when test="count($node) = 0">
85 <xsl:message terminate="yes">
86 <xsl:text>Root ID '</xsl:text>
87 <xsl:value-of select="$rootid"/>
88 <xsl:text>' not found in document.</xsl:text>
92 <xsl:apply-templates select="$node"/>
97 <xsl:call-template name="content-templates"/>
102 <doc:template xmlns="">
104 Generic handler for block-formatted components
108 Calls <xref linkend="template.label.id"/>,
109 applies templates for <doc:db>title</doc:db>,
110 then applies templates for content elements.
115 <xsl:template name="block.object">
116 <xsl:call-template name="label.id"/>
117 <xsl:apply-templates select="title"/>
118 <xsl:text> </xsl:text>
119 <xsl:call-template name="content-templates"/>
122 <doc:template xmlns="">
124 A quotation set off from the main text (not inline)
128 Uses the &LaTeX; <function condition='env'>quote</function> environment.
129 If an attribution is present, it will be set at the end.
134 <listitem><para><xref linkend="template.attribution-block.attribution"/></para></listitem>
135 <listitem><para>&mapping;</para></listitem>
140 <xsl:template match="blockquote">
141 <xsl:call-template name="map.begin"/>
142 <xsl:apply-templates/>
143 <xsl:apply-templates select="attribution" mode="block.attribution"/>
144 <xsl:call-template name="map.end"/>
147 <doc:template xmlns="">
149 A short inscription that occurs at the beginning of a section, chapter, or document
153 Uses the &LaTeX; <function condition='env'>quote</function> environment.
154 If an attribution is present, it will be set at the end.
159 <listitem><para><xref linkend="template.attribution-block.attribution"/></para></listitem>
160 <listitem><para>&mapping;</para></listitem>
165 <xsl:template match="epigraph">
166 <xsl:call-template name="map.begin"/>
167 <xsl:apply-templates/>
168 <xsl:apply-templates select="attribution" mode="block.attribution"/>
169 <xsl:call-template name="map.end"/>
172 <doc:template xmlns="">
174 This template produces no output
179 The <doc:db>attribution</doc:db> element only occurs within <xref
180 linkend="template.blockquote"/> and <xref
181 linkend="template.epigraph"/>. However, the templates for those
182 elements use a <quote>mode</quote> mechanism. Therefore, this
183 template is intentionally suppressed and a replacement exists. See
184 <xref linkend="template.attribution-block.attribution"/> instead.
190 <xsl:template match="attribution"/>
192 <doc:template xmlns="">
194 The source of a block quote or epigraph
198 Starts a new line with right-aligned text preceded by an em dash.
203 <xsl:template match="attribution" mode="block.attribution">
204 <xsl:text> \hspace*\fill---</xsl:text>
205 <xsl:apply-templates/>
208 <doc:template xmlns="">
210 A block of text that is isolated from the main flow
214 This is formatted as a plain block.
219 This template should create sidebars (but it doesn't)!
224 <listitem><para><xref linkend="template.block.object"/></para></listitem>
229 <xsl:template match="sidebar">
230 <xsl:call-template name="block.object"/>
233 <doc:template xmlns="">
239 Simply applies templates.
243 This is the default template, for <doc:db
244 basename="title">title</doc:db> and <doc:db
245 basename="subtitle">subtitles</doc:db>. The use of this
246 template is controlled by the template for closing elements,
247 which will often not apply templates for <sgmltag
248 class="starttag">subtitles</sgmltag>. Furthermore, there may be
249 templates to match <sgmltag class="starttag">titles</sgmltag>
250 in specific contexts (in which case this template will not be
256 This template is also used by &mapping;.
262 <listitem><simpara><xref linkend="param.latex.apply.title.templates"/></simpara></listitem>
263 <listitem><simpara><xref linkend="param.latex.apply.title.templates.admonitions"/></simpara></listitem>
264 <listitem><simpara><xref linkend="param.formal.title.placement"/></simpara></listitem>
265 <listitem><simpara><xref linkend="param.latex.maketitle"/></simpara></listitem>
266 <listitem><simpara><xref linkend="param.latex.titlepage.file"/></simpara></listitem>
267 <listitem><simpara><xref linkend="param.latex.formalpara.title.style"/></simpara></listitem>
268 <listitem><simpara><xref linkend="param.latex.step.title.style"/></simpara></listitem>
269 <listitem><simpara><xref linkend="param.latex.book.article.title.style"/></simpara></listitem>
270 <listitem><simpara><xref linkend="param.latex.article.title.style"/></simpara></listitem>
271 <listitem><simpara><xref linkend="param.latex.procedure.title.style"/></simpara></listitem>
272 <listitem><simpara><xref linkend="param.latex.formalpara.title.style"/></simpara></listitem>
273 <listitem><simpara><xref linkend="param.latex.figure.title.style"/></simpara></listitem>
278 <listitem><para>&mapping;</para></listitem>
279 <listitem><para><xref linkend="template.content-templates"/></para></listitem>
284 <xsl:template match="title|subtitle">
285 <xsl:apply-templates/>
288 <doc:template xmlns="">
290 Captions generated from <doc:db>title</doc:db>s
294 Simply applies templates.
297 The formatting of titles in <literal>caption.mode</literal> may
298 depend on the enclosing element's template.
303 <listitem><simpara><xref linkend="param.latex.formalpara.title.style"/></simpara></listitem>
304 <listitem><simpara><xref linkend="param.latex.step.title.style"/></simpara></listitem>
305 <listitem><simpara><xref linkend="param.latex.book.article.title.style"/></simpara></listitem>
306 <listitem><simpara><xref linkend="param.latex.article.title.style"/></simpara></listitem>
307 <listitem><simpara><xref linkend="param.latex.procedure.title.style"/></simpara></listitem>
308 <listitem><simpara><xref linkend="param.latex.formalpara.title.style"/></simpara></listitem>
309 <listitem><simpara><xref linkend="param.latex.figure.title.style"/></simpara></listitem>
310 <listitem><simpara><xref linkend="param.formal.title.placement"/></simpara></listitem>
311 <listitem><simpara><xref linkend="param.latex.caption.swapskip"/></simpara></listitem>
312 <listitem><simpara><xref linkend="param.latex.equation.caption.style"/></simpara></listitem>
313 <listitem><simpara><xref linkend="param.latex.example.caption.style"/></simpara></listitem>
314 <listitem><simpara><xref linkend="param.latex.figure.caption.style"/></simpara></listitem>
315 <listitem><simpara><xref linkend="param.latex.table.caption.style"/></simpara></listitem>
320 Since captions may be incorporated into hyperlinks and
321 tables of cross references, <quote>anchor</quote>-type
322 elements should not be applied when in this mode.
327 <xsl:template match="title|subtitle" mode="caption.mode">
328 <xsl:apply-templates/>
331 <doc:template xmlns="">
333 Acknowledgements in an <doc:db>article</doc:db>
337 This is formatted as a plain block by applying templates
338 with leading and trailing blank lines.
345 <simplelist type='inline'>
351 <xsl:template match="ackno">
352 <xsl:text> </xsl:text>
353 <xsl:apply-templates/>
354 <xsl:text> </xsl:text>
358 <refpurpose> Interpret a user's placement preferences for certain &LaTeX; floats </refpurpose>
362 This template should be invoked when the current node is a
363 <doc:db>figure</doc:db> or <doc:db>table</doc:db>. If a
364 <sgmltag class="attribute">condition</sgmltag> attribute exists
365 and begins with <quote>db2latex:</quote>, or a <sgmltag
366 class="pi">latex-float-placement</sgmltag> processing
367 instruction is present, the remainder of its value will be used
368 as the &LaTeX; <quote>float</quote> placement. Otherwise, the
369 default placement is determined by the element's template.
374 Currently, this template is used for <doc:db>figure</doc:db>s
375 and <doc:db>table</doc:db>s but not <doc:db>example</doc:db>s
376 or <doc:db>equation</doc:db>s.
381 <xsl:template name="generate.latex.float.position">
382 <xsl:param name="default" select="'hbt'"/>
384 <xsl:when test="processing-instruction('latex-float-placement')">
385 <xsl:value-of select="processing-instruction('latex-float-placement')"/>
387 <xsl:when test="starts-with(@condition, 'db2latex:')">
388 <xsl:value-of select="substring-after(@condition, 'db2latex:')"/>
391 <xsl:value-of select="$default"/>