trying to get HEAD building again. If you want the code
[abartlet/samba.git/.git] / docs / docbook / xslt / db2latex / biblio.mod.xsl
1 <?xml version='1.0'?>
2 <!--############################################################################# 
3 |- #############################################################################
4 |                                                                                                               
5 |   PURPOSE: Manage Bibliography.
6 + ############################################################################## -->
7
8 <xsl:stylesheet 
9     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
10     xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
11     exclude-result-prefixes="doc" version='1.0'>
12
13
14
15     <!--############################################################################# -->
16     <!-- DOCUMENTATION                                                                -->
17     <doc:reference id="biblio" xmlns="">
18         <referenceinfo>
19             <releaseinfo role="meta">
20             </releaseinfo>
21             <authorgroup>
22             <author> <firstname>Ramon</firstname> <surname>Casellas</surname> </author>
23             <author> <firstname>James</firstname> <surname>Devenish</surname> </author>
24             </authorgroup>
25             <copyright>
26                 <year>2000</year><year>2001</year><year>2002</year><year>2003</year>
27                 <holder>Ramon Casellas</holder>
28             </copyright>
29         </referenceinfo>
30
31         <title>Bibliography related XSL Variables and Templates <filename>biblio.mod.xsl</filename></title>
32
33         <partintro>
34             <section><title>Introduction</title>
35                 <para>This reference describes the templates and parameters relevant
36                     to formatting DocBook bibliography markup.</para>
37             </section>
38             <section><title>All Vs. Cited mode</title>
39                 <para> Using this option, only the biblioentries that have been 
40                     cited somewhere in the document are output. Otherwise (in All mode)
41                     all bibentries found are output (as the HTML stylesheets do).</para>
42             </section>
43         </partintro>
44     </doc:reference>
45     <!--############################################################################# -->
46
47
48
49     <!--############################################################################# 
50     |   BIBLIOGRAPHY    
51     |- #############################################################################
52     |   
53     |                                                                                                           
54     |   
55     + ############################################################################## -->
56
57     <!--############################################################################# -->
58     <!-- DOCUMENTATION                                                                -->
59     <doc:template match="bibliography" xmlns="">
60         <refpurpose> bibliography XSL template </refpurpose>
61         <refdescription>
62             <formalpara><title>Remarks and Bugs</title>
63                 <itemizedlist>
64                 </itemizedlist>
65             </formalpara>
66         </refdescription>
67     </doc:template>
68     <!--############################################################################# -->
69
70     <xsl:template match="bibliography">
71         <xsl:message>DB2LaTeX: Processing BIBLIOGRAPHY</xsl:message>
72         <xsl:message>DB2LaTeX: Output Mode :  <xsl:value-of select="$latex.biblio.output"/></xsl:message>
73         <xsl:text>% ------------------------------------------- &#10;</xsl:text>
74         <xsl:text>%     &#10;</xsl:text>
75         <xsl:text>%  Bibliography&#10;</xsl:text>
76         <xsl:text>%     &#10;</xsl:text>
77         <xsl:text>% ------------------------------------------- &#10;</xsl:text>
78         <xsl:text>\bibliography{</xsl:text><xsl:value-of select="$latex.bibfiles"/><xsl:text>}&#10;</xsl:text>
79         <xsl:if test="biblioentry or bibliodiv">
80         <xsl:text>\begin{thebibliography}{</xsl:text>
81         <xsl:value-of select="$latex.bibwidelabel"/>
82         <xsl:text>}&#10;</xsl:text>
83         <xsl:choose>
84             <xsl:when test="$latex.biblio.output ='cited'">
85                 <xsl:apply-templates select="biblioentry" mode="bibliography.cited">
86                     <xsl:sort select="./abbrev"/>
87                     <xsl:sort select="./@xreflabel"/>
88                     <xsl:sort select="./@id"/>
89                 </xsl:apply-templates>
90             </xsl:when>
91             <xsl:when test="$latex.biblio.output ='all'">
92                 <xsl:apply-templates select="biblioentry" mode="bibliography.all">
93                     <xsl:sort select="./abbrev"/>
94                     <xsl:sort select="./@xreflabel"/>
95                     <xsl:sort select="./@id"/>
96                 </xsl:apply-templates>
97             </xsl:when>
98             <xsl:otherwise>
99                 <xsl:apply-templates select="biblioentry">
100                     <xsl:sort select="./abbrev"/>
101                     <xsl:sort select="./@xreflabel"/>
102                     <xsl:sort select="./@id"/>
103                 </xsl:apply-templates>
104             </xsl:otherwise>
105         </xsl:choose>
106         <!-- <xsl:apply-templates select="child::*[name(.)!='biblioentry']"/>  -->
107         <xsl:apply-templates select="bibliodiv"/> 
108         <xsl:text>&#10;\end{thebibliography}&#10;</xsl:text>
109         </xsl:if>
110     </xsl:template>
111
112     <xsl:template match="bibliography/title"/>
113     <xsl:template match="bibliography/subtitle"/>
114     <xsl:template match="bibliography/titleabbrev"/>
115
116
117
118     <!--############################################################################# 
119     |   BIBLIODIV
120     |- #############################################################################
121     |   
122     |                                                                                                           
123     |   
124     + ############################################################################## -->
125
126     <!--############################################################################# -->
127     <!-- DOCUMENTATION                                                                -->
128     <doc:template match="bibliodiv" xmlns="">
129         <refpurpose> bibliography XSL template </refpurpose>
130         <refdescription>
131             <formalpara><title>Remarks and Bugs</title>
132                 <itemizedlist>
133                 </itemizedlist>
134             </formalpara>
135         </refdescription>
136     </doc:template>
137     <!--############################################################################# -->
138
139     <xsl:template match="bibliodiv">
140         <xsl:message>DB2LaTeX: Processing BIBLIOGRAPHY - BIBLIODIV</xsl:message>
141         <!--
142         <xsl:call-template name="label.id"/>
143         <xsl:text>&#10;</xsl:text>
144         <xsl:text>\vspace{1cm}</xsl:text>
145         <xsl:text>\noindent{\Large {\sc </xsl:text><xsl:call-template name="normalize-scape">
146             <xsl:with-param name="string" select="title"/> </xsl:call-template>
147         <xsl:text>}}\\&#10;&#10;</xsl:text>
148         -->
149         <xsl:choose>
150             <xsl:when test="$latex.biblio.output ='cited'">
151                 <xsl:apply-templates select="biblioentry" mode="bibliography.cited">
152                     <xsl:sort select="./abbrev"/>
153                     <xsl:sort select="./@xreflabel"/>
154                     <xsl:sort select="./@id"/>
155                 </xsl:apply-templates>
156             </xsl:when>
157             <xsl:when test="$latex.biblio.output ='all'">
158                 <xsl:apply-templates select="biblioentry">
159                     <xsl:sort select="./abbrev"/>
160                     <xsl:sort select="./@xreflabel"/>
161                     <xsl:sort select="./@id"/>
162                 </xsl:apply-templates>
163             </xsl:when>
164         </xsl:choose>
165     </xsl:template>
166
167     <xsl:template match="bibliodiv/title"/>
168
169
170
171     <!--############################################################################# 
172     |   BIBLIOENTRY
173     - #############################################################################
174     |   
175     |                                                                                                           
176     |   
177     + ############################################################################## -->
178
179
180     <!--############################################################################# -->
181     <!-- DOCUMENTATION                                                                -->
182     <doc:template match="biblioentry" mode="bibliography.cited" xmlns="">
183         <refpurpose> bibliography XSL template </refpurpose>
184         <refdescription>
185             <formalpara><title>Remarks and Bugs</title>
186                 <itemizedlist>
187                 </itemizedlist>
188             </formalpara>
189         </refdescription>
190     </doc:template>
191     <!--############################################################################# -->
192
193     <xsl:template match="biblioentry" mode="bibliography.cited">
194         <xsl:param name="bibid" select="@id"/>
195         <xsl:param name="ab" select="abbrev"/>
196         <xsl:variable name="nx" select="//xref[@linkend=$bibid]"/>
197         <xsl:variable name="nc" select="//citation[text()=$ab]"/>
198         <xsl:if test="count($nx) &gt; 0 or count($nc) &gt; 0">
199             <xsl:call-template name="biblioentry.output"/>
200         </xsl:if>
201     </xsl:template>
202
203
204     <!--############################################################################# -->
205     <!-- DOCUMENTATION                                                                -->
206     <doc:template match="biblioentry"  mode="bibliography.all" xmlns="">
207         <refpurpose> bibliography XSL template </refpurpose>
208         <refdescription>
209             <formalpara><title>Remarks and Bugs</title>
210                 <itemizedlist>
211                 </itemizedlist>
212             </formalpara>
213         </refdescription>
214     </doc:template>
215     <!--############################################################################# -->
216
217     <xsl:template match="biblioentry" mode="bibliography.all">
218         <xsl:call-template name="biblioentry.output"/>
219     </xsl:template>
220
221     <xsl:template match="biblioentry">
222         <xsl:call-template name="biblioentry.output"/>
223     </xsl:template>
224
225     <xsl:template name="biblioentry.output">
226         <xsl:variable name="biblioentry.label">
227             <xsl:choose>
228                 <xsl:when test="@xreflabel">
229                     <xsl:value-of select="normalize-space(@xreflabel)"/> 
230                 </xsl:when>
231                 <xsl:when test="abbrev">
232                     <xsl:apply-templates select="abbrev" mode="bibliography.mode"/> 
233                 </xsl:when>
234                 <xsl:when test="@id">
235                     <xsl:value-of select="normalize-space(@id)"/> 
236                 </xsl:when>
237                 <xsl:otherwise>
238                 </xsl:otherwise>
239             </xsl:choose>
240         </xsl:variable>
241         <xsl:variable name="biblioentry.id">
242             <xsl:choose>
243                 <xsl:when test="abbrev">
244                     <xsl:apply-templates select="abbrev" mode="bibliography.mode"/> 
245                 </xsl:when>
246                 <xsl:otherwise>
247                         <xsl:call-template name="generate.label.id"/>
248                 </xsl:otherwise>
249             </xsl:choose>
250         </xsl:variable>
251         <xsl:text>&#10;</xsl:text>
252         <xsl:text>% -------------- biblioentry &#10;</xsl:text>
253         <xsl:choose>
254                 <xsl:when test="$biblioentry.label=''">
255                         <xsl:text>\bibitem</xsl:text> 
256                 </xsl:when>
257                 <xsl:otherwise>
258                         <xsl:text>\bibitem[</xsl:text>
259                         <xsl:call-template name="normalize-scape">
260                                 <xsl:with-param name="string" select="$biblioentry.label"/>
261                         </xsl:call-template>
262                         <xsl:text>]</xsl:text> 
263                 </xsl:otherwise>
264         </xsl:choose>
265         <xsl:text>{</xsl:text>
266         <xsl:value-of select="$biblioentry.id"/>
267         <xsl:text>}\docbooktolatexbibaux{</xsl:text> 
268         <xsl:call-template name="generate.label.id"/> 
269         <xsl:text>}{</xsl:text> 
270         <xsl:value-of select="$biblioentry.id"/>
271         <xsl:text>}&#10;\hypertarget{</xsl:text> 
272         <xsl:call-template name="generate.label.id"/> 
273         <xsl:text>}{\emph{</xsl:text> <xsl:apply-templates select="title" mode="bibliography.mode"/> <xsl:text>}}</xsl:text>
274         <xsl:value-of select="$biblioentry.item.separator"/>
275         <xsl:apply-templates select="author|authorgroup" mode="bibliography.mode"/>
276         <xsl:for-each select="child::copyright|child::publisher|child::pubdate|child::pagenums|child::isbn|child::editor|child::releaseinfo">
277             <xsl:value-of select="$biblioentry.item.separator"/>
278             <xsl:apply-templates select="." mode="bibliography.mode"/> 
279         </xsl:for-each>
280         <xsl:text>.</xsl:text>
281         <xsl:text>&#10;&#10;</xsl:text>
282     </xsl:template>
283
284     <!-- EMPTY templates -->
285     <xsl:template match="abstract" mode="bibliography.mode"/>
286     <xsl:template match="authorblurb" mode="bibliography.mode"/>
287
288
289
290     <xsl:template match="abbrev" mode="bibliography.mode">
291         <xsl:apply-templates mode="bibliography.mode"/>
292     </xsl:template>
293
294     <xsl:template match="address" mode="bibliography.mode">
295         <xsl:apply-templates mode="bibliography.mode"/>
296     </xsl:template>
297
298     <xsl:template match="affiliation" mode="bibliography.mode">
299         <xsl:apply-templates mode="bibliography.mode"/>
300     </xsl:template>
301
302     <xsl:template match="shortaffil" mode="bibliography.mode">
303         <xsl:apply-templates mode="bibliography.mode"/>
304     </xsl:template>
305
306     <xsl:template match="jobtitle" mode="bibliography.mode">
307         <xsl:apply-templates mode="bibliography.mode"/>
308     </xsl:template>
309
310     <xsl:template match="artheader" mode="bibliography.mode">
311         <xsl:apply-templates mode="bibliography.mode"/>
312     </xsl:template>
313
314     <xsl:template match="artpagenums" mode="bibliography.mode">
315         <xsl:apply-templates mode="bibliography.mode"/>
316     </xsl:template>
317
318     <xsl:template match="author" mode="bibliography.mode">
319         <xsl:variable name="authorsstring">
320             <xsl:call-template name="person.name"/>
321         </xsl:variable>
322         <xsl:value-of select="normalize-space($authorsstring)"/>
323     </xsl:template>
324
325
326
327     <xsl:template match="author[position()=last()]" mode="bibliography.mode">
328         <xsl:variable name="authorsstring">
329             <xsl:call-template name="person.name"/>
330         </xsl:variable>
331         <xsl:value-of select="normalize-space($authorsstring)"/>
332     </xsl:template>
333
334
335     <!-- 
336     Authorgroup
337     calls person.name.list in ../common/common.xsl in order to get a
338     formatted string. We need to return to "normalized-space(.) of it 
339     -->
340
341     <xsl:template match="authorgroup" mode="bibliography.mode">
342         <xsl:variable name="authorsstring">
343             <xsl:call-template name="person.name.list"/>
344         </xsl:variable>
345         <xsl:value-of select="normalize-space($authorsstring)"/>
346     </xsl:template>
347
348     <xsl:template match="authorinitials" mode="bibliography.mode">
349         <xsl:apply-templates mode="bibliography.mode"/>
350     </xsl:template>
351
352     <xsl:template match="bibliomisc" mode="bibliography.mode">
353         <xsl:apply-templates mode="bibliography.mode"/>
354     </xsl:template>
355
356     <xsl:template match="bibliomset" mode="bibliography.mode">
357         <xsl:apply-templates mode="bibliography.mode"/>
358     </xsl:template>
359
360     <xsl:template match="bibliomixed" mode="bibliography.mode">
361         <xsl:apply-templates mode="bibliography.mode"/>
362     </xsl:template>
363
364
365
366
367
368
369
370     <xsl:template match="biblioset" mode="bibliography.mode">
371         <xsl:apply-templates mode="bibliography.mode"/>
372     </xsl:template>
373
374     <xsl:template match="biblioset/title|biblioset/citetitle" 
375         mode="bibliography.mode">
376         <xsl:variable name="relation" select="../@relation"/>
377         <xsl:choose>
378             <xsl:when test="$relation='article'">
379                 <xsl:call-template name="dingbat">
380                     <xsl:with-param name="dingbat">ldquo</xsl:with-param>
381                 </xsl:call-template>
382                 <xsl:apply-templates/>
383                 <xsl:call-template name="dingbat">
384                     <xsl:with-param name="dingbat">rdquo</xsl:with-param>
385                 </xsl:call-template>
386             </xsl:when>
387             <xsl:otherwise>
388                 <xsl:apply-templates/>
389             </xsl:otherwise>
390         </xsl:choose>
391     </xsl:template>
392
393     <xsl:template match="bookbiblio" mode="bibliography.mode">
394         <xsl:apply-templates mode="bibliography.mode"/>
395     </xsl:template>
396
397     <xsl:template match="citetitle" mode="bibliography.mode">
398         <I><xsl:apply-templates mode="bibliography.mode"/></I>
399     </xsl:template>
400
401     <xsl:template match="collab" mode="bibliography.mode">
402         <xsl:apply-templates mode="bibliography.mode"/>
403     </xsl:template>
404
405     <xsl:template match="collabname" mode="bibliography.mode">
406         <xsl:apply-templates mode="bibliography.mode"/>
407     </xsl:template>
408
409     <xsl:template match="confgroup" mode="bibliography.mode">
410         <xsl:apply-templates mode="bibliography.mode"/>
411     </xsl:template>
412
413     <xsl:template match="confdates" mode="bibliography.mode">
414         <xsl:apply-templates mode="bibliography.mode"/>
415     </xsl:template>
416
417     <xsl:template match="conftitle" mode="bibliography.mode">
418         <xsl:apply-templates mode="bibliography.mode"/>
419     </xsl:template>
420
421     <xsl:template match="confnum" mode="bibliography.mode">
422         <xsl:apply-templates mode="bibliography.mode"/>
423     </xsl:template>
424
425     <xsl:template match="confsponsor" mode="bibliography.mode">
426         <xsl:apply-templates mode="bibliography.mode"/>
427     </xsl:template>
428
429     <xsl:template match="contractnum" mode="bibliography.mode">
430         <xsl:apply-templates mode="bibliography.mode"/>
431     </xsl:template>
432
433     <xsl:template match="contractsponsor" mode="bibliography.mode">
434         <xsl:apply-templates mode="bibliography.mode"/>
435     </xsl:template>
436
437     <xsl:template match="contrib" mode="bibliography.mode">
438         <xsl:apply-templates mode="bibliography.mode"/>
439     </xsl:template>
440
441     <xsl:template match="copyright" mode="bibliography.mode">
442         <xsl:call-template name="gentext.element.name"/>
443         <xsl:call-template name="gentext.space"/>
444         <xsl:call-template name="dingbat">
445             <xsl:with-param name="dingbat">copyright</xsl:with-param>
446         </xsl:call-template>
447         <xsl:call-template name="gentext.space"/>
448         <xsl:apply-templates select="year" mode="bibliography.mode"/>
449         <xsl:call-template name="gentext.space"/>
450         <xsl:apply-templates select="holder" mode="bibliography.mode"/>
451     </xsl:template>
452
453     <xsl:template match="year" mode="bibliography.mode">
454         <xsl:apply-templates/><xsl:text>, </xsl:text>
455     </xsl:template>
456
457     <xsl:template match="year[position()=last()]" mode="bibliography.mode">
458         <xsl:apply-templates/>
459     </xsl:template>
460
461     <xsl:template match="holder" mode="bibliography.mode">
462         <xsl:apply-templates/>
463     </xsl:template>
464
465     <xsl:template match="corpauthor" mode="bibliography.mode">
466         <xsl:apply-templates mode="bibliography.mode"/>
467     </xsl:template>
468
469     <xsl:template match="corpname" mode="bibliography.mode">
470         <xsl:apply-templates mode="bibliography.mode"/>
471     </xsl:template>
472
473     <xsl:template match="date" mode="bibliography.mode">
474         <xsl:apply-templates mode="bibliography.mode"/>
475     </xsl:template>
476
477     <xsl:template match="edition" mode="bibliography.mode">
478         <xsl:apply-templates mode="bibliography.mode"/>
479     </xsl:template>
480
481     <xsl:template match="editor" mode="bibliography.mode">
482         <xsl:call-template name="person.name"/>
483     </xsl:template>
484
485     <xsl:template match="firstname" mode="bibliography.mode">
486         <xsl:apply-templates mode="bibliography.mode"/>
487     </xsl:template>
488
489     <xsl:template match="honorific" mode="bibliography.mode">
490         <xsl:apply-templates mode="bibliography.mode"/>
491     </xsl:template>
492
493     <xsl:template match="indexterm" mode="bibliography.mode">
494         <xsl:apply-templates mode="bibliography.mode"/>
495     </xsl:template>
496
497     <xsl:template match="invpartnumber" mode="bibliography.mode">
498         <xsl:apply-templates mode="bibliography.mode"/>
499     </xsl:template>
500
501     <xsl:template match="isbn" mode="bibliography.mode">
502         <xsl:apply-templates mode="bibliography.mode"/>
503     </xsl:template>
504
505     <xsl:template match="issn" mode="bibliography.mode">
506         <xsl:apply-templates mode="bibliography.mode"/>
507     </xsl:template>
508
509     <xsl:template match="issuenum" mode="bibliography.mode">
510         <xsl:apply-templates mode="bibliography.mode"/>
511     </xsl:template>
512
513     <xsl:template match="lineage" mode="bibliography.mode">
514         <xsl:apply-templates mode="bibliography.mode"/>
515     </xsl:template>
516
517     <xsl:template match="orgname" mode="bibliography.mode">
518         <xsl:apply-templates mode="bibliography.mode"/>
519     </xsl:template>
520
521     <xsl:template match="orgdiv" mode="bibliography.mode">
522         <xsl:apply-templates mode="bibliography.mode"/>
523     </xsl:template>
524
525     <xsl:template match="othercredit" mode="bibliography.mode">
526         <xsl:apply-templates mode="bibliography.mode"/>
527     </xsl:template>
528
529     <xsl:template match="othername" mode="bibliography.mode">
530         <xsl:apply-templates mode="bibliography.mode"/>
531     </xsl:template>
532
533     <xsl:template match="pagenums" mode="bibliography.mode">
534         <xsl:apply-templates mode="bibliography.mode"/>
535     </xsl:template>
536
537     <xsl:template match="printhistory" mode="bibliography.mode">
538         <!-- suppressed -->
539     </xsl:template>
540
541     <xsl:template match="productname" mode="bibliography.mode">
542         <xsl:apply-templates mode="bibliography.mode"/>
543     </xsl:template>
544
545     <xsl:template match="productnumber" mode="bibliography.mode">
546         <xsl:apply-templates mode="bibliography.mode"/>
547     </xsl:template>
548
549     <xsl:template match="pubdate" mode="bibliography.mode">
550         <xsl:apply-templates mode="bibliography.mode"/>
551     </xsl:template>
552
553     <xsl:template match="publisher" mode="bibliography.mode">
554         <xsl:apply-templates mode="bibliography.mode"/>
555     </xsl:template>
556
557     <xsl:template match="publishername" mode="bibliography.mode">
558         <xsl:apply-templates mode="bibliography.mode"/>
559     </xsl:template>
560
561     <xsl:template match="pubsnumber" mode="bibliography.mode">
562         <xsl:apply-templates mode="bibliography.mode"/>
563     </xsl:template>
564
565     <xsl:template match="releaseinfo" mode="bibliography.mode">
566         <xsl:apply-templates mode="bibliography.mode"/>
567     </xsl:template>
568
569     <xsl:template match="revhistory" mode="bibliography.mode">
570         <xsl:apply-templates mode="bibliography.mode"/>
571     </xsl:template>
572
573     <xsl:template match="seriesinfo" mode="bibliography.mode">
574         <xsl:apply-templates mode="bibliography.mode"/>
575     </xsl:template>
576
577     <xsl:template match="seriesvolnums" mode="bibliography.mode">
578         <xsl:apply-templates mode="bibliography.mode"/>
579     </xsl:template>
580
581     <xsl:template match="subtitle" mode="bibliography.mode">
582         <xsl:apply-templates mode="bibliography.mode"/>
583     </xsl:template>
584
585     <xsl:template match="surname" mode="bibliography.mode">
586         <xsl:apply-templates mode="bibliography.mode"/>
587     </xsl:template>
588
589     <xsl:template match="title" mode="bibliography.mode">
590         <xsl:apply-templates mode="bibliography.mode"/>
591     </xsl:template>
592
593     <xsl:template match="titleabbrev" mode="bibliography.mode">
594         <xsl:apply-templates mode="bibliography.mode"/>
595     </xsl:template>
596
597     <xsl:template match="volumenum" mode="bibliography.mode">
598         <xsl:apply-templates mode="bibliography.mode"/>
599     </xsl:template>
600
601     <xsl:template match="*" mode="bibliography.mode">
602         <xsl:apply-templates select="."/>
603     </xsl:template>
604
605 </xsl:stylesheet>