| 1 | <?xml version='1.0'?>
 | 
|---|
| 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 | + ############################################################################## -->
 | 
|---|
| 8 | 
 | 
|---|
| 9 | <xsl:stylesheet
 | 
|---|
| 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'>
 | 
|---|
| 13 | 
 | 
|---|
| 14 |         <doc:reference id="figure" xmlns="">
 | 
|---|
| 15 |                 <referenceinfo>
 | 
|---|
| 16 |                         <releaseinfo role="meta">
 | 
|---|
| 17 |                                 $Id: figure.mod.xsl,v 1.17 2004/01/26 09:43:31 j-devenish Exp $
 | 
|---|
| 18 |                         </releaseinfo>
 | 
|---|
| 19 |                         <authorgroup>
 | 
|---|
| 20 |                                 &ramon;
 | 
|---|
| 21 |                                 &james;
 | 
|---|
| 22 |                         </authorgroup>
 | 
|---|
| 23 |                         <copyright>
 | 
|---|
| 24 |                                 <year>2000</year><year>2001</year><year>2002</year><year>2003</year><year>2004</year>
 | 
|---|
| 25 |                                 <holder>Ramon Casellas</holder>
 | 
|---|
| 26 |                         </copyright>
 | 
|---|
| 27 |                         <revhistory>
 | 
|---|
| 28 |                                 <doc:revision rcasver="1.14">&rev_2003_05;</doc:revision>
 | 
|---|
| 29 |                         </revhistory>
 | 
|---|
| 30 |                 </referenceinfo>
 | 
|---|
| 31 |                 <title>Figures and InformalFigures <filename>figure.mod.xsl</filename></title>
 | 
|---|
| 32 |                 <partintro>
 | 
|---|
| 33 |                         <para>
 | 
|---|
| 34 |                         
 | 
|---|
| 35 |                         <doc:todo>Insert documentation here.</doc:todo>
 | 
|---|
| 36 |                         
 | 
|---|
| 37 |                         </para>
 | 
|---|
| 38 |                 </partintro>
 | 
|---|
| 39 |         </doc:reference>
 | 
|---|
| 40 | 
 | 
|---|
| 41 |         <doc:template xmlns="">
 | 
|---|
| 42 |                 <refpurpose> Typeset a caption for a formal figure  </refpurpose>
 | 
|---|
| 43 |                 <doc:description>
 | 
|---|
| 44 |                         <para>
 | 
|---|
| 45 |                         
 | 
|---|
| 46 |                         Formats a caption, if any, as a centred block.
 | 
|---|
| 47 |                         
 | 
|---|
| 48 |                         </para>
 | 
|---|
| 49 |                 </doc:description>
 | 
|---|
| 50 |                 <doc:variables>
 | 
|---|
| 51 |                         <itemizedlist>
 | 
|---|
| 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>
 | 
|---|
| 55 |                         </itemizedlist>
 | 
|---|
| 56 |                 </doc:variables>
 | 
|---|
| 57 |                 <doc:notes>
 | 
|---|
| 58 |                         <para>
 | 
|---|
| 59 | 
 | 
|---|
| 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.
 | 
|---|
| 64 | 
 | 
|---|
| 65 |                         </para>
 | 
|---|
| 66 |                 </doc:notes>
 | 
|---|
| 67 |                 <doc:samples>
 | 
|---|
| 68 |                         <simplelist type='inline'>
 | 
|---|
| 69 |                                 &test_subfig;
 | 
|---|
| 70 |                         </simplelist>
 | 
|---|
| 71 |                 </doc:samples>
 | 
|---|
| 72 |         </doc:template>
 | 
|---|
| 73 |         <xsl:template name="generate.aux.figure.caption">
 | 
|---|
| 74 |                 <xsl:text>{</xsl:text>
 | 
|---|
| 75 |                 <xsl:value-of select="$latex.figure.caption.style"/>
 | 
|---|
| 76 |                 <xsl:choose>
 | 
|---|
| 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>
 | 
|---|
| 81 |                         </xsl:when>
 | 
|---|
| 82 |                         <xsl:otherwise>
 | 
|---|
| 83 |                                 <xsl:text>{\caption{{</xsl:text>
 | 
|---|
| 84 |                         </xsl:otherwise>
 | 
|---|
| 85 |                 </xsl:choose>
 | 
|---|
| 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" />
 | 
|---|
| 93 |                 </xsl:if>
 | 
|---|
| 94 |                 <xsl:text>}</xsl:text>
 | 
|---|
| 95 |                 <xsl:call-template name="label.id"/>
 | 
|---|
| 96 |                 <xsl:text>}}
</xsl:text>
 | 
|---|
| 97 |         </xsl:template>
 | 
|---|
| 98 | 
 | 
|---|
| 99 |         <doc:template xmlns="">
 | 
|---|
| 100 |                 <refpurpose> Process <doc:db>figure</doc:db> elements </refpurpose>
 | 
|---|
| 101 |                 <doc:description>
 | 
|---|
| 102 |                         <para>
 | 
|---|
| 103 |                         
 | 
|---|
| 104 |                         Formats a formal, <quote>floating</quote> figure with a title and caption.
 | 
|---|
| 105 |                         The figure may contain multiple subfigures.
 | 
|---|
| 106 |                         
 | 
|---|
| 107 |                         </para>
 | 
|---|
| 108 |                 </doc:description>
 | 
|---|
| 109 |                 <doc:variables>
 | 
|---|
| 110 |                         <itemizedlist>
 | 
|---|
| 111 |                                 <listitem><simpara><xref linkend="param.formal.title.placement"/></simpara></listitem>
 | 
|---|
| 112 |                         </itemizedlist>
 | 
|---|
| 113 |                 </doc:variables>
 | 
|---|
| 114 |                 <doc:notes>
 | 
|---|
| 115 |                         <para>
 | 
|---|
| 116 | 
 | 
|---|
| 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.
 | 
|---|
| 121 | 
 | 
|---|
| 122 |                         </para>
 | 
|---|
| 123 |                         <para>
 | 
|---|
| 124 | 
 | 
|---|
| 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>.
 | 
|---|
| 131 | 
 | 
|---|
| 132 |                         </para>
 | 
|---|
| 133 |                         &essential_preamble;
 | 
|---|
| 134 |                 </doc:notes>
 | 
|---|
| 135 |                 <doc:samples>
 | 
|---|
| 136 |                         <simplelist type='inline'>
 | 
|---|
| 137 |                                 &test_subfig;
 | 
|---|
| 138 |                         </simplelist>
 | 
|---|
| 139 |                 </doc:samples>
 | 
|---|
| 140 |                 <doc:seealso>
 | 
|---|
| 141 |                         <itemizedlist>
 | 
|---|
| 142 |                                 <listitem><simpara>&mapping;</simpara></listitem>
 | 
|---|
| 143 |                                 <listitem><simpara><xref linkend="template.generate.aux.figure.caption"/></simpara></listitem>
 | 
|---|
| 144 |                         </itemizedlist>
 | 
|---|
| 145 |                 </doc:seealso>
 | 
|---|
| 146 |         </doc:template>
 | 
|---|
| 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(.)" />
 | 
|---|
| 151 |                         </xsl:call-template>
 | 
|---|
| 152 |                 </xsl:variable>
 | 
|---|
| 153 |                 <xsl:variable name="position">
 | 
|---|
| 154 |                         <xsl:call-template name="generate.latex.float.position">
 | 
|---|
| 155 |                                 <xsl:with-param name="default" select="'hbt'"/>
 | 
|---|
| 156 |                         </xsl:call-template>
 | 
|---|
| 157 |                 </xsl:variable>
 | 
|---|
| 158 |                 <xsl:call-template name="map.begin">
 | 
|---|
| 159 |                         <xsl:with-param name="string" select="$position"/>
 | 
|---|
| 160 |                 </xsl:call-template>
 | 
|---|
| 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>
 | 
|---|
| 165 |                 </xsl:if>
 | 
|---|
| 166 |                 <xsl:apply-templates select="*[name(.) != 'title']"/>
 | 
|---|
| 167 |                 <xsl:if test="$placement!='before'">
 | 
|---|
| 168 |                         <xsl:call-template name="generate.aux.figure.caption" />
 | 
|---|
| 169 |                 </xsl:if>
 | 
|---|
| 170 |                 <xsl:call-template name="map.end">
 | 
|---|
| 171 |                         <xsl:with-param name="string" select="$position"/>
 | 
|---|
| 172 |                 </xsl:call-template>
 | 
|---|
| 173 |         </xsl:template>
 | 
|---|
| 174 | 
 | 
|---|
| 175 |         <doc:template xmlns="">
 | 
|---|
| 176 |                 <refpurpose> Typeset a caption for an informal figure  </refpurpose>
 | 
|---|
| 177 |                 <doc:description>
 | 
|---|
| 178 |                         <para>
 | 
|---|
| 179 |                         
 | 
|---|
| 180 |                         Formats a caption, if any, as a centred block.
 | 
|---|
| 181 |                         
 | 
|---|
| 182 |                         </para>
 | 
|---|
| 183 |                 </doc:description>
 | 
|---|
| 184 |                 <doc:variables>
 | 
|---|
| 185 |                         &no_var;
 | 
|---|
| 186 |                 </doc:variables>
 | 
|---|
| 187 |                 <doc:notes>
 | 
|---|
| 188 |                         <para>
 | 
|---|
| 189 | 
 | 
|---|
| 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
 | 
|---|
| 193 |                                 centred block.
 | 
|---|
| 194 | 
 | 
|---|
| 195 |                         </para>
 | 
|---|
| 196 |                 </doc:notes>
 | 
|---|
| 197 |                 <doc:samples>
 | 
|---|
| 198 |                         <simplelist type='inline'>
 | 
|---|
| 199 |                                 &test_subfig;
 | 
|---|
| 200 |                         </simplelist>
 | 
|---|
| 201 |                 </doc:samples>
 | 
|---|
| 202 |         </doc:template>
 | 
|---|
| 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>
 | 
|---|
| 208 |                 </xsl:if>
 | 
|---|
| 209 |         </xsl:template>
 | 
|---|
| 210 | 
 | 
|---|
| 211 |         <doc:template xmlns="">
 | 
|---|
| 212 |                 <refpurpose>Process <doc:db>informalfigure</doc:db> elements</refpurpose>
 | 
|---|
| 213 |                 <doc:description>
 | 
|---|
| 214 |                         <para>
 | 
|---|
| 215 |                         
 | 
|---|
| 216 |                         Apply templates for an informal figure.
 | 
|---|
| 217 |                         
 | 
|---|
| 218 |                         </para>
 | 
|---|
| 219 |                 </doc:description>
 | 
|---|
| 220 |                 <doc:variables>
 | 
|---|
| 221 |                         &no_var;
 | 
|---|
| 222 |                 </doc:variables>
 | 
|---|
| 223 |                 <doc:notes>
 | 
|---|
| 224 |                         <para>
 | 
|---|
| 225 |                                 The caption is inserted below the informalfigure.
 | 
|---|
| 226 |                         </para>
 | 
|---|
| 227 |                 </doc:notes>
 | 
|---|
| 228 |                 <doc:samples>
 | 
|---|
| 229 |                         <simplelist type='inline'>
 | 
|---|
| 230 |                                 &test_subfig;
 | 
|---|
| 231 |                         </simplelist>
 | 
|---|
| 232 |                 </doc:samples>
 | 
|---|
| 233 |                 <doc:seealso>
 | 
|---|
| 234 |                         <itemizedlist>
 | 
|---|
| 235 |                                 <listitem><simpara>&mapping;</simpara></listitem>
 | 
|---|
| 236 |                                 <listitem><simpara><xref linkend="template.generate.aux.informalfigure.caption"/></simpara></listitem>
 | 
|---|
| 237 |                         </itemizedlist>
 | 
|---|
| 238 |                 </doc:seealso>
 | 
|---|
| 239 |         </doc:template>
 | 
|---|
| 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"/>
 | 
|---|
| 245 |         </xsl:template>
 | 
|---|
| 246 | 
 | 
|---|
| 247 |         <!--
 | 
|---|
| 248 |     <xsl:template match="figure[programlisting]">
 | 
|---|
| 249 |         <xsl:call-template name="map.begin">
 | 
|---|
| 250 |             <xsl:with-param name="keyword" select="programlisting"/>
 | 
|---|
| 251 |         </xsl:call-template>
 | 
|---|
| 252 |         <xsl:apply-templates />
 | 
|---|
| 253 |         <xsl:call-template name="map.end">
 | 
|---|
| 254 |             <xsl:with-param name="keyword" select="programlisting"/>
 | 
|---|
| 255 |         </xsl:call-template>
 | 
|---|
| 256 |     </xsl:template>
 | 
|---|
| 257 |         -->
 | 
|---|
| 258 | 
 | 
|---|
| 259 | </xsl:stylesheet>
 | 
|---|