Next update of VFS modules development guide
[vlendec/samba-autobuild/.git] / docs / xslt / db2latex-xsl / xsl / book-article.mod.xsl
1 <?xml version='1.0'?>
2 <!DOCTYPE xsl:stylesheet [ <!ENTITY % xsldoc.ent SYSTEM "./xsldoc.ent"> %xsldoc.ent; ]>
3 <!--############################################################################# 
4 |       $Id: book-article.mod.xsl,v 1.41 2004/01/31 11:05:54 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="book-article" xmlns="">
15                 <referenceinfo>
16                         <releaseinfo role="meta">
17                                 $Id: book-article.mod.xsl,v 1.41 2004/01/31 11:05:54 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>
25                                 <holder>Ramon Casellas</holder>
26                         </copyright>
27                         <revhistory>
28                                 <doc:revision rcasver="1.28">&rev_2003_05;</doc:revision>
29                         </revhistory>
30                 </referenceinfo>
31                 <title>Books and Articles <filename>book-article.mod.xsl</filename></title>
32                 <partintro>
33
34                         <para>
35
36                         Most &DocBook; documents are either <doc:db
37                         basename="article">articles</doc:db> or <doc:db
38                         basename="book">books</doc:db>, so this XSL template file is a
39                         classical entry point when processing &DocBook; documents.
40
41                         </para>
42
43                         <!--
44                         <doc:variables>
45                                 &no_var;
46                         </doc:variables>
47                         -->
48                 </partintro>
49         </doc:reference>
50
51         <doc:template basename="book" xmlns="">
52                 <refpurpose>Process a &DocBook; <doc:db>book</doc:db> document</refpurpose>
53                 <doc:description>
54                         <para>
55                                 Entry point for <doc:db basename="book">books</doc:db>.
56                         </para>
57                 </doc:description>
58                 <doc:variables>
59                         <itemizedlist>
60                                 <listitem><simpara><xref linkend="param.latex.book.afterauthor"/></simpara></listitem>
61                                 <listitem><simpara><xref linkend="param.toc.section.depth"/></simpara></listitem>
62                                 <listitem><simpara><xref linkend="param.section.depth"/></simpara></listitem>
63                                 <listitem><simpara><xref linkend="param.latex.book.begindocument"/></simpara></listitem>
64                                 <listitem><simpara><xref linkend="param.latex.titlepage.file"/></simpara></listitem>
65                                 <listitem><simpara><xref linkend="param.latex.maketitle"/></simpara></listitem>
66                         </itemizedlist>
67                 </doc:variables>
68                 <!--
69                 <doc:notes>
70                 </doc:notes>
71                 -->
72                 <doc:samples>
73                         <simplelist type='inline'>
74                                 &test_book;
75                                 &test_defguide;
76                         </simplelist>
77                 </doc:samples>
78                 <doc:seealso>
79                         <itemizedlist>
80                                 <listitem><simpara>&mapping;</simpara></listitem>
81                                 <listitem><simpara><xref linkend="template.generate.latex.book.preamble"/></simpara></listitem>
82                         </itemizedlist>
83                 </doc:seealso>
84         </doc:template>
85         <xsl:template match="book">
86                 <!-- book:1: generate.latex.book.preamble -->
87                 <xsl:call-template name="generate.latex.book.preamble"/>
88                 <!-- book:2: output title information     -->
89                 <xsl:text>\title{</xsl:text>
90                         <xsl:apply-templates select="title|bookinfo/title"/>
91                         <xsl:apply-templates select="subtitle|bookinfo/subtitle"/>
92                 <xsl:text>}&#10;</xsl:text>
93                 <!-- book:3: output author information     -->
94                 <xsl:text>\author{</xsl:text>
95                 <xsl:choose>
96                         <xsl:when test="bookinfo/authorgroup">
97                                 <xsl:apply-templates select="bookinfo/authorgroup"/>
98                         </xsl:when>
99                         <xsl:otherwise>
100                                 <xsl:for-each select="bookinfo">
101                                         <xsl:call-template name="authorgroup"/>
102                                 </xsl:for-each>
103                         </xsl:otherwise>
104                 </xsl:choose>
105                 <xsl:text>}&#10;</xsl:text>
106                 <!-- book:4: dump any preamble after author  -->
107                 <xsl:value-of select="$latex.book.afterauthor"/>
108                 <!-- book:5: set some counters  -->
109                 <xsl:text>&#10;\setcounter{tocdepth}{</xsl:text><xsl:value-of select="$toc.section.depth"/><xsl:text>}&#10;</xsl:text>
110                 <xsl:text>&#10;\setcounter{secnumdepth}{</xsl:text><xsl:value-of select="$section.depth"/><xsl:text>}&#10;</xsl:text>
111                 <!-- book:6: dump the begin document command  -->
112                 <xsl:value-of select="$latex.book.begindocument"/>
113                 <!-- book:7: include external Cover page if specified -->
114                 <xsl:if test="$latex.titlepage.file != ''">
115                         <xsl:text>&#10;\InputIfFileExists{</xsl:text><xsl:value-of select="$latex.titlepage.file"/>
116                         <xsl:text>}{\typeout{WARNING: Using cover page </xsl:text>
117                         <xsl:value-of select="$latex.titlepage.file"/>
118                         <xsl:text>}}</xsl:text>
119                 </xsl:if>
120                 <!-- book:7b: maketitle and set up pagestyle -->
121                 <xsl:value-of select="$latex.maketitle"/>
122                 <!-- book:8: - APPLY TEMPLATES -->
123                 <xsl:apply-templates select="bookinfo"/>
124                 <xsl:call-template name="content-templates-rootid"/>
125                 <!-- book:9:  call map.end -->
126                 <xsl:call-template name="map.end"/>
127         </xsl:template>
128
129         <doc:template basename="title" xmlns="">
130                 <refpurpose>Process <doc:db>title</doc:db> elements</refpurpose>
131                 <doc:description>
132                         <para>
133                                 Typesets a bold title.
134                         </para>
135                 </doc:description>
136         </doc:template>
137         <xsl:template match="book/title">\bfseries <xsl:apply-templates/></xsl:template>
138
139         <doc:template basename="subtitle" xmlns="">
140                 <refpurpose>Process <doc:db>subtitle</doc:db> elements</refpurpose>
141                 <doc:description>
142                         <para>
143                                 Typesets a bold subtitle, spaced 12pt from the preceding <doc:db>title</doc:db>.
144                         </para>
145                 </doc:description>
146         </doc:template>
147         <xsl:template match="book/subtitle">\\[12pt]\normalsize <xsl:apply-templates/></xsl:template>
148
149         <doc:template basename="title" xmlns="">
150                 <refpurpose>Process <doc:db>title</doc:db> elements</refpurpose>
151                 <doc:description>
152                         <para>
153                                 Typesets a bold title.
154                         </para>
155                 </doc:description>
156         </doc:template>
157         <xsl:template match="book/bookinfo/title">\bfseries <xsl:apply-templates/></xsl:template>
158
159         <doc:template basename="subtitle" xmlns="">
160                 <refpurpose>Process <doc:db>subtitle</doc:db> elements</refpurpose>
161                 <doc:description>
162                         <para>
163                                 Typesets a bold subtitle, spaced 12pt from the preceding <doc:db>title</doc:db>.
164                         </para>
165                 </doc:description>
166         </doc:template>
167         <xsl:template match="book/bookinfo/subtitle">\\[12pt]\normalsize <xsl:apply-templates/></xsl:template>
168
169         <doc:template xmlns="">
170                 <refpurpose>Process <doc:db>bookinfo</doc:db> elements</refpurpose>
171                 <doc:description>
172                         <para>
173                                 Processes a <doc:db>book</doc:db>'s <doc:db>bookinfo</doc:db>
174                                 (will be invoked after the title page has been typeset).
175                         </para>
176                 </doc:description>
177                 <doc:notes>
178                         <para>
179
180                                 Only the <doc:db>revhistory</doc:db>,
181                                 <doc:db>abstract</doc:db>, <doc:db>keywordset</doc:db>,
182                                 <doc:db>copyright</doc:db> and <doc:db>legalnotice</doc:db> are
183                                 processed. Users may override this in their customisation
184                                 layer.
185
186                         </para>
187                 </doc:notes>
188         </doc:template>
189         <xsl:template match="book/bookinfo">
190                 <xsl:apply-templates select="revhistory" />
191                 <xsl:apply-templates select="copyright" />
192                 <xsl:apply-templates select="keywordset" />
193                 <xsl:apply-templates select="legalnotice" />
194                 <xsl:apply-templates select="abstract" />
195         </xsl:template>
196
197         <doc:template basename="copyright" xmlns="">
198                 <refpurpose>Process <doc:db>bookinfo</doc:db>'s <doc:db>copyright</doc:db> elements</refpurpose>
199                 <doc:description>
200                         <para>
201                                 Formats a block-style copyright.
202                         </para>
203                 </doc:description>
204                 <doc:variables>
205                         &no_var;
206                 </doc:variables>
207                 <doc:description>
208                         <para>Calls <xref linkend="template.copyright"/>.</para>
209                 </doc:description>
210         </doc:template>
211         <xsl:template match="bookinfo/copyright">
212                 <xsl:text>\begin{center}</xsl:text>
213                 <xsl:call-template name="copyright"/>
214                 <xsl:text>\end{center}&#10;</xsl:text>
215         </xsl:template>
216
217         <doc:template basename="article" xmlns="">
218                 <refpurpose>Process a <doc:db>book</doc:db>'s <doc:db>article</doc:db> elements</refpurpose>
219                 <doc:description>
220                         <para>
221                                 Entry point for a <literal>book</literal>'s <doc:db basename="article">articles</doc:db>.
222                         </para>
223                 </doc:description>
224                 <doc:variables>
225                         <itemizedlist>
226                                 <listitem><simpara><xref linkend="param.latex.book.article.title.style"/></simpara></listitem>
227                                 <listitem><simpara><xref linkend="param.latex.book.article.header.style"/></simpara></listitem>
228                         </itemizedlist>
229                 </doc:variables>
230                 <doc:notes>
231                         <para>
232                                 For double-sided books, each article will commence on a right-hand page.
233                         </para>
234                         <para>
235                                 
236                                 This template will call upon the following variables or
237                                 templates in this order:
238                                 <literal>generate.latex.pagestyle</literal>,
239                                 <literal>title</literal> (or <doc:db>articleinfo</doc:db> or
240                                 <doc:db>artheader</doc:db>),
241                                 <literal>$latex.book.article.title.style</literal>,
242                                 <literal>date</literal> (from <literal>articleinfo</literal> or
243                                 <literal>artheader</literal>), <literal>authorgroup</literal>
244                                 or <literal>author</literal> (or <literal>articleinfo</literal>
245                                 or <literal>artheader</literal>),
246                                 <literal>$latex.book.article.header.style</literal>,
247                                 <literal>articleinfo</literal> or <literal>artheader</literal>
248                                 in the XSLT <literal>article.within.book</literal> mode,
249                                 <literal>content-templates</literal>.
250
251                         </para>
252                 </doc:notes>
253                 <!--
254                 <doc:samples>
255                         <simplelist type='inline'>
256                                 &test_book;
257                                 &test_defguide;
258                         </simplelist>
259                 </doc:samples>
260                 -->
261                 <doc:seealso>
262                         <itemizedlist>
263                                 <listitem><simpara><xref linkend="template.generate.latex.pagestyle"/></simpara></listitem>
264                                 <listitem><simpara><xref linkend="template.article/artheader|article/articleinfo-article.within.book"/></simpara></listitem>
265                         </itemizedlist>
266                 </doc:seealso>
267         </doc:template>
268                 <!--
269             <formalpara><title>Tasks</title>
270                 <itemizedlist>
271                     <listitem><para>Calls <literal>generate.latex.article.preamble</literal>.</para></listitem>
272                     <listitem><para>Outputs \title, \author, \date, getting the information from its children.</para></listitem>
273                     <listitem><para>Calls <literal>latex.article.begindocument</literal>.</para></listitem>
274                     <listitem><para>Calls <literal>latex.article.maketitle.</literal></para></listitem>
275                     <listitem><para>Applies templates.</para></listitem>
276                     <listitem><para>Calls <literal>latex.article.end</literal> template.</para></listitem>
277                 </itemizedlist>
278             </formalpara>
279                 -->
280         <xsl:template match="book/article">
281                 <xsl:text>&#10;\makeatletter\if@openright\cleardoublepage\else\clearpage\fi</xsl:text>
282                 <xsl:call-template name="generate.latex.pagestyle"/>
283                 <xsl:text>\makeatother&#10;</xsl:text>  
284                 <!-- Get and output article title -->
285                 <xsl:variable name="article.title">
286                         <xsl:choose>
287                                 <xsl:when test="./title"> 
288                                         <xsl:apply-templates select="./title"/>
289                                 </xsl:when>
290                                 <xsl:when test="./articleinfo/title">
291                                         <xsl:apply-templates select="./articleinfo/title"/>
292                                 </xsl:when>
293                                 <xsl:otherwise>
294                                         <xsl:apply-templates select="./artheader/title"/>
295                                 </xsl:otherwise>
296                         </xsl:choose>
297                 </xsl:variable>
298                 <xsl:text>\begin{center}{</xsl:text>
299                 <xsl:value-of select="$latex.book.article.title.style"/>
300                 <xsl:text>{</xsl:text>
301                 <xsl:value-of select="$article.title"/>
302                 <xsl:text>}}\par&#10;</xsl:text>
303                 <!-- Display date information -->
304                 <xsl:variable name="article.date">
305                         <xsl:apply-templates select="./artheader/date|./articleinfo/date"/>
306                 </xsl:variable>
307                 <xsl:if test="$article.date!=''">
308                         <xsl:text>{</xsl:text>
309                         <xsl:value-of select="$article.date"/>
310                         <xsl:text>}\par&#10;</xsl:text>
311                 </xsl:if>
312                 <!-- Display author information -->
313                 <xsl:text>{</xsl:text>
314                 <xsl:value-of select="$latex.book.article.header.style"/>
315                 <xsl:text>{</xsl:text>
316                 <xsl:choose>
317                         <xsl:when test="articleinfo/authorgroup">
318                                 <xsl:apply-templates select="articleinfo/authorgroup"/>
319                         </xsl:when>
320                         <xsl:when test="artheader/authorgroup">
321                                 <xsl:apply-templates select="artheader/authorgroup"/>
322                         </xsl:when>
323                         <xsl:when test="articleinfo/author">
324                                 <xsl:for-each select="artheader">
325                                         <xsl:call-template name="authorgroup"/>
326                                 </xsl:for-each>
327                         </xsl:when>
328                         <xsl:when test="artheader/author">
329                                 <xsl:for-each select="artheader">
330                                         <xsl:call-template name="authorgroup"/>
331                                 </xsl:for-each>
332                         </xsl:when>
333                         <xsl:otherwise>
334                                 <xsl:call-template name="authorgroup"/>
335                         </xsl:otherwise>
336                 </xsl:choose>
337                 <xsl:text>}}\par&#10;</xsl:text>
338                 <xsl:apply-templates select="artheader|articleinfo" mode="article.within.book"/>
339                 <xsl:text>\end{center}&#10;</xsl:text>
340                 <xsl:call-template name="content-templates"/>
341         </xsl:template>
342
343         <doc:template basename="article" xmlns="">
344                 <refpurpose>Process a &DocBook; <doc:db>article</doc:db> document</refpurpose>
345                 <doc:description>
346                         <para>
347                                 Entry point for <doc:db basename="article">articles</doc:db>.
348                         </para>
349                 </doc:description>
350                 <doc:variables>
351                         <itemizedlist>
352                                 <listitem><simpara><xref linkend="param.toc.section.depth"/></simpara></listitem>
353                                 <listitem><simpara><xref linkend="param.section.depth"/></simpara></listitem>
354                                 <listitem><simpara><xref linkend="param.latex.article.title.style"/></simpara></listitem>
355                                 <listitem><simpara><xref linkend="param.latex.maketitle"/></simpara></listitem>
356                                 <!--
357                                 <listitem><simpara><xref linkend="param.latex.article.begindocument"/></simpara></listitem>
358                                 <listitem><simpara><xref linkend="param.latex.article.end"/></simpara></listitem>
359                                 -->
360                         </itemizedlist>
361                 </doc:variables>
362                 <doc:notes>
363                         <para>
364                                 
365                                 This template will call upon the following variables or
366                                 templates in this order:
367                                 <literal>generate.latex.article.preamble</literal>,
368                                 <literal>$toc.section.depth</literal>,
369                                 <literal>$section.depth</literal>,
370                                 <literal>title</literal> (or <doc:db>articleinfo</doc:db> or
371                                 <doc:db>artheader</doc:db>),
372                                 <literal>$latex.article.title.style</literal>,
373                                 <literal>date</literal> (from <literal>articleinfo</literal> or
374                                 <literal>artheader</literal>), <literal>authorgroup</literal>
375                                 or <literal>author</literal> (or <literal>articleinfo</literal>
376                                 or <literal>artheader</literal>), <literal>map.begin</literal>,
377                                 <literal>$latex.maketitle</literal>,
378                                 <literal>articleinfo</literal> or <literal>artheader</literal>,
379                                 <literal>content-templates</literal>,
380                                 <literal>map.end</literal>.
381
382                         </para>
383                 </doc:notes>
384                 <doc:samples>
385                         <simplelist type='inline'>
386                                 &test_article;
387                                 &test_minimal;
388                         </simplelist>
389                 </doc:samples>
390                 <doc:seealso>
391                         <itemizedlist>
392                                 <listitem><simpara>&mapping;: this template will use the <literal>article</literal> mappings.</simpara></listitem>
393                                 <listitem><simpara><xref linkend="template.article/artheader|article/articleinfo-standalone.article"/></simpara></listitem>
394                                 <listitem><simpara><xref linkend="template.generate.latex.article.preamble"/></simpara></listitem>
395                         </itemizedlist>
396                 </doc:seealso>
397         </doc:template>
398         <xsl:template match="article">
399                 <xsl:call-template name="generate.latex.article.preamble"/>
400                 <xsl:text>&#10;\setcounter{tocdepth}{</xsl:text><xsl:value-of select="$toc.section.depth"/><xsl:text>}&#10;</xsl:text>
401                 <xsl:text>&#10;\setcounter{secnumdepth}{</xsl:text><xsl:value-of select="$section.depth"/><xsl:text>}&#10;</xsl:text>
402         <!-- Get and output article title -->
403                 <xsl:variable name="article.title">
404                         <xsl:choose>
405                                 <xsl:when test="./title"> 
406                                         <xsl:apply-templates select="./title"/>
407                                 </xsl:when>
408                                 <xsl:when test="./articleinfo/title">
409                                         <xsl:apply-templates select="./articleinfo/title"/>
410                                 </xsl:when>
411                                 <xsl:otherwise>
412                                         <xsl:apply-templates select="./artheader/title"/>
413                                 </xsl:otherwise>
414                         </xsl:choose>
415                 </xsl:variable>
416                 <xsl:text>\title{</xsl:text>
417                 <xsl:value-of select="$latex.article.title.style"/>
418                 <xsl:text>{</xsl:text>
419                 <xsl:value-of select="$article.title"/>
420                 <xsl:text>}}&#10;</xsl:text>
421                 <!-- Display date information -->
422                 <xsl:variable name="article.date">
423                         <xsl:apply-templates select="./artheader/date|./articleinfo/date"/>
424                 </xsl:variable>
425                 <xsl:if test="$article.date!=''">
426                         <xsl:text>\date{</xsl:text>
427                         <xsl:value-of select="$article.date"/>
428                         <xsl:text>}&#10;</xsl:text>
429                 </xsl:if>
430                 <!-- Display author information -->
431                 <xsl:text>\author{</xsl:text>
432                 <xsl:choose>
433                         <xsl:when test="articleinfo/authorgroup">
434                                 <xsl:apply-templates select="articleinfo/authorgroup"/>
435                         </xsl:when>
436                         <xsl:when test="artheader/authorgroup">
437                                 <xsl:apply-templates select="artheader/authorgroup"/>
438                         </xsl:when>
439                         <xsl:when test="articleinfo/author">
440                                 <xsl:for-each select="artheader">
441                                         <xsl:call-template name="authorgroup"/>
442                                 </xsl:for-each>
443                         </xsl:when>
444                         <xsl:when test="artheader/author">
445                                 <xsl:for-each select="artheader">
446                                         <xsl:call-template name="authorgroup"/>
447                                 </xsl:for-each>
448                         </xsl:when>
449                         <xsl:otherwise>
450                                 <xsl:call-template name="authorgroup"/>
451                         </xsl:otherwise>
452                 </xsl:choose>
453                 <xsl:text>}&#10;</xsl:text>
454                 <!-- Display  begindocument command -->
455                 <xsl:call-template name="map.begin"/>
456                 <xsl:value-of select="$latex.maketitle"/>
457                 <xsl:apply-templates select="artheader|articleinfo" mode="standalone.article"/>
458                 <xsl:call-template name="content-templates-rootid"/>
459                 <xsl:call-template name="map.end"/>
460     </xsl:template>
461
462         <doc:template basename="date" xmlns="">
463                 <refpurpose>Process <doc:db>date</doc:db> in <doc:db>articleinfo</doc:db> elements</refpurpose>
464                 <doc:description>
465                         <para>
466                                 Applies templates.
467                         </para>
468                 </doc:description>
469                 <doc:variables>
470                         &no_var;
471                 </doc:variables>
472                 <!--
473                 <doc:samples>
474                         <simplelist type='inline'>
475                                 &test_book;
476                                 &test_defguide;
477                         </simplelist>
478                 </doc:samples>
479                 -->
480         </doc:template>
481         <xsl:template match="articleinfo/date|artheader/date">
482                 <xsl:apply-templates/>
483         </xsl:template>
484
485         <doc:template basename="articleinfo" xmlns="">
486                 <refpurpose>Process <doc:db>articleinfo</doc:db> in <doc:db>article</doc:db> elements</refpurpose>
487                 <doc:description>
488                         <para>
489                                 Applies templates for <doc:db>legalnotice</doc:db> and <doc:db>abstract</doc:db>.
490                         </para>
491                 </doc:description>
492                 <doc:variables>
493                         &no_var;
494                 </doc:variables>
495                 <!--
496                 <doc:samples>
497                         <simplelist type='inline'>
498                                 &test_book;
499                                 &test_defguide;
500                         </simplelist>
501                 </doc:samples>
502                 -->
503         </doc:template>
504         <xsl:template match="article/artheader|article/articleinfo" mode="standalone.article">
505                 <xsl:apply-templates select="keywordset" />
506                 <xsl:apply-templates select="legalnotice" />
507                 <xsl:apply-templates select="abstract"/>
508         </xsl:template>
509
510         <xsl:template match="article/artheader|article/articleinfo"/>
511
512         <doc:template basename="articleinfo" xmlns="">
513                 <refpurpose>Process <doc:db>articleinfo</doc:db> in <doc:db>article</doc:db> elements</refpurpose>
514                 <doc:description>
515                         <para>
516                                 Applies templates for <doc:db>abstract</doc:db> and <doc:db>legalnotice</doc:db>.
517                         </para>
518                 </doc:description>
519                 <doc:variables>
520                         &no_var;
521                 </doc:variables>
522                 <!--
523                 <doc:samples>
524                         <simplelist type='inline'>
525                                 &test_book;
526                                 &test_defguide;
527                         </simplelist>
528                 </doc:samples>
529                 -->
530         </doc:template>
531         <xsl:template match="article/artheader|article/articleinfo" mode="article.within.book">
532                 <xsl:apply-templates select="abstract"/>
533                 <xsl:apply-templates select="legalnotice" />
534         </xsl:template>
535
536         <doc:template basename="legalnotice" xmlns="">
537                 <refpurpose>Process <doc:db>legalnotice</doc:db> elements</refpurpose>
538                 <doc:description>
539                         <para>
540                                 Typesets legal notices.
541                         </para>
542                 </doc:description>
543                 <doc:variables>
544                         &no_var;
545                 </doc:variables>
546                 <doc:notes>
547                         <note>
548                                 <para>This should be done via the mapping system!</para>
549                         </note>
550                         <para>
551
552                                 For two-column documents, the <doc:db>title</doc:db> is
553                                 formatted in italics and followed immediately by the notice's
554                                 content. For single-column documents, the
555                                 <literal>title</literal> is formatted in bold, centred on a
556                                 line of its own, and the body of the legal notice is formatted
557                                 as an indented small-font quotation.
558
559                         </para>
560                         <para>
561                                 The <doc:db>blockinfo</doc:db> is not processed
562                                 (only the <doc:db>title</doc:db> is used).
563                         </para>
564                 </doc:notes>
565                 <doc:samples>
566                         <simplelist type='inline'>
567                                 &test_book;
568                                 &test_entities;
569                         </simplelist>
570                 </doc:samples>
571                 <doc:seealso>
572                         <itemizedlist>
573                                 <listitem><simpara>&mapping;</simpara></listitem>
574                                 <listitem><simpara><xref linkend="template.legalnotice.title"/></simpara></listitem>
575                         </itemizedlist>
576                 </doc:seealso>
577         </doc:template>
578         <xsl:template match="legalnotice">
579                 <xsl:text>&#10;{\if@twocolumn&#10;</xsl:text>
580                         <xsl:text>\noindent\small\textit{&#10;</xsl:text>
581                         <xsl:call-template name="legalnotice.title"/>
582                         <xsl:text>}\/\bfseries---$\!$%&#10;</xsl:text>
583                 <xsl:text>\else&#10;</xsl:text>
584                         <xsl:text>\noindent\begin{center}\small\bfseries &#10;</xsl:text>
585                         <xsl:call-template name="legalnotice.title"/>
586                         <xsl:text>\end{center}\begin{quote}\small&#10;</xsl:text>
587                 <xsl:text>\fi&#10;</xsl:text>
588                 <xsl:call-template name="content-templates"/>
589                 <xsl:text>\vspace{0.6em}\par\if@twocolumn\else\end{quote}\fi}&#10;</xsl:text>
590                 <!--
591                 <xsl:text>\normalsize\rmfamily&#10;</xsl:text>
592                 -->
593         </xsl:template>
594
595         <doc:template xmlns="">
596                 <refpurpose> Choose a title for <doc:db basename="legalnotice">legalnotices</doc:db> </refpurpose>
597                 <doc:description>
598                         <para>
599                                 Typesets a title.
600                         </para>
601                 </doc:description>
602                 <doc:variables>
603                         &no_var;
604                 </doc:variables>
605                 <doc:notes>
606                         <para>
607
608                                 Will look for
609                                 <doc:db>blockinfo</doc:db>/<doc:db>title</doc:db>,
610                                 <doc:db>legalnotice</doc:db>/<doc:db>title</doc:db>
611                                 or a <quote>gentext</quote> title
612                                 (the first of the three will be used).
613
614                         </para>
615                 </doc:notes>
616                 <doc:samples>
617                         <para>See <xref linkend="template.legalnotice"/></para>
618                 </doc:samples>
619                 <doc:seealso>
620                         <itemizedlist>
621                                 <listitem><simpara>&mapping;</simpara></listitem>
622                                 <listitem><simpara><xref linkend="template.legalnotice.title"/></simpara></listitem>
623                         </itemizedlist>
624                 </doc:seealso>
625         </doc:template>
626         <xsl:template name="legalnotice.title">
627                 <xsl:param name="title" select="blockinfo/title|title"/>
628                 <xsl:choose>
629                         <xsl:when test="count($title)>0">
630                                 <xsl:apply-templates select="$title[1]"/>
631                         </xsl:when>
632                         <xsl:otherwise>
633                                 <xsl:call-template name="gentext">
634                                         <xsl:with-param name="key">legalnotice</xsl:with-param>
635                                 </xsl:call-template>
636                         </xsl:otherwise>
637                 </xsl:choose>
638         </xsl:template>
639
640         <doc:template basename="toc" xmlns="">
641                 <refpurpose> Generate and typeset a <doc:db>toc</doc:db> </refpurpose>
642                 <doc:description>
643                         <para>
644                                 Produce a chapter-level table of contents in &LaTeX;.
645                         </para>
646                 </doc:description>
647                 <doc:variables>
648                         &no_var;
649                 </doc:variables>
650                 <doc:notes>
651                         <para>
652
653                                 This template ignores its contents and instead invokes the
654                                 &LaTeX; <function condition="latex">tableofcontents</function>
655                                 command. You will need to run your typesetter at least twice,
656                                 and possibly three times, to have the table of contents
657                                 generated normally. The headers, footers, and chapter title
658                                 will be generated by &LaTeX;.
659
660                         </para>
661                 </doc:notes>
662                 <doc:samples>
663                         <simplelist type='inline'>
664                                 &test_book;
665                                 &test_lot;
666                         </simplelist>
667                 </doc:samples>
668                 <doc:seealso>
669                         <itemizedlist>
670                                 <listitem><simpara><xref linkend="template.latex.noparskip"/></simpara></listitem>
671                                 <listitem><simpara><xref linkend="template.latex.restoreparskip"/></simpara></listitem>
672                         </itemizedlist>
673                 </doc:seealso>
674         </doc:template>
675         <xsl:template match="toc" name="toc">
676                 <xsl:text>&#10;</xsl:text>
677                 <xsl:call-template name="latex.noparskip"/>
678                 <xsl:choose>
679                         <xsl:when test="$latex.use.hyperref=1">
680                                 <xsl:text>
681 \makeatletter
682 \def\dbtolatex@contentsid{</xsl:text>
683                                 <xsl:call-template name="generate.label.id"/>
684                                 <xsl:text>}
685 \let\dbtolatex@@contentsname\contentsname
686 \newif\ifdocbooktolatexcontentsname\docbooktolatexcontentsnametrue
687 \def\dbtolatex@contentslabel{%
688  \label{\dbtolatex@contentsid}\hypertarget{\dbtolatex@contentsid}{\dbtolatex@@contentsname}%
689  \global\docbooktolatexcontentsnamefalse}
690 \def\contentsname{\ifdocbooktolatexcontentsname\dbtolatex@contentslabel\else\dbtolatex@@contentsname\fi}
691 \tableofcontents
692 \let\contentsname\dbtolatex@@contentsname
693 \Hy@writebookmark{}{\dbtolatex@@contentsname}{\dbtolatex@contentsid}{0}{toc}%
694 \makeatother
695                                 </xsl:text>
696                         </xsl:when>
697                         <xsl:otherwise>
698                                 <xsl:text>\tableofcontents&#10;</xsl:text>
699                         </xsl:otherwise>
700                 </xsl:choose>
701                 <xsl:call-template name="latex.restoreparskip"/>
702         </xsl:template>
703
704         <doc:template basename="toc" xmlns="">
705                 <refpurpose> Generate and typeset a <doc:db>toc</doc:db> </refpurpose>
706                 <doc:description>
707                         <para>
708                                 Produce a chapter-level table of contents in &LaTeX;.
709                         </para>
710                 </doc:description>
711                 <doc:variables>
712                         &no_var;
713                 </doc:variables>
714                 <doc:params>
715                         <variablelist>
716                                 <varlistentry>
717                                         <term>prefer</term>
718                                         <listitem>
719                                                 <para>
720
721                                                         &LaTeX; can provide <function
722                                                         condition="latex">listoffigures</function> and
723                                                         <function condition="latex">listoftables</function>
724                                                         by default. This parameter allows you to select
725                                                         which should be used. Recognised values are
726                                                         <quote>figures</quote> and <quote>tables</quote>.
727                                                         If the value is empty or not recognised, both lists
728                                                         will be output. By default, the value of the
729                                                         current node's non-empty <sgmltag
730                                                         class="attribute">condition</sgmltag>, <sgmltag
731                                                         class="attribute">role</sgmltag> or <sgmltag
732                                                         class="attribute">label</sgmltag> attribute will be
733                                                         used.
734
735                                                 </para>
736                                         </listitem>
737                                 </varlistentry>
738                         </variablelist>
739                 </doc:params>
740                 <doc:notes>
741                         <para>
742
743                                 This template ignores its contents and instead invokes the
744                                 &LaTeX; <function condition="latex">listoffigures</function> or
745                                 <function condition="latex">listoftables</function> commands.
746                                 You will need to run your typesetter at least twice, and
747                                 possibly three times, to have the table of contents generated
748                                 normally. The headers, footers, and chapter title will be
749                                 generated by &LaTeX;.
750
751                         </para>
752                 </doc:notes>
753                 <doc:samples>
754                         <simplelist type='inline'>
755                                 &test_lot1;
756                                 &test_lot2;
757                                 &test_lot3;
758                         </simplelist>
759                 </doc:samples>
760                 <doc:seealso>
761                         <itemizedlist>
762                                 <listitem><simpara><xref linkend="param.latex.bridgehead.in.lot"/></simpara></listitem>
763                                 <listitem><simpara><xref linkend="template.latex.noparskip"/></simpara></listitem>
764                                 <listitem><simpara><xref linkend="template.latex.restoreparskip"/></simpara></listitem>
765                         </itemizedlist>
766                 </doc:seealso>
767         </doc:template>
768         <xsl:template match="lot" name="lot">
769                 <xsl:param name="prefer">
770                         <xsl:choose>
771                                 <xsl:when test="@condition!=''">
772                                         <xsl:value-of select="@condition"/>
773                                 </xsl:when>
774                                 <xsl:when test="@role!=''">
775                                         <xsl:value-of select="@role"/>
776                                 </xsl:when>
777                                 <xsl:otherwise>
778                                         <xsl:value-of select="@label"/>
779                                 </xsl:otherwise>
780                         </xsl:choose>
781                 </xsl:param>
782                 <xsl:call-template name="latex.noparskip"/>
783                 <xsl:choose>
784                         <xsl:when test="$prefer='figures'">
785                                 <xsl:text>\listoffigures&#10;</xsl:text>
786                         </xsl:when>
787                         <xsl:when test="$prefer='tables'">
788                                 <xsl:text>\listoftables&#10;</xsl:text>
789                         </xsl:when>
790                         <xsl:otherwise>
791                                 <xsl:text>\listoffigures&#10;</xsl:text>
792                                 <xsl:text>\listoftables&#10;</xsl:text>
793                         </xsl:otherwise>
794                 </xsl:choose>
795                 <xsl:call-template name="latex.restoreparskip"/>
796         </xsl:template>
797
798 <!--
799         <xsl:template match="lotentry">
800         </xsl:template>
801
802         <xsl:template match="lotentry"/>
803         <xsl:template match="tocpart|tocchap|tocfront|tocback|tocentry"/>
804         <xsl:template match="toclevel1|toclevel2|toclevel3|toclevel4|toclevel5"/>
805 -->
806
807         <doc:template xmlns="">
808                 <refpurpose> Choose the preferred page style for document body </refpurpose>
809                 <doc:description>
810                         <para>
811
812                                 If no page style is preferred by the user, the defaults will be
813                                 <literal>empty</literal> for <doc:db
814                                 basename="article">articles</doc:db>, <literal>plain</literal>
815                                 for <doc:db basename="book">books</doc:db>, or
816                                 <literal>fancy</literal> (if the &LaTeX;
817                                 <productname>fancyhdr</productname> package is permitted).
818
819                         </para>
820                 </doc:description>
821                 <doc:variables>
822                         <itemizedlist>
823                                 <listitem><simpara><xref linkend="param.latex.pagestyle"/></simpara></listitem>
824                                 <listitem><simpara><xref linkend="param.latex.use.fancyhdr"/></simpara></listitem>
825                         </itemizedlist>
826                 </doc:variables>
827                 <doc:notes>
828                         <para>
829                         
830                         The &LaTeX; <function condition="latex">pagestyle</function>
831                         command is used to effect the page style.
832                         
833                         </para>
834                 </doc:notes>
835         </doc:template>
836         <xsl:template name="generate.latex.pagestyle">
837                 <xsl:text>\pagestyle{</xsl:text>
838                 <xsl:choose>
839                         <xsl:when test="$latex.pagestyle!=''">
840                                 <xsl:value-of select="$latex.pagestyle"/>
841                         </xsl:when>
842                         <xsl:when test="count(//book)&gt;0">
843                                 <xsl:choose>
844                                         <xsl:when test="$latex.use.fancyhdr=1"><xsl:text>fancy</xsl:text></xsl:when>
845                                         <xsl:otherwise><xsl:text>plain</xsl:text></xsl:otherwise>
846                                 </xsl:choose>
847                         </xsl:when>
848                         <xsl:otherwise><xsl:text>empty</xsl:text></xsl:otherwise>
849                 </xsl:choose>
850                 <xsl:text>}&#10;</xsl:text>
851         </xsl:template>
852         
853 </xsl:stylesheet>
854