2
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
4
<!--############################################################################
5
XSLT Stylesheet DocBook -> LaTeX
6
############################################################################ -->
9
<!-- ##################
11
################## -->
13
<xsl:template name="biblio.title">
15
<xsl:when test="title|bibliographyinfo/title">
16
<xsl:value-of select="(title|bibliographyinfo/title)[1]"/>
19
<xsl:text>\bibname</xsl:text>
24
<xsl:template name="biblioentry.process">
25
<xsl:param name="level"/>
27
<xsl:text>\begin{btSect}{} </xsl:text>
29
<!-- display the heading -->
30
<xsl:if test="$level >= 0">
31
<xsl:call-template name="map.sect.level">
32
<xsl:with-param name="level" select="$level"/>
34
<xsl:text>{</xsl:text>
35
<xsl:call-template name="biblio.title"/>
36
<xsl:text>} </xsl:text>
37
<xsl:call-template name="label.id"/>
40
<xsl:text>\begin{bibgroup} </xsl:text>
41
<xsl:text>\begin{thebibliography}{</xsl:text>
42
<xsl:value-of select="$latex.bibwidelabel"/>
43
<xsl:text>} </xsl:text>
44
<xsl:if test="biblioentry">
46
<xsl:when test="$latex.biblio.output ='cited'">
47
<xsl:apply-templates select="biblioentry" mode="bibliography.cited">
48
<xsl:sort select="./abbrev"/>
49
<xsl:sort select="./@xreflabel"/>
50
<xsl:sort select="./@id"/>
51
</xsl:apply-templates>
54
<xsl:apply-templates select="biblioentry">
55
<xsl:sort select="./abbrev"/>
56
<xsl:sort select="./@xreflabel"/>
57
<xsl:sort select="./@id"/>
58
</xsl:apply-templates>
62
<xsl:if test="bibliomixed">
63
<xsl:apply-templates select="bibliomixed"/>
65
<xsl:text> \end{thebibliography} </xsl:text>
66
<xsl:text>\end{bibgroup} </xsl:text>
67
<xsl:text>\end{btSect} </xsl:text>
75
<xsl:template match="bibliography">
76
<xsl:message>Processing Bibliography</xsl:message>
77
<xsl:message>Output Mode: <xsl:value-of select="$latex.biblio.output"/></xsl:message>
78
<xsl:text>% ------------------------------------------- </xsl:text>
79
<xsl:text>% Bibliography </xsl:text>
80
<xsl:text>% ------------------------------------------- </xsl:text>
81
<xsl:text>\bibliography{</xsl:text>
82
<xsl:value-of select="$latex.bibfiles"/>
83
<xsl:text>} </xsl:text>
85
<!-- get the section level -->
86
<xsl:variable name="level">
87
<xsl:call-template name="get.sect.level"/>
91
<xsl:when test="biblioentry|bibliomixed">
92
<!-- process the entries -->
93
<xsl:call-template name="biblioentry.process">
94
<xsl:with-param name="level" select="$level"/>
98
<!-- no entries here, only a section block -->
99
<xsl:call-template name="map.sect.level">
100
<xsl:with-param name="level" select="$level"/>
102
<xsl:text>{</xsl:text>
103
<xsl:call-template name="biblio.title"/>
104
<xsl:text>} </xsl:text>
105
<xsl:call-template name="label.id"/>
108
<xsl:apply-templates select="bibliodiv"/>
111
<xsl:template match="bibliography/title"/>
112
<xsl:template match="bibliography/subtitle"/>
113
<xsl:template match="bibliography/titleabbrev"/>
119
<xsl:template match="bibliodiv">
120
<xsl:message>Processing Bibliography - Bibliodiv</xsl:message>
121
<xsl:variable name="level">
122
<xsl:call-template name="get.sect.level">
123
<xsl:with-param name="n" select="parent::bibliography"/>
126
<xsl:call-template name="biblioentry.process">
127
<xsl:with-param name="level" select="$level+1"/>
131
<xsl:template match="bibliodiv/title"/>
137
<xsl:template match="bibliolist">
138
<xsl:call-template name="biblioentry.process">
139
<xsl:with-param name="level" select="'-1'"/>
143
<xsl:template match="bibliodiv/title"/>
149
<xsl:template match="biblioentry" mode="bibliography.cited">
150
<xsl:param name="bibid" select="@id"/>
151
<xsl:param name="ab" select="abbrev"/>
152
<xsl:variable name="nx" select="//xref[@linkend=$bibid]"/>
153
<xsl:variable name="nc" select="//citation[text()=$ab]"/>
154
<xsl:if test="count($nx) > 0 or count($nc) > 0">
155
<xsl:call-template name="biblioentry.output"/>
159
<xsl:template match="biblioentry" mode="bibliography.all">
160
<xsl:call-template name="biblioentry.output"/>
163
<xsl:template match="biblioentry">
164
<xsl:call-template name="biblioentry.output"/>
167
<xsl:template match="biblioentry/title">
168
<xsl:text>\emph{</xsl:text>
169
<xsl:apply-templates/>
170
<xsl:text>}</xsl:text>
173
<!-- biblioentry engine -->
175
<xsl:template name="bibitem">
176
<xsl:variable name="tag">
178
<xsl:when test="@xreflabel">
179
<xsl:value-of select="normalize-space(@xreflabel)"/>
181
<xsl:when test="abbrev">
182
<xsl:apply-templates select="abbrev" mode="bibliography.mode"/>
184
<xsl:when test="@id">
185
<xsl:value-of select="normalize-space(@id)"/>
188
<xsl:text>UNKNOWN</xsl:text>
192
<xsl:text> </xsl:text>
193
<xsl:text>\bibitem</xsl:text>
194
<xsl:if test="$tag!='UNKNOWN'">
195
<xsl:text>[</xsl:text>
196
<xsl:call-template name="normalize-scape">
197
<xsl:with-param name="string" select="$tag"/>
199
<xsl:text>]</xsl:text>
201
<xsl:text>{</xsl:text>
202
<xsl:value-of select="$tag"/>
203
<xsl:text>} </xsl:text>
206
<xsl:template name="biblioentry.output">
207
<xsl:call-template name="bibitem"/>
208
<!-- first, biblioentry information (if any) -->
209
<xsl:variable name="data" select="subtitle|
219
<xsl:apply-templates select="author|authorgroup" mode="bibliography.mode"/>
220
<xsl:if test="title">
221
<xsl:if test="author|authorgroup">
222
<xsl:value-of select="$biblioentry.item.separator"/>
224
<xsl:apply-templates select="title"/>
226
<xsl:if test="$data">
227
<xsl:for-each select="$data">
228
<xsl:value-of select="$biblioentry.item.separator"/>
229
<xsl:apply-templates select="." mode="bibliography.mode"/>
231
<xsl:text>.</xsl:text>
233
<!-- then, biblioset information (if any) -->
234
<xsl:for-each select="biblioset">
235
<xsl:text> </xsl:text>
236
<xsl:apply-templates select="." mode="bibliography.mode"/>
238
<xsl:call-template name="label.id"/>
239
<xsl:text> </xsl:text>
242
<xsl:template match="bibliomixed">
243
<xsl:call-template name="bibitem"/>
244
<xsl:apply-templates select="." mode="bibliography.mode"/>
245
<xsl:text> </xsl:text>
249
<!-- by default no specific behaviour -->
251
<xsl:template match="*" mode="bibliography.mode">
252
<xsl:apply-templates mode="bibliography.mode"/>
255
<!-- specific behaviour for bibliography -->
257
<xsl:template match="biblioset" mode="bibliography.mode">
258
<xsl:if test="author|authorgroup">
259
<xsl:apply-templates select="author|authorgroup" mode="bibliography.mode"/>
260
<xsl:value-of select="$biblioentry.item.separator"/>
262
<xsl:apply-templates select="title" mode="bibliography.mode"/>
263
<xsl:for-each select="subtitle|
273
<xsl:value-of select="$biblioentry.item.separator"/>
274
<xsl:apply-templates select="." mode="bibliography.mode"/>
276
<xsl:text>.</xsl:text>
279
<xsl:template match="biblioset/title|biblioset/citetitle"
280
mode="bibliography.mode">
281
<xsl:variable name="relation" select="../@relation"/>
283
<xsl:when test="$relation='article'">
284
<xsl:call-template name="dingbat">
285
<xsl:with-param name="dingbat">ldquo</xsl:with-param>
287
<xsl:apply-templates/>
288
<xsl:call-template name="dingbat">
289
<xsl:with-param name="dingbat">rdquo</xsl:with-param>
293
<xsl:apply-templates/>
298
<xsl:template match="author" mode="bibliography.mode">
299
<xsl:variable name="authorsstring">
300
<xsl:call-template name="person.name"/>
302
<xsl:value-of select="normalize-space($authorsstring)"/>
305
<xsl:template match="authorgroup" mode="bibliography.mode">
306
<xsl:variable name="authorsstring">
307
<xsl:call-template name="person.name.list"/>
309
<xsl:value-of select="normalize-space($authorsstring)"/>
312
<xsl:template match="editor" mode="bibliography.mode">
313
<xsl:call-template name="person.name"/>
314
<xsl:value-of select="$biblioentry.item.separator"/>
317
<xsl:template match="copyright" mode="bibliography.mode">
318
<xsl:call-template name="gentext.element.name"/>
319
<xsl:call-template name="gentext.space"/>
320
<xsl:call-template name="dingbat">
321
<xsl:with-param name="dingbat">copyright</xsl:with-param>
323
<xsl:call-template name="gentext.space"/>
324
<xsl:apply-templates select="year" mode="bibliography.mode"/>
325
<xsl:call-template name="gentext.space"/>
326
<xsl:apply-templates select="holder" mode="bibliography.mode"/>
329
<xsl:template match="year" mode="bibliography.mode">
330
<xsl:apply-templates/>
331
<xsl:if test="position()!=last()">
332
<xsl:text>, </xsl:text>
337
<!-- to manage entities correctly (such as &) -->
338
<xsl:template match="holder|publishername|edition" mode="bibliography.mode">
339
<xsl:apply-templates/>
342
<!-- suppressed things -->
343
<xsl:template match="printhistory" mode="bibliography.mode"/>
344
<xsl:template match="abstract" mode="bibliography.mode"/>
345
<xsl:template match="authorblurb" mode="bibliography.mode"/>