2 <!DOCTYPE xsl:stylesheet [ <!ENTITY % xsldoc.ent SYSTEM "./xsldoc.ent"> %xsldoc.ent; ]>
3 <!--#############################################################################
4 | $Id: figure.mod.xsl,v 1.17 2004/01/26 09:43:31 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="figure" xmlns="">
16 <releaseinfo role="meta">
17 $Id: figure.mod.xsl,v 1.17 2004/01/26 09:43:31 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.14">&rev_2003_05;</doc:revision>
31 <title>Figures and InformalFigures <filename>figure.mod.xsl</filename></title>
35 <doc:todo>Insert documentation here.</doc:todo>
41 <doc:template xmlns="">
42 <refpurpose> Typeset a caption for a formal figure </refpurpose>
46 Formats a caption, if any, as a centred block.
52 <listitem><simpara><xref linkend="param.latex.figure.caption.style"/></simpara></listitem>
53 <listitem><simpara><xref linkend="param.latex.caption.lot.titles.only"/></simpara></listitem>
54 <listitem><simpara><xref linkend="param.latex.figure.title.style"/></simpara></listitem>
60 The &LaTeX; caption is a combination of <doc:db>title</doc:db>
61 and <doc:db>caption</doc:db> children.
62 A <link linkend="template.lot">list of figures</link>
63 will contain cross-references to these formal figures.
68 <simplelist type='inline'>
73 <xsl:template name="generate.aux.figure.caption">
74 <xsl:text>{</xsl:text>
75 <xsl:value-of select="$latex.figure.caption.style"/>
77 <xsl:when test="$latex.caption.lot.titles.only='1'">
78 <xsl:text>{\caption[{</xsl:text>
79 <xsl:apply-templates select="title"/>
80 <xsl:text>}]{{</xsl:text>
83 <xsl:text>{\caption{{</xsl:text>
86 <xsl:value-of select="$latex.figure.title.style"/>
87 <xsl:text>{</xsl:text>
88 <xsl:apply-templates select="title"/>
89 <xsl:text>}}</xsl:text>
90 <xsl:if test="count(child::mediaobject/caption)=1">
91 <xsl:text>. </xsl:text>
92 <xsl:apply-templates select="mediaobject/caption" />
94 <xsl:text>}</xsl:text>
95 <xsl:call-template name="label.id"/>
96 <xsl:text>}} </xsl:text>
99 <doc:template xmlns="">
100 <refpurpose> Process <doc:db>figure</doc:db> elements </refpurpose>
104 Formats a formal, <quote>floating</quote> figure with a title and caption.
105 The figure may contain multiple subfigures.
111 <listitem><simpara><xref linkend="param.formal.title.placement"/></simpara></listitem>
117 If the figure contains only one mediaobject, that mediaobject's
118 caption will be used as the figure caption. However, if there
119 are multiple meid in the figure, then it will be divided into
120 subfigures with their own caption.
125 If a <sgmltag class="attribute">condition</sgmltag> attribute
126 exists and begins with <quote>db2latex:</quote>, or a <sgmltag
127 class="pi">latex-float-placement</sgmltag> processing
128 instruction is present, the remainder of its value will be used
129 as the &LaTeX; <quote>float</quote> placement. Otherwise, the
130 default placement is <quote>hbt</quote>.
136 <simplelist type='inline'>
142 <listitem><simpara>&mapping;</simpara></listitem>
143 <listitem><simpara><xref linkend="template.generate.aux.figure.caption"/></simpara></listitem>
147 <xsl:template match="figure">
148 <xsl:variable name="placement">
149 <xsl:call-template name="generate.formal.title.placement">
150 <xsl:with-param name="object" select="local-name(.)" />
153 <xsl:variable name="position">
154 <xsl:call-template name="generate.latex.float.position">
155 <xsl:with-param name="default" select="'hbt'"/>
158 <xsl:call-template name="map.begin">
159 <xsl:with-param name="string" select="$position"/>
161 <xsl:if test="$placement='before'">
162 <xsl:text>\captionswapskip{}</xsl:text>
163 <xsl:call-template name="generate.aux.figure.caption" />
164 <xsl:text>\captionswapskip{}</xsl:text>
166 <xsl:apply-templates select="*[name(.) != 'title']"/>
167 <xsl:if test="$placement!='before'">
168 <xsl:call-template name="generate.aux.figure.caption" />
170 <xsl:call-template name="map.end">
171 <xsl:with-param name="string" select="$position"/>
175 <doc:template xmlns="">
176 <refpurpose> Typeset a caption for an informal figure </refpurpose>
180 Formats a caption, if any, as a centred block.
190 A caption, if any, is gleaned from the <doc:db>caption</doc:db>
191 child of any <doc:db>mediaobject</doc:db> contained within the
192 <doc:db>informalfigure</doc:db>, and will be formatted as a
198 <simplelist type='inline'>
203 <xsl:template name="generate.aux.informalfigure.caption">
204 <xsl:if test="count(child::mediaobject/caption)=1">
205 <xsl:text>\begin{center} </xsl:text>
206 <xsl:apply-templates select="mediaobject/caption" />
207 <xsl:text>\end{center} </xsl:text>
211 <doc:template xmlns="">
212 <refpurpose>Process <doc:db>informalfigure</doc:db> elements</refpurpose>
216 Apply templates for an informal figure.
225 The caption is inserted below the informalfigure.
229 <simplelist type='inline'>
235 <listitem><simpara>&mapping;</simpara></listitem>
236 <listitem><simpara><xref linkend="template.generate.aux.informalfigure.caption"/></simpara></listitem>
240 <xsl:template match="informalfigure">
241 <xsl:call-template name="map.begin"/>
242 <xsl:apply-templates/>
243 <xsl:call-template name="generate.aux.informalfigure.caption" />
244 <xsl:call-template name="map.end"/>
248 <xsl:template match="figure[programlisting]">
249 <xsl:call-template name="map.begin">
250 <xsl:with-param name="keyword" select="programlisting"/>
252 <xsl:apply-templates />
253 <xsl:call-template name="map.end">
254 <xsl:with-param name="keyword" select="programlisting"/>