Moving docs tree to docs-xml to make room for generated docs in the release tarball.
[amitay/samba.git] / docs-xml / xslt / db2latex-xsl / xsl / biblio.mod.xsl
1 <?xml version='1.0'?>
2 <!DOCTYPE xsl:stylesheet [ <!ENTITY % xsldoc.ent SYSTEM "./xsldoc.ent"> %xsldoc.ent; ]>
3 <!--############################################################################# 
4 |       $Id: biblio.mod.xsl,v 1.21 2004/01/26 08:57:46 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="biblio" xmlns="">
15                 <referenceinfo>
16                         <releaseinfo role="meta">
17                                 $Id: biblio.mod.xsl,v 1.21 2004/01/26 08:57:46 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.16">&rev_2003_05;</doc:revision>
29                         </revhistory>
30                 </referenceinfo>
31                 <title>Bibliographies <filename>biblio.mod.xsl</filename></title>
32                 <partintro>
33
34                         <para>The file <filename>biblio.mod.xsl</filename> contains the XSL
35                         template for <doc:db>bibliography</doc:db> and associated
36                         elements.</para>
37
38                         <!--
39                 <para>This reference describes the templates and parameters relevant
40                     to formatting DocBook bibliography markup.</para>
41                         -->
42
43                         <bridgehead><quote>All</quote> versus <quote>cited</quote> mode</bridgehead>
44                                 <note>
45                                         <para>These modes are superseded by &BibTeX;
46                                         when using &BibTeX;.</para>
47                                 </note>
48                                 <para>
49
50                                 The <xref linkend="param.latex.biblio.output"/> option can be used
51                                 to select <quote>all</quote> mode or <quote>cited</quote> mode.
52                                 With the <quote>cited</quote> mode, only the <doc:db
53                                 basename="biblioentry">biblioentries</doc:db> that have been
54                                 cited somewhere in the document are output. Otherwise (in
55                                 <quote>all</quote> mode) all biblioentries found are output (as
56                                 the HTML stylesheets do).
57
58                                 </para>
59
60                         <bridgehead>&DocBook; versus &BibTeX;</bridgehead>
61                                 <para>
62                                         
63                                         &DB2LaTeX; supports &BibTeX;. When this mode is enabled,
64                                         you can use a &BibTeX; citations file. Your <doc:db
65                                         basename="citation">citations</doc:db> can then refer to
66                                         your &BibTeX; keys (<doc:db basename="xref">xrefs</doc:db>
67                                         are unlikely to work, though). You will need to provide a
68                                         &LaTeX; command to select a bibliographic citation style as
69                                         is normal for &BibTeX; (see <xref
70                                         linkend="bibtex.example"/>). You must also run the
71                                         <command>bibtex</command> command when typesetting your
72                                         document with &LaTeX;.
73                                         
74                                 </para>
75                                 <note>
76                                         <para>Although &DocBook; allows <doc:db basename="bibliography">bibliographies</doc:db>
77                                         within a number of components, such as <doc:db>section</doc:db>, the use of &BibTeX;
78                                         is only useful for a single, chapter-level bibliography.</para>
79                                 </note>
80                                 <para>
81
82                                         To enable &BibTeX; mode, insert an empty
83                                         <doc:db>bibliography</doc:db> element in your &DocBook;
84                                         document. However, note that this is not valid &DocBook;,
85                                         though it will lead to the desired results with most
86                                         &DocBook; XSL stylesheets (including those for HTML).
87                                         You will also need to set the <xref linkend="param.latex.bibfiles"/>
88                                         variable to the correct path of your &BibTeX; citations file.
89
90                                         Alternatively, you may choose to use a processing
91                                         instruction named <quote>bibtex-bibliography</quote>
92                                         instead of an empty element. The name of the citations file
93                                         may be specified within the processing instruction or via
94                                         <xref linkend="param.latex.bibfiles"/> (see
95                                         <xref linkend="bibtex.example"/>).
96
97                                 </para>
98                                 <example id="bibtex.example">
99                                         <title>Using &BibTeX; with &DB2LaTeX;</title>
100                                         <para>
101
102                                                 A &BibTeX; bibliography may be enabled by providing the
103                                                 name of your citations file, the name of a &BibTeX; style,
104                                                 and the insertion of an appropriate node in your
105                                                 &DocBook; document. In your customisation layer:
106
107                                         <programlisting><![CDATA[
108 <xsl:variable name="latex.book.preamble.post">
109 % Your LaTeX customisation commands
110 \bibliographystyle{ieeetr}
111 </xsl:variable>
112 <xsl:variable name="latex.bibfiles" select="'../citations.bib'"/>
113 ]]></programlisting>
114
115                                                 Then, in your document, type this:
116
117                                         <programlisting><![CDATA[
118 <bibliography/>
119 ]]></programlisting>
120
121                                                 Although this is not valid according to the &DocBook;
122                                                 DTD, it will work with most stylesheets (not just
123                                                 &DB2LaTeX;). Alternatively, you may instead use a
124                                                 processing instruction in compliance with the DTD,
125                                                 though this will work only with &DB2LaTeX; and you will
126                                                 not be able to specify a custom <doc:db>title</doc:db>
127                                                 for your bibliography:
128
129                                         <programlisting><![CDATA[
130 <?bibtex-bibliography?>
131 ]]></programlisting>
132
133                                                 You may optionally specify the citations file directly
134                                                 (you will not need to set
135                                                 <literal>latex.bibfiles</literal>):
136
137                                         <programlisting><![CDATA[
138 <?bibtex-bibliography ../citations.bib?>
139 ]]></programlisting>
140
141                                         </para>
142                                 </example>
143
144                         <doc:variables>
145                                 <itemizedlist>
146                                         <listitem><simpara><xref linkend="param.latex.bibfiles"/></simpara></listitem>
147                                         <listitem><simpara><xref linkend="param.latex.biblio.output"/></simpara></listitem>
148                                 </itemizedlist>
149                         </doc:variables>
150                 </partintro>
151         </doc:reference>
152
153         <doc:template xmlns="">
154                 <refpurpose> Essential preamble for <filename>biblio.mod.xsl</filename> support </refpurpose>
155                 <doc:description>
156                         <para>
157
158                                 Defines <function condition="latex">docbooktolatexbibname</function>,
159                                 <function condition="latex">docbooktolatexbibaux</function>
160                                 and <function condition="env">docbooktolatexbibliography</function>.
161
162                         </para>
163                 </doc:description>
164                 <doc:seealso>
165                         <itemizedlist>
166                                 <listitem><simpara>&preamble;</simpara></listitem>
167                         </itemizedlist>
168                 </doc:seealso>
169         </doc:template>
170
171         <xsl:template name="latex.preamble.essential.biblio">
172                 <xsl:text>
173                         <![CDATA[
174 \AtBeginDocument{\ifx\refname\@undefined\let\docbooktolatexbibname\bibname\def\docbooktolatexbibnamex{\bibname}\else\let\docbooktolatexbibname\refname\def\docbooktolatexbibnamex{\refname}\fi}
175 % Facilitate use of \cite with \label
176 \newcommand{\docbooktolatexbibaux}[2]{%
177   \protected@write\@auxout{}{\string\global\string\@namedef{docbooktolatexcite@#1}{#2}}
178 }
179 % Provide support for bibliography `subsection' environments with titles
180 \newenvironment{docbooktolatexbibliography}[3]{
181    \begingroup
182    \let\save@@chapter\chapter
183    \let\save@@section\section
184    \let\save@@@mkboth\@mkboth
185    \let\save@@bibname\bibname
186    \let\save@@refname\refname
187    \let\@mkboth\@gobbletwo
188    \def\@tempa{#3}
189    \def\@tempb{}
190    \ifx\@tempa\@tempb
191       \let\chapter\@gobbletwo
192       \let\section\@gobbletwo
193       \let\bibname\relax
194    \else
195       \let\chapter#2
196       \let\section#2
197       \let\bibname\@tempa
198    \fi
199    \let\refname\bibname
200    \begin{thebibliography}{#1}
201 }{
202    \end{thebibliography}
203    \let\chapter\save@@chapter
204    \let\section\save@@section
205    \let\@mkboth\save@@@mkboth
206    \let\bibname\save@@bibname
207    \let\refname\save@@refname
208    \endgroup
209 }
210 ]]>
211                 </xsl:text>
212         </xsl:template>
213
214         <doc:template basename="bibliography" xmlns="">
215                 <refpurpose>Process <doc:db>bibliography</doc:db> elements</refpurpose>
216                 <doc:description>
217                         <para>
218                                 This is a complex template that can format bibliographies as
219                                 chapter-level or section-level components.
220                         </para>
221                 </doc:description>
222                 <doc:variables>
223                         <itemizedlist>
224                                 <listitem><simpara><xref linkend="param.latex.biblio.output"/></simpara></listitem>
225                                 <listitem><simpara><xref linkend="param.latex.bibwidelabel"/></simpara></listitem>
226                         </itemizedlist>
227                 </doc:variables>
228                 <doc:params>
229                         <variablelist>
230                                 <varlistentry>
231                                         <term>makechapter</term>
232                                         <listitem>
233                                                 <para>
234
235                                                         Whether to make a chapter-level bibliography or
236                                                         not. This is normally determined by examining
237                                                         whether the <doc:db>bibliography</doc:db> element
238                                                         occurs as a child of a <doc:db>book</doc:db> or
239                                                         <doc:db>part</doc:db>. If so, the bibliography will
240                                                         be formatted as an unnumbered chapter. If not, the
241                                                         bibliography will be formatted as an unnumbered
242                                                         section. This effect does not hold for &BibTeX;
243                                                         bibliographies, which will be formatted by the
244                                                         &LaTeX; <function
245                                                         condition="latex">bibliography</function> command.
246
247                                                 </para>
248                                         </listitem>
249                                 </varlistentry>
250                         </variablelist>
251                 </doc:params>
252                 <doc:notes>
253                         <para>This template probably contains many bugs.</para>
254                         &essential_preamble;
255                 </doc:notes>
256                 <doc:samples>
257                         <simplelist type='inline'>
258                                 &test_article;
259                                 &test_biblio;
260                                 &test_bind;
261                                 &test_book;
262                                 &test_cited;
263                                 &test_ieeebiblio;
264                         </simplelist>
265                 </doc:samples>
266                 <doc:seealso>
267                         <itemizedlist>
268                                 <listitem><simpara>&mapping;: this template will use the <literal>bibliography-chapter</literal>
269                                 and <literal>bibliography-section</literal> mappings.</simpara></listitem>
270                                 <listitem><simpara><xref linkend="citation"/></simpara></listitem>
271                         </itemizedlist>
272                 </doc:seealso>
273         </doc:template>
274         <xsl:template match="bibliography">
275                 <xsl:param name="makechapter" select="local-name(..)='book' or local-name(..)='part'"/>
276                 <xsl:variable name="keyword">
277                         <xsl:choose>
278                                 <xsl:when test="$makechapter">
279                                         <xsl:text>bibliography-chapter</xsl:text>
280                                 </xsl:when>
281                                 <xsl:otherwise>
282                                         <xsl:text>bibliography-section</xsl:text>
283                                 </xsl:otherwise>
284                         </xsl:choose>
285                 </xsl:variable>
286                 <xsl:variable name="environment">
287                         <xsl:choose>
288                                 <xsl:when test="$makechapter">thebibliography</xsl:when>
289                                 <xsl:otherwise>docbooktolatexbibliography</xsl:otherwise>
290                         </xsl:choose>
291                 </xsl:variable>
292                 <xsl:variable name="title">
293                         <xsl:apply-templates select="title|subtitle"/>
294                 </xsl:variable>
295                 <!--
296                 <xsl:message>DB2LaTeX: Processing BIBLIOGRAPHY</xsl:message>
297                 -->
298                 <xsl:if test="$title!=''">
299                         <xsl:text>\let\oldbibname\bibname&#10;</xsl:text>
300                         <xsl:text>\let\oldrefname\refname&#10;</xsl:text>
301                         <xsl:text>\def\bibname{</xsl:text>
302                         <xsl:value-of select="$title"/>
303                         <xsl:text>}&#10;</xsl:text>
304                         <xsl:text>\let\refname\bibname&#10;</xsl:text>
305                 </xsl:if>
306                 <xsl:call-template name="map.begin">
307                         <xsl:with-param name="keyword" select="$keyword"/>
308                 </xsl:call-template>
309                 <xsl:choose>
310                         <xsl:when test="biblioentry or bibliodiv">
311                                 <xsl:variable name="separatetitle" select="not(biblioentry or bibliodiv[1]/@title)"/>
312                                 <xsl:message>DB2LaTeX: Bibliographic Output Mode :  <xsl:value-of select="$latex.biblio.output"/></xsl:message>
313                                 <xsl:choose>
314                                         <xsl:when test="$separatetitle and $makechapter">
315                                                 <xsl:text>\chapter*{\docbooktolatexbibnamex}\hypertarget{</xsl:text>
316                                                 <xsl:call-template name="generate.label.id"/>
317                                                 <xsl:text>}{}&#10;</xsl:text>
318                                         </xsl:when>
319                                         <xsl:when test="$separatetitle and not($makechapter)">
320                                                 <xsl:text>\section*{\docbooktolatexbibnamex}\hypertarget{</xsl:text>
321                                                 <xsl:call-template name="generate.label.id"/>
322                                                 <xsl:text>}{}&#10;</xsl:text>
323                                         </xsl:when>
324                                         <xsl:when test="biblioentry"><!-- implies not($separatetitle) -->
325                                                 <xsl:text>\begin{</xsl:text>
326                                                 <xsl:value-of select="$environment"/>
327                                                 <xsl:text>}{</xsl:text>
328                                                 <xsl:value-of select="$latex.bibwidelabel"/>
329                                                 <xsl:if test="$environment='docbooktolatexbibliography'">
330                                                         <xsl:text>}{\</xsl:text>
331                                                         <!-- TODO choose the correct nesting, rather than assuming something -->
332                                                         <xsl:choose>
333                                                                 <xsl:when test="$makechapter">chapter</xsl:when>
334                                                                 <xsl:otherwise>section</xsl:otherwise>
335                                                         </xsl:choose>
336                                                         <xsl:text>}{</xsl:text>
337                                                         <xsl:choose>
338                                                                 <xsl:when test="$title!=''">
339                                                                         <xsl:value-of select="$title"/>
340                                                                 </xsl:when>
341                                                                 <xsl:otherwise>
342                                                                         <xsl:text>\docbooktolatexbibname</xsl:text>
343                                                                 </xsl:otherwise>
344                                                         </xsl:choose>
345                                                 </xsl:if>
346                                                 <xsl:text>}\hypertarget{</xsl:text>
347                                                 <xsl:call-template name="generate.label.id"/>
348                                                 <xsl:text>}{}&#10;</xsl:text>
349                                                 <xsl:choose>
350                                                         <xsl:when test="$latex.biblio.output ='cited'">
351                                                                 <xsl:apply-templates select="biblioentry" mode="bibliography.cited">
352                                                                         <xsl:sort select="./abbrev"/>
353                                                                         <xsl:sort select="./@xreflabel"/>
354                                                                         <xsl:sort select="./@id"/>
355                                                                 </xsl:apply-templates>
356                                                         </xsl:when>
357                                                         <xsl:when test="$latex.biblio.output ='all'">
358                                                                 <xsl:apply-templates select="biblioentry" mode="bibliography.all">
359                                                                         <xsl:sort select="./abbrev"/>
360                                                                         <xsl:sort select="./@xreflabel"/>
361                                                                         <xsl:sort select="./@id"/>
362                                                                 </xsl:apply-templates>
363                                                         </xsl:when>
364                                                         <xsl:otherwise>
365                                                                 <xsl:apply-templates select="biblioentry">
366                                                                         <xsl:sort select="./abbrev"/>
367                                                                         <xsl:sort select="./@xreflabel"/>
368                                                                         <xsl:sort select="./@id"/>
369                                                                 </xsl:apply-templates>
370                                                         </xsl:otherwise>
371                                                 </xsl:choose>
372                                                 <!-- <xsl:apply-templates select="child::*[name(.)!='biblioentry']"/>  -->
373                                                 <xsl:text>&#10;\end{</xsl:text>
374                                                 <xsl:value-of select="$environment"/>
375                                                 <xsl:text>}&#10;</xsl:text>
376                                         </xsl:when>
377                                         <xsl:otherwise>
378                                                 <xsl:text>\hypertarget{</xsl:text>
379                                                 <xsl:call-template name="generate.label.id"/>
380                                                 <xsl:text>}{}&#10;</xsl:text>
381                                         </xsl:otherwise>
382                                 </xsl:choose>
383                                 <xsl:apply-templates select="bibliodiv"/>
384                         </xsl:when>
385                         <xsl:when test="child::*">
386                                 <xsl:choose>
387                                         <xsl:when test="$makechapter">
388                                                 <xsl:text>\chapter*</xsl:text>
389                                         </xsl:when>
390                                         <xsl:otherwise>
391                                                 <xsl:text>\section*</xsl:text>
392                                         </xsl:otherwise>
393                                 </xsl:choose>
394                                 <xsl:text>{\docbooktolatexbibnamex}\hypertarget{</xsl:text>
395                                 <xsl:call-template name="generate.label.id"/>
396                                 <xsl:text>}{}&#10;</xsl:text>
397                                 <xsl:call-template name="content-templates"/>
398                         </xsl:when>
399                         <xsl:otherwise>
400                                 <xsl:text>% Assume that an empty &lt;bibliography&gt; means ``use BibTeX'' or similar.&#10;</xsl:text>
401                                 <xsl:text>\bibliography{</xsl:text><xsl:value-of select="$latex.bibfiles"/><xsl:text>}&#10;</xsl:text>
402                         </xsl:otherwise>
403                 </xsl:choose>
404                 <xsl:call-template name="map.end">
405                         <xsl:with-param name="keyword" select="$keyword"/>
406                 </xsl:call-template>
407                 <xsl:if test="$title!=''">
408                         <xsl:text>\let\bibname\oldbibname&#10;</xsl:text>
409                         <xsl:text>\let\refname\oldrefname&#10;</xsl:text>
410                 </xsl:if>
411         </xsl:template>
412
413         <doc:template xmlns="">
414                 <refpurpose>Process <sgmltag class="xmlpi">bibtex-bibliography</sgmltag> nodes</refpurpose>
415                 <doc:description>
416                         <para>
417                                 Output a &BibTeX; bibliography.
418                         </para>
419                 </doc:description>
420                 <doc:variables>
421                         <itemizedlist>
422                                 <listitem><simpara><xref linkend="param.latex.bibfiles"/></simpara></listitem>
423                         </itemizedlist>
424                 </doc:variables>
425                 <doc:params>
426                         <variablelist>
427                                 <varlistentry>
428                                         <term>makechapter</term>
429                                         <listitem>
430                                                 <para>
431
432                                                         Choose which &LaTeX; mapping to use. This is
433                                                         normally determined by examining whether the PI
434                                                         occurs as a child of a <doc:db>book</doc:db> or
435                                                         <doc:db>part</doc:db>. Regardless of this
436                                                         parameter, the bibliography will be formatted as a
437                                                         chapter via the &LaTeX; <function
438                                                         condition="latex">bibliography</function> command.
439
440                                                 </para>
441                                         </listitem>
442                                 </varlistentry>
443                                 <varlistentry>
444                                         <term>filename</term>
445                                         <listitem>
446                                                 <para>
447
448                                                         The filename of the &BibTeX; citations source file.
449                                                         By default, this will be obtained from the content
450                                                         of the process instruction, if present, or
451                                                         otherwise from <xref
452                                                         linkend="param.latex.bibfiles"/>.
453
454                                                 </para>
455                                         </listitem>
456                                 </varlistentry>
457                         </variablelist>
458                 </doc:params>
459                 <doc:notes>
460                         <para>This PI is not part of &DocBook; and is only supported by &DB2LaTeX;
461                         The formatting of the bibliography is performed by &LaTeX; and is not
462                         configurable by &DB2LaTeX;.</para>
463                 </doc:notes>
464                 <doc:seealso>
465                         <itemizedlist>
466                                 <listitem><simpara>&mapping;: This template will use the <literal>bibliography-chapter</literal>
467                                 or <literal>bibliography-section</literal> mapping.</simpara></listitem>
468                         </itemizedlist>
469                 </doc:seealso>
470         </doc:template>
471         <xsl:template match="processing-instruction('bibtex-bibliography')">
472                 <xsl:param name="makechapter" select="local-name(..)='book' or local-name(..)='part'"/>
473                 <xsl:param name="filename">
474                         <xsl:choose>
475                                 <xsl:when test="normalize-space(.)!=''">
476                                         <xsl:value-of select="."/>
477                                 </xsl:when>
478                                 <xsl:otherwise>
479                                         <xsl:value-of select="$latex.bibfiles"/>
480                                 </xsl:otherwise>
481                         </xsl:choose>
482                 </xsl:param>
483                 <xsl:variable name="keyword">
484                         <xsl:choose>
485                                 <xsl:when test="$makechapter">
486                                         <xsl:text>bibliography-chapter</xsl:text>
487                                 </xsl:when>
488                                 <xsl:otherwise>
489                                         <xsl:text>bibliography-section</xsl:text>
490                                 </xsl:otherwise>
491                         </xsl:choose>
492                 </xsl:variable>
493                 <xsl:call-template name="map.begin">
494                         <xsl:with-param name="keyword" select="$keyword"/>
495                 </xsl:call-template>
496                 <xsl:text>\bibliography{</xsl:text><xsl:value-of select="$filename"/><xsl:text>}&#10;</xsl:text>
497                 <xsl:call-template name="map.end">
498                         <xsl:with-param name="keyword" select="$keyword"/>
499                 </xsl:call-template>
500         </xsl:template>
501
502         <doc:template xmlns="">
503                 <refpurpose>Process <doc:db>bibliodiv</doc:db> elements</refpurpose>
504                 <doc:description>
505                         <para>
506                                 Formats subdivisions of bibliographies.
507                         </para>
508                 </doc:description>
509                 <doc:variables>
510                         <itemizedlist>
511                                 <listitem><simpara><xref linkend="param.latex.biblio.output"/></simpara></listitem>
512                         </itemizedlist>
513                 </doc:variables>
514                 <doc:notes>
515                         &essential_preamble;
516                 </doc:notes>
517                 <doc:samples>
518                         <simplelist type='inline'>
519                                 &test_article;
520                                 &test_biblio;
521                                 &test_bind;
522                                 &test_book;
523                                 &test_cited;
524                                 &test_ieeebiblio;
525                         </simplelist>
526                 </doc:samples>
527         </doc:template>
528         <xsl:template match="bibliodiv">
529                 <xsl:param name="environment">
530                         <xsl:variable name="parent" select="local-name(..)"/>
531                         <xsl:choose>
532                                 <xsl:when test="starts-with($parent,'sect')">docbooktolatexbibliography</xsl:when>
533                                 <xsl:otherwise>thebibliography</xsl:otherwise>
534                         </xsl:choose>
535                 </xsl:param>
536                 <!--
537                 <xsl:message>DB2LaTeX: Processing BIBLIOGRAPHY - BIBLIODIV</xsl:message>
538                 -->
539                 <xsl:text>&#10;\begin{docbooktolatexbibliography}{</xsl:text>
540                 <xsl:value-of select="$latex.bibwidelabel"/>
541                 <xsl:text>}{\</xsl:text>
542                 <!-- TODO choose the correct nesting, rather than assuming subsection -->
543                 <xsl:text>subsection</xsl:text>
544                 <xsl:text>}{</xsl:text>
545                 <xsl:apply-templates select="title|subtitle"/>
546                 <xsl:text>}\hypertarget{</xsl:text>
547                 <xsl:call-template name="generate.label.id"/>
548                 <xsl:text>}{}&#10;</xsl:text>
549                 <xsl:choose>
550                         <xsl:when test="$latex.biblio.output ='cited'">
551                                 <xsl:apply-templates select="biblioentry" mode="bibliography.cited">
552                                         <xsl:sort select="./abbrev"/>
553                                         <xsl:sort select="./@xreflabel"/>
554                                         <xsl:sort select="./@id"/>
555                                 </xsl:apply-templates>
556                         </xsl:when>
557                         <xsl:when test="$latex.biblio.output ='all'">
558                                 <xsl:apply-templates select="biblioentry">
559                                         <xsl:sort select="./abbrev"/>
560                                         <xsl:sort select="./@xreflabel"/>
561                                         <xsl:sort select="./@id"/>
562                                 </xsl:apply-templates>
563                         </xsl:when>
564                 </xsl:choose>
565                 <xsl:text>&#10;\end{docbooktolatexbibliography}&#10;</xsl:text>
566         </xsl:template>
567
568         <doc:template basename="biblioentry" xmlns="">
569                 <refpurpose>Process <doc:db>biblioentry</doc:db> elements</refpurpose>
570                 <doc:description>
571                         <para>
572                                 Emits a bibiographic entry if the reference was cited in the document.
573                         </para>
574                 </doc:description>
575                 <doc:seealso>
576                         <para>This template calls <xref linkend="template.biblioentry.output"/> to format the entry.</para>
577                 </doc:seealso>
578         </doc:template>
579         <xsl:template match="biblioentry" mode="bibliography.cited">
580                 <xsl:param name="bibid" select="@id"/>
581                 <xsl:param name="ab" select="abbrev"/>
582                 <xsl:variable name="nx" select="//xref[@linkend=$bibid]"/>
583                 <xsl:variable name="nc" select="//citation[text()=$ab]"/>
584                 <xsl:if test="count($nx) &gt; 0 or count($nc) &gt; 0">
585                         <xsl:call-template name="biblioentry.output"/>
586                 </xsl:if>
587         </xsl:template>
588
589         <doc:template basename="biblioentry" xmlns="">
590                 <refpurpose>Process <doc:db>biblioentry</doc:db> elements</refpurpose>
591                 <doc:description>
592                         <para>
593                                 Emits a bibiographic entry unconditionally.
594                         </para>
595                 </doc:description>
596                 <doc:seealso>
597                         <para>This template calls <xref linkend="template.biblioentry.output"/> to format the entry.</para>
598                 </doc:seealso>
599         </doc:template>
600         <xsl:template match="biblioentry" mode="bibliography.all">
601                 <xsl:call-template name="biblioentry.output"/>
602         </xsl:template>
603
604         <doc:template basename="biblioentry" xmlns="">
605                 <refpurpose>Process <doc:db>biblioentry</doc:db> elements</refpurpose>
606                 <doc:description>
607                         <para>
608                                 Emits a bibiographic entry unconditionally.
609                         </para>
610                 </doc:description>
611                 <doc:seealso>
612                         <para>This template calls <xref linkend="template.biblioentry.output"/> to format the entry.</para>
613                 </doc:seealso>
614         </doc:template>
615         <xsl:template match="biblioentry">
616                 <xsl:call-template name="biblioentry.output"/>
617         </xsl:template>
618
619         <doc:template xmlns="">
620                 <refpurpose>Format <doc:db basename="biblioentry">biblioentries</doc:db></refpurpose>
621                 <doc:description>
622                         <para>
623                                 Formats a bibiographic entry.
624                         </para>
625                 </doc:description>
626                 <doc:variables>
627                         <itemizedlist>
628                                 <listitem><simpara><xref linkend="param.latex.biblioentry.style"/></simpara></listitem>
629                         </itemizedlist>
630                 </doc:variables>
631                 <doc:notes>
632                         <note>
633                                 <para>
634                                         This template does not apply to &BibTeX; bibliographies.
635                                 </para>
636                         </note>
637                         <para>
638                                 A <function condition="latex">bibitem</function> is emitted.
639                                 If can be linked via <doc:db>citation</doc:db> or <doc:db>xref</doc:db>.
640                                 The <doc:db>title</doc:db> will be formatted in italics, followed by
641                                 <xref linkend="param.biblioentry.item.separator"/>, the <doc:db>author</doc:db>
642                                 or <doc:db>authorgroup</doc:db>, and then the following elements separated
643                                 by <literal>biblioentry.item.separator</literal>:
644                                 <doc:db>copyright</doc:db>, <doc:db>publisher</doc:db>,
645                                 <doc:db>pubdate</doc:db>, <doc:db>pagenums</doc:db>,
646                                 <doc:db>isbn</doc:db>, <doc:db>editor</doc:db>,
647                                 <doc:db>releaseinfo</doc:db>.
648                         </para>
649                         <note>
650                                 <para>
651                                         All templates for all &DocBook; elements will be applied
652                                         with the <quote>bibliography.mode</quote> XSLT mode.
653                                 </para>
654                         </note>
655                 </doc:notes>
656                 <doc:samples>
657                         <simplelist type='inline'>
658                                 &test_article;
659                                 &test_biblio;
660                                 &test_bind;
661                                 &test_book;
662                                 &test_cited;
663                                 &test_ieeebiblio;
664                         </simplelist>
665                 </doc:samples>
666         </doc:template>
667         <xsl:template name="biblioentry.output">
668                 <xsl:variable name="biblioentry.label">
669                         <xsl:choose>
670                                 <xsl:when test="@xreflabel">
671                                         <xsl:value-of select="normalize-space(@xreflabel)"/> 
672                                 </xsl:when>
673                                 <xsl:when test="abbrev">
674                                         <xsl:apply-templates select="abbrev" mode="bibliography.mode"/> 
675                                 </xsl:when>
676                                 <xsl:when test="@id">
677                                         <xsl:value-of select="normalize-space(@id)"/> 
678                                 </xsl:when>
679                                 <xsl:otherwise>
680                                         <!-- TODO is there any need for a warning? -->
681                                 </xsl:otherwise>
682                         </xsl:choose>
683                 </xsl:variable>
684                 <xsl:variable name="biblioentry.id">
685                         <xsl:choose>
686                                 <xsl:when test="abbrev">
687                                         <xsl:apply-templates select="abbrev" mode="bibliography.mode"/>
688                                 </xsl:when>
689                                 <xsl:otherwise>
690                                         <xsl:call-template name="generate.label.id"/>
691                                 </xsl:otherwise>
692                         </xsl:choose>
693                 </xsl:variable>
694                 <xsl:text>&#10;</xsl:text>
695                 <xsl:call-template name="biblioentry.output.format">
696                         <xsl:with-param name="biblioentry.label" select="$biblioentry.label"/>
697                         <xsl:with-param name="biblioentry.id" select="$biblioentry.id"/>
698                 </xsl:call-template>
699         </xsl:template>
700
701         <xsl:template name="biblioentry.output.format">
702                 <xsl:param name="biblioentry.label"/>
703                 <xsl:param name="biblioentry.id"/>
704                 <xsl:choose>
705                         <xsl:when test="$latex.biblioentry.style='ieee' or $latex.biblioentry.style='IEEE'">
706                                 <xsl:text>% -------------- biblioentry &#10;</xsl:text>
707                                 <xsl:text>\bibitem</xsl:text>
708                                 <xsl:text>{</xsl:text>
709                                 <xsl:value-of select="$biblioentry.id"/>
710                                 <xsl:text>}\docbooktolatexbibaux{</xsl:text>
711                                 <xsl:call-template name="generate.label.id"/>
712                                 <xsl:text>}{</xsl:text>
713                                 <xsl:value-of select="$biblioentry.id"/>
714                                 <xsl:text>}&#10;\hypertarget{</xsl:text>
715                                 <xsl:call-template name="generate.label.id"/>
716                                 <xsl:text>}&#10;</xsl:text>
717                                 <xsl:apply-templates select="author|authorgroup" mode="bibliography.mode"/>
718                                 <xsl:value-of select="$biblioentry.item.separator"/>
719                                 <xsl:text>\emph{</xsl:text> <xsl:apply-templates select="title" mode="bibliography.mode"/><xsl:text>}</xsl:text>
720                                 <xsl:for-each select="child::copyright|child::publisher|child::pubdate|child::pagenums|child::isbn">
721                                         <xsl:value-of select="$biblioentry.item.separator"/>
722                                         <xsl:apply-templates select="." mode="bibliography.mode"/>
723                                 </xsl:for-each>
724                                 <xsl:text>. </xsl:text>
725                                 <xsl:text>&#10;&#10;</xsl:text>
726                         </xsl:when>
727                         <xsl:otherwise>
728                                 <xsl:text>% -------------- biblioentry &#10;</xsl:text>
729                                 <xsl:choose>
730                                         <xsl:when test="$biblioentry.label=''">
731                                                 <xsl:text>\bibitem</xsl:text> 
732                                         </xsl:when>
733                                         <xsl:otherwise>
734                                                 <xsl:text>\bibitem[{</xsl:text>
735                                                 <xsl:call-template name="normalize-scape">
736                                                         <xsl:with-param name="string" select="$biblioentry.label"/>
737                                                 </xsl:call-template>
738                                                 <xsl:text>}]</xsl:text>
739                                         </xsl:otherwise>
740                                 </xsl:choose>
741                                 <xsl:text>{</xsl:text>
742                                 <xsl:value-of select="$biblioentry.id"/>
743                                 <xsl:text>}\docbooktolatexbibaux{</xsl:text>
744                                 <xsl:call-template name="generate.label.id"/>
745                                 <xsl:text>}{</xsl:text>
746                                 <xsl:value-of select="$biblioentry.id"/>
747                                 <xsl:text>}&#10;\hypertarget{</xsl:text>
748                                 <xsl:call-template name="generate.label.id"/>
749                                 <xsl:text>}{\emph{</xsl:text> <xsl:apply-templates select="title" mode="bibliography.mode"/> <xsl:text>}}</xsl:text>
750                                 <xsl:value-of select="$biblioentry.item.separator"/>
751                                 <xsl:apply-templates select="author|authorgroup" mode="bibliography.mode"/>
752                                 <xsl:for-each select="child::copyright|child::publisher|child::pubdate|child::pagenums|child::isbn|child::editor|child::releaseinfo">
753                                         <xsl:value-of select="$biblioentry.item.separator"/>
754                                         <xsl:apply-templates select="." mode="bibliography.mode"/>
755                                 </xsl:for-each>
756                                 <xsl:text>.</xsl:text>
757                                 <xsl:text>&#10;&#10;</xsl:text>
758                         </xsl:otherwise>
759                 </xsl:choose>
760         </xsl:template>
761
762         <xsl:template name="biblioentry.output.format.ieee">
763         </xsl:template>
764
765     <xsl:template match="abbrev" mode="bibliography.mode">
766                 <xsl:apply-templates mode="bibliography.mode"/>
767     </xsl:template>
768
769         <!--
770         <doc:template basename="abstract" match="abstract" mode="bibliography.mode" xmlns="">
771                 <refpurpose>Process <doc:db>abstract</doc:db> elements</refpurpose>
772                 <doc:description>
773                         <para>
774                                 Currently, <doc:db basename="abstract">abstracts</doc:db> are deleted
775                                 in <literal>bibliography.mode</literal>.
776                         </para>
777                 </doc:description>
778                 <doc:variables>
779                         &no_var;
780                 </doc:variables>
781                 <doc:notes>
782                         <para>Abstracts are suppressed in &DB2LaTeX; bibliographies.</para>
783                 </doc:notes>
784         </doc:template>
785         <xsl:template match="abstract" mode="bibliography.mode"/>
786         -->
787
788         <xsl:template match="address" mode="bibliography.mode">
789         <xsl:apply-templates mode="bibliography.mode"/>
790         </xsl:template>
791
792         <xsl:template match="affiliation" mode="bibliography.mode">
793         <xsl:apply-templates mode="bibliography.mode"/>
794         </xsl:template>
795
796         <xsl:template match="authorblurb" mode="bibliography.mode"/>
797
798         <xsl:template match="artheader" mode="bibliography.mode">
799         <xsl:apply-templates mode="bibliography.mode"/>
800         </xsl:template>
801
802         <xsl:template match="artpagenums" mode="bibliography.mode">
803         <xsl:apply-templates mode="bibliography.mode"/>
804         </xsl:template>
805
806         <xsl:template match="author" mode="bibliography.mode">
807                 <xsl:apply-templates select="."/>
808         </xsl:template>
809
810         <xsl:template match="authorgroup" mode="bibliography.mode">
811                 <xsl:apply-templates select="."/>
812         </xsl:template>
813
814         <!-- basename="authorinitials" -->
815         <xsl:template match="authorinitials" mode="bibliography.mode">
816                 <xsl:apply-templates mode="bibliography.mode"/>
817         </xsl:template>
818
819         <xsl:template match="bibliomisc" mode="bibliography.mode">
820         <xsl:apply-templates mode="bibliography.mode"/>
821         </xsl:template>
822
823         <xsl:template match="bibliomset" mode="bibliography.mode">
824         <xsl:apply-templates mode="bibliography.mode"/>
825         </xsl:template>
826
827         <xsl:template match="bibliomixed" mode="bibliography.mode">
828         <xsl:apply-templates mode="bibliography.mode"/>
829         </xsl:template>
830
831         <xsl:template match="biblioset" mode="bibliography.mode">
832         <xsl:apply-templates mode="bibliography.mode"/>
833         </xsl:template>
834
835         <xsl:template match="biblioset/title|biblioset/citetitle" mode="bibliography.mode">
836         <xsl:variable name="relation" select="../@relation"/>
837         <xsl:choose>
838                 <xsl:when test="$relation='article'">
839                 <xsl:call-template name="gentext.startquote"/>
840                 <xsl:apply-templates/>
841                 <xsl:call-template name="gentext.endquote"/>
842                 </xsl:when>
843                 <xsl:otherwise>
844                 <xsl:apply-templates/>
845                 </xsl:otherwise>
846         </xsl:choose>
847         </xsl:template>
848
849         <xsl:template match="bookbiblio" mode="bibliography.mode">
850         <xsl:apply-templates mode="bibliography.mode"/>
851         </xsl:template>
852
853         <xsl:template match="citetitle" mode="bibliography.mode">
854         <I><xsl:apply-templates mode="bibliography.mode"/></I>
855         </xsl:template>
856
857         <xsl:template match="collab" mode="bibliography.mode">
858         <xsl:apply-templates mode="bibliography.mode"/>
859         </xsl:template>
860
861         <xsl:template match="collabname" mode="bibliography.mode">
862         <xsl:apply-templates mode="bibliography.mode"/>
863         </xsl:template>
864
865         <xsl:template match="confgroup" mode="bibliography.mode">
866         <xsl:apply-templates mode="bibliography.mode"/>
867         </xsl:template>
868
869         <xsl:template match="confdates" mode="bibliography.mode">
870         <xsl:apply-templates mode="bibliography.mode"/>
871         </xsl:template>
872
873         <xsl:template match="conftitle" mode="bibliography.mode">
874         <xsl:apply-templates mode="bibliography.mode"/>
875         </xsl:template>
876
877         <xsl:template match="confnum" mode="bibliography.mode">
878         <xsl:apply-templates mode="bibliography.mode"/>
879         </xsl:template>
880
881         <xsl:template match="confsponsor" mode="bibliography.mode">
882         <xsl:apply-templates mode="bibliography.mode"/>
883         </xsl:template>
884
885         <xsl:template match="contractnum" mode="bibliography.mode">
886         <xsl:apply-templates mode="bibliography.mode"/>
887         </xsl:template>
888
889         <xsl:template match="contractsponsor" mode="bibliography.mode">
890         <xsl:apply-templates mode="bibliography.mode"/>
891         </xsl:template>
892
893         <xsl:template match="contrib" mode="bibliography.mode">
894         <xsl:apply-templates mode="bibliography.mode"/>
895         </xsl:template>
896
897         <xsl:template match="copyright" mode="bibliography.mode">
898         <xsl:call-template name="gentext.element.name"/>
899         <xsl:call-template name="gentext.space"/>
900         <xsl:call-template name="dingbat">
901                 <xsl:with-param name="dingbat">copyright</xsl:with-param>
902         </xsl:call-template>
903         <xsl:call-template name="gentext.space"/>
904         <xsl:apply-templates select="year" mode="bibliography.mode"/>
905         <xsl:call-template name="gentext.space"/>
906         <xsl:apply-templates select="holder" mode="bibliography.mode"/>
907         </xsl:template>
908
909         <xsl:template match="year" mode="bibliography.mode">
910         <xsl:apply-templates/><xsl:text>, </xsl:text>
911         </xsl:template>
912
913         <xsl:template match="year[position()=last()]" mode="bibliography.mode">
914         <xsl:apply-templates/>
915         </xsl:template>
916
917         <xsl:template match="holder" mode="bibliography.mode">
918         <xsl:apply-templates/>
919         </xsl:template>
920
921         <xsl:template match="corpauthor" mode="bibliography.mode">
922         <xsl:apply-templates mode="bibliography.mode"/>
923         </xsl:template>
924
925         <xsl:template match="corpname" mode="bibliography.mode">
926         <xsl:apply-templates mode="bibliography.mode"/>
927         </xsl:template>
928
929         <xsl:template match="date" mode="bibliography.mode">
930         <xsl:apply-templates mode="bibliography.mode"/>
931         </xsl:template>
932
933         <xsl:template match="edition" mode="bibliography.mode">
934         <xsl:apply-templates mode="bibliography.mode"/>
935         </xsl:template>
936
937         <xsl:template match="editor" mode="bibliography.mode">
938         <xsl:call-template name="person.name"/>
939         </xsl:template>
940
941         <xsl:template match="firstname" mode="bibliography.mode">
942         <xsl:apply-templates mode="bibliography.mode"/>
943         </xsl:template>
944
945         <xsl:template match="honorific" mode="bibliography.mode">
946         <xsl:apply-templates mode="bibliography.mode"/>
947         </xsl:template>
948
949         <xsl:template match="indexterm" mode="bibliography.mode">
950         <xsl:apply-templates mode="bibliography.mode"/>
951         </xsl:template>
952
953         <xsl:template match="invpartnumber" mode="bibliography.mode">
954         <xsl:apply-templates mode="bibliography.mode"/>
955         </xsl:template>
956
957         <xsl:template match="isbn" mode="bibliography.mode">
958         <xsl:apply-templates mode="bibliography.mode"/>
959         </xsl:template>
960
961         <xsl:template match="issn" mode="bibliography.mode">
962         <xsl:apply-templates mode="bibliography.mode"/>
963         </xsl:template>
964
965         <xsl:template match="issuenum" mode="bibliography.mode">
966         <xsl:apply-templates mode="bibliography.mode"/>
967         </xsl:template>
968
969         <xsl:template match="jobtitle" mode="bibliography.mode">
970         <xsl:apply-templates mode="bibliography.mode"/>
971         </xsl:template>
972
973         <xsl:template match="lineage" mode="bibliography.mode">
974         <xsl:apply-templates mode="bibliography.mode"/>
975         </xsl:template>
976
977         <xsl:template match="orgname" mode="bibliography.mode">
978         <xsl:apply-templates mode="bibliography.mode"/>
979         </xsl:template>
980
981         <xsl:template match="orgdiv" mode="bibliography.mode">
982         <xsl:apply-templates mode="bibliography.mode"/>
983         </xsl:template>
984
985         <xsl:template match="othercredit" mode="bibliography.mode">
986         <xsl:apply-templates mode="bibliography.mode"/>
987         </xsl:template>
988
989         <xsl:template match="othername" mode="bibliography.mode">
990         <xsl:apply-templates mode="bibliography.mode"/>
991         </xsl:template>
992
993         <xsl:template match="pagenums" mode="bibliography.mode">
994         <xsl:apply-templates mode="bibliography.mode"/>
995         </xsl:template>
996
997         <xsl:template match="printhistory" mode="bibliography.mode">
998         <!-- suppressed -->
999         </xsl:template>
1000
1001         <xsl:template match="productname" mode="bibliography.mode">
1002         <xsl:apply-templates mode="bibliography.mode"/>
1003         </xsl:template>
1004
1005         <xsl:template match="productnumber" mode="bibliography.mode">
1006         <xsl:apply-templates mode="bibliography.mode"/>
1007         </xsl:template>
1008
1009         <xsl:template match="pubdate" mode="bibliography.mode">
1010         <xsl:apply-templates mode="bibliography.mode"/>
1011         </xsl:template>
1012
1013         <xsl:template match="publisher" mode="bibliography.mode">
1014         <xsl:apply-templates mode="bibliography.mode"/>
1015         </xsl:template>
1016
1017         <xsl:template match="publishername" mode="bibliography.mode">
1018         <xsl:apply-templates mode="bibliography.mode"/>
1019         </xsl:template>
1020
1021         <xsl:template match="pubsnumber" mode="bibliography.mode">
1022         <xsl:apply-templates mode="bibliography.mode"/>
1023         </xsl:template>
1024
1025         <xsl:template match="releaseinfo" mode="bibliography.mode">
1026         <xsl:apply-templates mode="bibliography.mode"/>
1027         </xsl:template>
1028
1029         <xsl:template match="revhistory" mode="bibliography.mode">
1030         <xsl:apply-templates mode="bibliography.mode"/>
1031         </xsl:template>
1032
1033         <xsl:template match="seriesinfo" mode="bibliography.mode">
1034         <xsl:apply-templates mode="bibliography.mode"/>
1035         </xsl:template>
1036
1037         <xsl:template match="seriesvolnums" mode="bibliography.mode">
1038         <xsl:apply-templates mode="bibliography.mode"/>
1039         </xsl:template>
1040
1041         <xsl:template match="shortaffil" mode="bibliography.mode">
1042         <xsl:apply-templates mode="bibliography.mode"/>
1043         </xsl:template>
1044
1045         <xsl:template match="subtitle" mode="bibliography.mode">
1046         <xsl:apply-templates mode="bibliography.mode"/>
1047         </xsl:template>
1048
1049         <xsl:template match="surname" mode="bibliography.mode">
1050         <xsl:apply-templates mode="bibliography.mode"/>
1051         </xsl:template>
1052
1053         <xsl:template match="title" mode="bibliography.mode">
1054         <xsl:apply-templates mode="bibliography.mode"/>
1055         </xsl:template>
1056
1057         <xsl:template match="titleabbrev" mode="bibliography.mode">
1058         <xsl:apply-templates mode="bibliography.mode"/>
1059         </xsl:template>
1060
1061         <xsl:template match="volumenum" mode="bibliography.mode">
1062         <xsl:apply-templates mode="bibliography.mode"/>
1063         </xsl:template>
1064
1065         <xsl:template match="*" mode="bibliography.mode">
1066         <xsl:apply-templates select="."/>
1067         </xsl:template>
1068
1069 </xsl:stylesheet>