| 1 | <?xml version='1.0'?>
|
|---|
| 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 | + ############################################################################## -->
|
|---|
| 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="block" xmlns="">
|
|---|
| 15 | <referenceinfo>
|
|---|
| 16 | <releaseinfo role="meta">
|
|---|
| 17 | $Id: block.mod.xsl,v 1.15 2004/01/26 09:44:38 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.6">&rev_2003_05;</doc:revision>
|
|---|
| 29 | </revhistory>
|
|---|
| 30 | </referenceinfo>
|
|---|
| 31 | <title>Block Objects <filename>block.mod.xsl</filename></title>
|
|---|
| 32 | <partintro>
|
|---|
| 33 | <para>The file <filename>block.mod.xsl</filename> contains the
|
|---|
| 34 | XSL templates for sundry block-formatted components.</para>
|
|---|
| 35 | </partintro>
|
|---|
| 36 | </doc:reference>
|
|---|
| 37 |
|
|---|
| 38 | <doc:template xmlns="">
|
|---|
| 39 | <refpurpose>
|
|---|
| 40 | Generic handler for interior elements of block-formatted components
|
|---|
| 41 | </refpurpose>
|
|---|
| 42 | <doc:description>
|
|---|
| 43 | <para>
|
|---|
| 44 | Applies all templates, excluding from <doc:db>title</doc:db>-related
|
|---|
| 45 | and <doc:db>blockinfo</doc:db>-like elements.
|
|---|
| 46 | </para>
|
|---|
| 47 | </doc:description>
|
|---|
| 48 | <doc:params>
|
|---|
| 49 | <variablelist>
|
|---|
| 50 | <varlistentry>
|
|---|
| 51 | <term>info</term>
|
|---|
| 52 | <listitem>
|
|---|
| 53 | <para>
|
|---|
| 54 |
|
|---|
| 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>.
|
|---|
| 60 |
|
|---|
| 61 | </para>
|
|---|
| 62 | </listitem>
|
|---|
| 63 | </varlistentry>
|
|---|
| 64 | </variablelist>
|
|---|
| 65 | </doc:params>
|
|---|
| 66 | </doc:template>
|
|---|
| 67 |
|
|---|
| 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)]"/>
|
|---|
| 71 | </xsl:template>
|
|---|
| 72 |
|
|---|
| 73 | <xsl:template name="content-templates-rootid">
|
|---|
| 74 | <!--
|
|---|
| 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>
|
|---|
| 78 | -->
|
|---|
| 79 | <xsl:choose>
|
|---|
| 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>
|
|---|
| 83 | <xsl:choose>
|
|---|
| 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>
|
|---|
| 89 | </xsl:message>
|
|---|
| 90 | </xsl:when>
|
|---|
| 91 | <xsl:otherwise>
|
|---|
| 92 | <xsl:apply-templates select="$node"/>
|
|---|
| 93 | </xsl:otherwise>
|
|---|
| 94 | </xsl:choose>
|
|---|
| 95 | </xsl:when>
|
|---|
| 96 | <xsl:otherwise>
|
|---|
| 97 | <xsl:call-template name="content-templates"/>
|
|---|
| 98 | </xsl:otherwise>
|
|---|
| 99 | </xsl:choose>
|
|---|
| 100 | </xsl:template>
|
|---|
| 101 |
|
|---|
| 102 | <doc:template xmlns="">
|
|---|
| 103 | <refpurpose>
|
|---|
| 104 | Generic handler for block-formatted components
|
|---|
| 105 | </refpurpose>
|
|---|
| 106 | <doc:description>
|
|---|
| 107 | <para>
|
|---|
| 108 | Calls <xref linkend="template.label.id"/>,
|
|---|
| 109 | applies templates for <doc:db>title</doc:db>,
|
|---|
| 110 | then applies templates for content elements.
|
|---|
| 111 | </para>
|
|---|
| 112 | </doc:description>
|
|---|
| 113 | </doc:template>
|
|---|
| 114 |
|
|---|
| 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"/>
|
|---|
| 120 | </xsl:template>
|
|---|
| 121 |
|
|---|
| 122 | <doc:template xmlns="">
|
|---|
| 123 | <refpurpose>
|
|---|
| 124 | A quotation set off from the main text (not inline)
|
|---|
| 125 | </refpurpose>
|
|---|
| 126 | <doc:description>
|
|---|
| 127 | <para>
|
|---|
| 128 | Uses the &LaTeX; <function condition='env'>quote</function> environment.
|
|---|
| 129 | If an attribution is present, it will be set at the end.
|
|---|
| 130 | </para>
|
|---|
| 131 | </doc:description>
|
|---|
| 132 | <doc:seealso>
|
|---|
| 133 | <itemizedlist>
|
|---|
| 134 | <listitem><para><xref linkend="template.attribution-block.attribution"/></para></listitem>
|
|---|
| 135 | <listitem><para>&mapping;</para></listitem>
|
|---|
| 136 | </itemizedlist>
|
|---|
| 137 | </doc:seealso>
|
|---|
| 138 | </doc:template>
|
|---|
| 139 |
|
|---|
| 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"/>
|
|---|
| 145 | </xsl:template>
|
|---|
| 146 |
|
|---|
| 147 | <doc:template xmlns="">
|
|---|
| 148 | <refpurpose>
|
|---|
| 149 | A short inscription that occurs at the beginning of a section, chapter, or document
|
|---|
| 150 | </refpurpose>
|
|---|
| 151 | <doc:description>
|
|---|
| 152 | <para>
|
|---|
| 153 | Uses the &LaTeX; <function condition='env'>quote</function> environment.
|
|---|
| 154 | If an attribution is present, it will be set at the end.
|
|---|
| 155 | </para>
|
|---|
| 156 | </doc:description>
|
|---|
| 157 | <doc:seealso>
|
|---|
| 158 | <itemizedlist>
|
|---|
| 159 | <listitem><para><xref linkend="template.attribution-block.attribution"/></para></listitem>
|
|---|
| 160 | <listitem><para>&mapping;</para></listitem>
|
|---|
| 161 | </itemizedlist>
|
|---|
| 162 | </doc:seealso>
|
|---|
| 163 | </doc:template>
|
|---|
| 164 |
|
|---|
| 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"/>
|
|---|
| 170 | </xsl:template>
|
|---|
| 171 |
|
|---|
| 172 | <doc:template xmlns="">
|
|---|
| 173 | <refpurpose>
|
|---|
| 174 | This template produces no output
|
|---|
| 175 | </refpurpose>
|
|---|
| 176 | <doc:description>
|
|---|
| 177 | <para>
|
|---|
| 178 |
|
|---|
| 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.
|
|---|
| 185 |
|
|---|
| 186 | </para>
|
|---|
| 187 | </doc:description>
|
|---|
| 188 | </doc:template>
|
|---|
| 189 |
|
|---|
| 190 | <xsl:template match="attribution"/>
|
|---|
| 191 |
|
|---|
| 192 | <doc:template xmlns="">
|
|---|
| 193 | <refpurpose>
|
|---|
| 194 | The source of a block quote or epigraph
|
|---|
| 195 | </refpurpose>
|
|---|
| 196 | <doc:description>
|
|---|
| 197 | <para>
|
|---|
| 198 | Starts a new line with right-aligned text preceded by an em dash.
|
|---|
| 199 | </para>
|
|---|
| 200 | </doc:description>
|
|---|
| 201 | </doc:template>
|
|---|
| 202 |
|
|---|
| 203 | <xsl:template match="attribution" mode="block.attribution">
|
|---|
| 204 | <xsl:text> \hspace*\fill---</xsl:text>
|
|---|
| 205 | <xsl:apply-templates/>
|
|---|
| 206 | </xsl:template>
|
|---|
| 207 |
|
|---|
| 208 | <doc:template xmlns="">
|
|---|
| 209 | <refpurpose>
|
|---|
| 210 | A block of text that is isolated from the main flow
|
|---|
| 211 | </refpurpose>
|
|---|
| 212 | <doc:description>
|
|---|
| 213 | <para>
|
|---|
| 214 | This is formatted as a plain block.
|
|---|
| 215 | </para>
|
|---|
| 216 | </doc:description>
|
|---|
| 217 | <doc:notes>
|
|---|
| 218 | <para>
|
|---|
| 219 | This template should create sidebars (but it doesn't)!
|
|---|
| 220 | </para>
|
|---|
| 221 | </doc:notes>
|
|---|
| 222 | <doc:seealso>
|
|---|
| 223 | <itemizedlist>
|
|---|
| 224 | <listitem><para><xref linkend="template.block.object"/></para></listitem>
|
|---|
| 225 | </itemizedlist>
|
|---|
| 226 | </doc:seealso>
|
|---|
| 227 | </doc:template>
|
|---|
| 228 |
|
|---|
| 229 | <xsl:template match="sidebar">
|
|---|
| 230 | <xsl:call-template name="block.object"/>
|
|---|
| 231 | </xsl:template>
|
|---|
| 232 |
|
|---|
| 233 | <doc:template xmlns="">
|
|---|
| 234 | <refpurpose>
|
|---|
| 235 | Titles and subtitles
|
|---|
| 236 | </refpurpose>
|
|---|
| 237 | <doc:description>
|
|---|
| 238 | <para>
|
|---|
| 239 | Simply applies templates.
|
|---|
| 240 | </para>
|
|---|
| 241 | <para>
|
|---|
| 242 |
|
|---|
| 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
|
|---|
| 251 | used).
|
|---|
| 252 |
|
|---|
| 253 | </para>
|
|---|
| 254 | <para>
|
|---|
| 255 |
|
|---|
| 256 | This template is also used by &mapping;.
|
|---|
| 257 |
|
|---|
| 258 | </para>
|
|---|
| 259 | </doc:description>
|
|---|
| 260 | <doc:variables>
|
|---|
| 261 | <itemizedlist>
|
|---|
| 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>
|
|---|
| 274 | </itemizedlist>
|
|---|
| 275 | </doc:variables>
|
|---|
| 276 | <doc:seealso>
|
|---|
| 277 | <itemizedlist>
|
|---|
| 278 | <listitem><para>&mapping;</para></listitem>
|
|---|
| 279 | <listitem><para><xref linkend="template.content-templates"/></para></listitem>
|
|---|
| 280 | </itemizedlist>
|
|---|
| 281 | </doc:seealso>
|
|---|
| 282 | </doc:template>
|
|---|
| 283 |
|
|---|
| 284 | <xsl:template match="title|subtitle">
|
|---|
| 285 | <xsl:apply-templates/>
|
|---|
| 286 | </xsl:template>
|
|---|
| 287 |
|
|---|
| 288 | <doc:template xmlns="">
|
|---|
| 289 | <refpurpose>
|
|---|
| 290 | Captions generated from <doc:db>title</doc:db>s
|
|---|
| 291 | </refpurpose>
|
|---|
| 292 | <doc:description>
|
|---|
| 293 | <para>
|
|---|
| 294 | Simply applies templates.
|
|---|
| 295 | </para>
|
|---|
| 296 | <para>
|
|---|
| 297 | The formatting of titles in <literal>caption.mode</literal> may
|
|---|
| 298 | depend on the enclosing element's template.
|
|---|
| 299 | </para>
|
|---|
| 300 | </doc:description>
|
|---|
| 301 | <doc:variables>
|
|---|
| 302 | <itemizedlist>
|
|---|
| 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>
|
|---|
| 316 | </itemizedlist>
|
|---|
| 317 | </doc:variables>
|
|---|
| 318 | <doc:notes>
|
|---|
| 319 | <para>
|
|---|
| 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.
|
|---|
| 323 | </para>
|
|---|
| 324 | </doc:notes>
|
|---|
| 325 | </doc:template>
|
|---|
| 326 |
|
|---|
| 327 | <xsl:template match="title|subtitle" mode="caption.mode">
|
|---|
| 328 | <xsl:apply-templates/>
|
|---|
| 329 | </xsl:template>
|
|---|
| 330 |
|
|---|
| 331 | <doc:template xmlns="">
|
|---|
| 332 | <refpurpose>
|
|---|
| 333 | Acknowledgements in an <doc:db>article</doc:db>
|
|---|
| 334 | </refpurpose>
|
|---|
| 335 | <doc:description>
|
|---|
| 336 | <para>
|
|---|
| 337 | This is formatted as a plain block by applying templates
|
|---|
| 338 | with leading and trailing blank lines.
|
|---|
| 339 | </para>
|
|---|
| 340 | </doc:description>
|
|---|
| 341 | <doc:variables>
|
|---|
| 342 | &no_var;
|
|---|
| 343 | </doc:variables>
|
|---|
| 344 | <doc:samples>
|
|---|
| 345 | <simplelist type='inline'>
|
|---|
| 346 | &test_article;
|
|---|
| 347 | </simplelist>
|
|---|
| 348 | </doc:samples>
|
|---|
| 349 | </doc:template>
|
|---|
| 350 |
|
|---|
| 351 | <xsl:template match="ackno">
|
|---|
| 352 | <xsl:text> </xsl:text>
|
|---|
| 353 | <xsl:apply-templates/>
|
|---|
| 354 | <xsl:text> </xsl:text>
|
|---|
| 355 | </xsl:template>
|
|---|
| 356 |
|
|---|
| 357 | <doc:template>
|
|---|
| 358 | <refpurpose> Interpret a user's placement preferences for certain &LaTeX; floats </refpurpose>
|
|---|
| 359 | <doc:notes>
|
|---|
| 360 | <para>
|
|---|
| 361 |
|
|---|
| 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.
|
|---|
| 370 |
|
|---|
| 371 | </para>
|
|---|
| 372 | <para>
|
|---|
| 373 |
|
|---|
| 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.
|
|---|
| 377 |
|
|---|
| 378 | </para>
|
|---|
| 379 | </doc:notes>
|
|---|
| 380 | </doc:template>
|
|---|
| 381 | <xsl:template name="generate.latex.float.position">
|
|---|
| 382 | <xsl:param name="default" select="'hbt'"/>
|
|---|
| 383 | <xsl:choose>
|
|---|
| 384 | <xsl:when test="processing-instruction('latex-float-placement')">
|
|---|
| 385 | <xsl:value-of select="processing-instruction('latex-float-placement')"/>
|
|---|
| 386 | </xsl:when>
|
|---|
| 387 | <xsl:when test="starts-with(@condition, 'db2latex:')">
|
|---|
| 388 | <xsl:value-of select="substring-after(@condition, 'db2latex:')"/>
|
|---|
| 389 | </xsl:when>
|
|---|
| 390 | <xsl:otherwise>
|
|---|
| 391 | <xsl:value-of select="$default"/>
|
|---|
| 392 | </xsl:otherwise>
|
|---|
| 393 | </xsl:choose>
|
|---|
| 394 | </xsl:template>
|
|---|
| 395 | </xsl:stylesheet>
|
|---|
| 396 |
|
|---|