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