Debian Codegraph @

xslt/docbook/html/db2html-bibliography.xsl

raw
1 <?xml version='1.0' encoding='UTF-8'?><!-- -*- indent-tabs-mode: nil -*- -->
2 <!--
3 This program is free software; you can redistribute it and/or modify it under
4 the terms of the GNU Lesser General Public License as published by the Free
5 Software Foundation; either version 2 of the License, or (at your option) any
6 later version.
7
8 This program is distributed in the hope that it will be useful, but WITHOUT
9 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11 details.
12
13 You should have received a copy of the GNU Lesser General Public License
14 along with this program; see the file COPYING.LGPL. If not, see <http://www.gnu.org/licenses/>.
15 -->
16
17 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
18 xmlns:db="http://docbook.org/ns/docbook"
19 xmlns:msg="http://projects.gnome.org/yelp/gettext/"
20 xmlns:set="http://exslt.org/sets"
21 xmlns="http://www.w3.org/1999/xhtml"
22 exclude-result-prefixes="db msg set"
23 version="1.0">
24
25 <!--!!==========================================================================
26 DocBook to HTML - Bibliographies
27 @revision[version=3.4 date=2011-11-14 status=final]
28
29 This module provides templates to process DocBook bibliograpies.
30 -->
31
32
33 <!--**==========================================================================
34 db2html.biblioentry.data
35 Output structured data for a bibliography entry.
36 @revision[version=3.4 date=2011-11-14 status=final]
37
38 [xsl:params]
39 $node: The `biblioentry` or `biblioset` element to output data for.
40
41 This template outputs a bibliography entry, or part of a bibliography entry,
42 based on structured data found in a `biblioentry` or `biblioset` element.
43 -->
44 <xsl:template name="db2html.biblioentry.data">
45 <xsl:param name="node" select="."/>
46 <xsl:variable name="authors" select="$node/author | $node/authorgroup/author |
47 $node/db:author | $node/db:authorgroup/db:author"/>
48 <xsl:if test="$authors">
49 <xsl:call-template name="db.personname.list">
50 <xsl:with-param name="nodes" select="$authors"/>
51 </xsl:call-template>
52 <xsl:text>. </xsl:text>
53 </xsl:if>
54 <xsl:variable name="titles" select="$node/title | $node/citetitle |
55 $node/db:title | $node/db:citetitle"/>
56 <xsl:if test="$titles">
57 <xsl:apply-templates mode="db2html.biblioentry.mode" select="$titles[1]"/>
58 <xsl:if test="$node/volumenum or $node/db:volumenum">
59 <xsl:text>, </xsl:text>
60 <xsl:apply-templates mode="db2html.biblioentry.mode"
61 select="($node/volumenum | $node/db:volumenum)[1]"/>
62 </xsl:if>
63 <xsl:if test="$node/issuenum or $node/db:issuenum">
64 <xsl:text>, </xsl:text>
65 <xsl:apply-templates mode="db2html.biblioentry.mode"
66 select="($node/issuenum | $node/db:issuenum)[1]"/>
67 </xsl:if>
68 <xsl:if test="$node/pagenums or $node/db:pagenums">
69 <xsl:text>, </xsl:text>
70 <xsl:apply-templates mode="db2html.biblioentry.mode"
71 select="($node/pagenums | $node/db:pagenums)[1]"/>
72 </xsl:if>
73 <xsl:if test="$node/artpagenums or $node/db:artpagenums">
74 <xsl:text>, </xsl:text>
75 <xsl:apply-templates mode="db2html.biblioentry.mode"
76 select="($node/artpagenums | $node/db:artpagenums)[1]"/>
77 </xsl:if>
78 <xsl:text>. </xsl:text>
79 </xsl:if>
80 <xsl:variable name="publisher" select="$node/publisher | $node/publishername |
81 $node/db:publisher | $node/db:publishername"/>
82 <xsl:if test="$publisher">
83 <xsl:apply-templates mode="db2html.biblioentry.mode" select="$publisher[1]"/>
84 <xsl:text>. </xsl:text>
85 </xsl:if>
86 <xsl:if test="$node/copyright or $node/db:copyright">
87 <xsl:for-each select="$node/copyright | $node/db:copyright">
88 <xsl:apply-templates mode="db2html.biblioentry.mode" select="."/>
89 <xsl:if test="position() != 1">
90 <xsl:call-template name="l10n.gettext">
91 <xsl:with-param name="msgid" select="', '"/>
92 </xsl:call-template>
93 </xsl:if>
94 </xsl:for-each>
95 <xsl:text>. </xsl:text>
96 </xsl:if>
97 <xsl:for-each select="$node/isbn | $node/issn | $node/pubsnumber | $node/biblioid | $node/db:biblioid">
98 <xsl:apply-templates mode="db2html.biblioentry.mode" select="."/>
99 <xsl:text>. </xsl:text>
100 </xsl:for-each>
101 <xsl:for-each select="$node/date | $node/pubdate | $node/db:date | $node/db:pubdate">
102 <xsl:apply-templates mode="db2html.biblioentry.mode" select="."/>
103 <xsl:text>. </xsl:text>
104 </xsl:for-each>
105 <xsl:for-each select="$node/biblioset | $node/db:biblioset">
106 <xsl:call-template name="db2html.biblioentry.data"/>
107 </xsl:for-each>
108 </xsl:template>
109
110
111 <!--**==========================================================================
112 db2html.biblioentry.label
113 Output the label for a bibliography entry.
114 @revision[version=3.4 date=2011-11-14 status=final]
115
116 [xsl:params]
117 $node: The `biblioentry` or `bibliomixed` element to generate a label for.
118
119 This template outputs a label to be placed inline at the beginning of a bibliography
120 entry. Labels are created for both `biblioentry` and `bibliomixed` elements.
121 The label is typically an abbreviation of the authors' names and the year of
122 publication. In DocBook, it is usually provided with a leading `abbrev`
123 element. Without a leading `abbrev` element, this template will instead
124 use the `xreflabel` or `id` attribute.
125 -->
126 <xsl:template name="db2html.biblioentry.label">
127 <xsl:param name="node" select="."/>
128 <xsl:if test="$node/*[1]/self::abbrev or $node/@xreflabel or $node/@id or
129 $node/*[1]/self::db:abbrev or $node/@xml:id">
130 <span class="bibliolabel">
131 <xsl:call-template name="l10n.gettext">
132 <xsl:with-param name="msgid" select="'biblioentry.label'"/>
133 <xsl:with-param name="node" select="."/>
134 <xsl:with-param name="format" select="true()"/>
135 </xsl:call-template>
136 </span>
137 <xsl:text> </xsl:text>
138 </xsl:if>
139 </xsl:template>
140
141 <!--#% l10n.format.mode % msg:biblioentry.label -->
142 <xsl:template mode="l10n.format.mode" match="msg:biblioentry.label">
143 <xsl:param name="node"/>
144 <xsl:choose>
145 <xsl:when test="$node/*[1]/self::abbrev">
146 <xsl:apply-templates select="$node/abbrev[1]"/>
147 </xsl:when>
148 <xsl:when test="$node/*[1]/self::db:abbrev">
149 <xsl:apply-templates select="$node/db:abbrev[1]"/>
150 </xsl:when>
151 <xsl:when test="$node/@xreflabel">
152 <xsl:value-of select="$node/@xreflabel"/>
153 </xsl:when>
154 <xsl:when test="$node/@id">
155 <xsl:value-of select="$node/@id"/>
156 </xsl:when>
157 <xsl:when test="$node/@xml:id">
158 <xsl:value-of select="$node/@xml:id"/>
159 </xsl:when>
160 </xsl:choose>
161 </xsl:template>
162
163
164 <!--%%==========================================================================
165 db2html.biblioentry.mode
166 Format elements inside a `biblioentry` or `bibliomixed` element.
167 @revision[version=3.4 date=2011-11-14 status=final]
168
169 This mode is used when processing the child elements of a `biblioentry` or a
170 `bibliomixed` element. Some elements are treated differently when they appear
171 inside a bibliography entry.
172 -->
173 <xsl:template mode="db2html.biblioentry.mode" match="*">
174 <span>
175 <xsl:call-template name="html.class.attr">
176 <xsl:with-param name="class" select="local-name(.)"/>
177 </xsl:call-template>
178 <xsl:call-template name="html.lang.attrs"/>
179 <xsl:call-template name="db2html.anchor"/>
180 <xsl:apply-templates mode="db2html.biblioentry.mode"/>
181 </span>
182 </xsl:template>
183
184 <!-- = abstract % db2html.biblioentry.mode = -->
185 <xsl:template mode="db2html.biblioentry.mode" match="abstract | db:abstract"/>
186
187 <!-- = affiliation % db2html.biblioentry.mode = -->
188 <xsl:template mode="db2html.biblioentry.mode" match="affiliation | db:affiliation"/>
189
190 <!-- = author % db2html.biblioentry.mode = -->
191 <xsl:template mode="db2html.biblioentry.mode" match="author | db:author">
192 <xsl:call-template name="db.personname"/>
193 </xsl:template>
194
195 <!-- = authorblurb % db2html.biblioentry.mode = -->
196 <xsl:template mode="db2html.biblioentry.mode" match="authorblurb"/>
197
198 <!-- = authorgroup % db2html.biblioentry.mode = -->
199 <xsl:template mode="db2html.biblioentry.mode" match="authorgroup | db:authorgroup">
200 <xsl:call-template name="db.personname.list">
201 <xsl:with-param name="nodes" select="*"/>
202 </xsl:call-template>
203 </xsl:template>
204
205 <!-- = biblioset % db2html.biblioentry.mode = -->
206 <xsl:template mode="db2html.biblioentry.mode" match="biblioset | db:biblioset">
207 <xsl:call-template name="db2html.biblioentry.data"/>
208 </xsl:template>
209
210 <!-- = citerefentry % db2html.biblioentry.mode = -->
211 <xsl:template mode="db2html.biblioentry.mode" match="citerefentry | db:citerefentry">
212 <xsl:apply-templates select="."/>
213 </xsl:template>
214
215 <!-- = collab % db2html.biblioentry.mode = -->
216 <xsl:template mode="db2html.biblioentry.mode" match="collab | db:collab">
217 <xsl:apply-templates select="."/>
218 </xsl:template>
219
220 <!-- = copyright % db2html.biblioentry.mode = -->
221 <xsl:template mode="db2html.biblioentry.mode" match="copyright | db:copyright">
222 <xsl:call-template name="db.copyright"/>
223 </xsl:template>
224
225 <!-- = cover % db2html.biblioentry.mode = -->
226 <xsl:template mode="db2html.biblioentry.mode" match="db:cover"/>
227
228 <!-- = editor % db2html.biblioentry.mode = -->
229 <xsl:template mode="db2html.biblioentry.mode" match="editor | db:editor">
230 <xsl:call-template name="db.personname"/>
231 </xsl:template>
232
233 <!-- = footnote % db2html.biblioentry.mode = -->
234 <xsl:template mode="db2html.biblioentry.mode" match="footnote | footnoteref | db:footnote | db:footnoteref">
235 <xsl:apply-templates select="."/>
236 </xsl:template>
237
238 <!-- = glossterm % db2html.biblioentry.mode = -->
239 <xsl:template mode="db2html.biblioentry.mode" match="glossterm | db:glossterm">
240 <xsl:apply-templates select="."/>
241 </xsl:template>
242
243 <!-- = indexterm % db2html.biblioentry.mode = -->
244 <xsl:template mode="db2html.biblioentry.mode" match="indexterm | db:indexterm"/>
245
246 <!-- = legalnotice % db2html.biblioentry.mode = -->
247 <xsl:template mode="db2html.biblioentry.mode" match="legalnotice | db:legalnotice"/>
248
249 <!-- = mediaobject % db2html.biblioentry.mode = -->
250 <xsl:template mode="db2html.biblioentry.mode" match="mediaobject | db:mediaobject">
251 <xsl:apply-templates select="."/>
252 </xsl:template>
253
254 <!-- = org % db2html.biblioentry.mode = -->
255 <xsl:template mode="db2html.biblioentry.mode" match="db:org">
256 <xsl:call-template name="db.personname"/>
257 </xsl:template>
258
259 <!-- = othercredit % db2html.biblioentry.mode = -->
260 <xsl:template mode="db2html.biblioentry.mode" match="othercredit | db:othercredit">
261 <xsl:call-template name="db.personname"/>
262 </xsl:template>
263
264 <!-- = person % db2html.biblioentry.mode = -->
265 <xsl:template mode="db2html.biblioentry.mode" match="db:person">
266 <xsl:call-template name="db.personname"/>
267 </xsl:template>
268
269 <!-- = personname % db2html.biblioentry.mode = -->
270 <xsl:template mode="db2html.biblioentry.mode" match="personname | db:personname">
271 <xsl:call-template name="db.personname"/>
272 </xsl:template>
273
274 <!-- = personblurb % db2html.biblioentry.mode = -->
275 <xsl:template mode="db2html.biblioentry.mode" match="personblurb | db:personblurb"/>
276
277 <!-- = publisher % db2html.biblioentry.mode = -->
278 <xsl:template mode="db2html.biblioentry.mode" match="publisher | db:publisher">
279 <xsl:apply-templates mode="db2html.biblioentry.mode"
280 select="publishername | db:publishername"/>
281 </xsl:template>
282
283 <!-- = printhistory % db2html.biblioentry.mode = -->
284 <xsl:template mode="db2html.biblioentry.mode" match="printhistory | db:printhistory"/>
285
286 <!-- = subscript % db2html.biblioentry.mode = -->
287 <xsl:template mode="db2html.biblioentry.mode" match="subscript | db:subscript">
288 <xsl:apply-templates select="."/>
289 </xsl:template>
290
291 <!-- = superscript % db2html.biblioentry.mode = -->
292 <xsl:template mode="db2html.biblioentry.mode" match="superscript | db:superscript">
293 <xsl:apply-templates select="."/>
294 </xsl:template>
295
296 <!-- = revhistory % db2html.biblioentry.mode = -->
297 <xsl:template mode="db2html.biblioentry.mode" match="revhistory | db:revhistory"/>
298
299
300 <!-- == Matched Templates == -->
301
302 <!-- = bibliography = -->
303 <xsl:template match="bibliography | db:bibliography">
304 <xsl:param name="depth_in_chunk">
305 <xsl:call-template name="db.chunk.depth-in-chunk"/>
306 </xsl:param>
307 <xsl:param name="depth_of_chunk">
308 <xsl:call-template name="db.chunk.depth-of-chunk"/>
309 </xsl:param>
310 <xsl:call-template name="db2html.division.div">
311 <xsl:with-param name="info" select="bibliographyinfo | db:info"/>
312 <xsl:with-param name="divisions" select="bibliodiv | db:bibliodiv"/>
313 <xsl:with-param name="depth_in_chunk" select="$depth_in_chunk"/>
314 <xsl:with-param name="depth_of_chunk" select="$depth_of_chunk"/>
315 </xsl:call-template>
316 </xsl:template>
317
318 <!-- = bibliodiv = -->
319 <xsl:template match="bibliodiv | db:bibliodiv">
320 <xsl:param name="depth_in_chunk">
321 <xsl:call-template name="db.chunk.depth-in-chunk"/>
322 </xsl:param>
323 <xsl:param name="depth_of_chunk">
324 <xsl:call-template name="db.chunk.depth-of-chunk"/>
325 </xsl:param>
326 <xsl:call-template name="db2html.division.div">
327 <xsl:with-param name="info" select="db:info"/>
328 <xsl:with-param name="depth_in_chunk" select="$depth_in_chunk"/>
329 <xsl:with-param name="depth_of_chunk" select="$depth_of_chunk"/>
330 </xsl:call-template>
331 </xsl:template>
332
333 <!-- = biblioentry = -->
334 <xsl:template match="biblioentry | db:biblioentry">
335 <xsl:variable name="if"><xsl:call-template name="db.profile.test"/></xsl:variable>
336 <xsl:if test="$if != ''">
337 <div>
338 <xsl:call-template name="html.class.attr">
339 <xsl:with-param name="class" select="'biblioentry'"/>
340 </xsl:call-template>
341 <xsl:call-template name="html.lang.attrs"/>
342 <xsl:call-template name="db2html.anchor"/>
343 <xsl:call-template name="db2html.biblioentry.label"/>
344 <xsl:call-template name="db2html.biblioentry.data"/>
345 </div>
346 </xsl:if>
347 </xsl:template>
348
349 <!-- = bibliomixed = -->
350 <xsl:template match="bibliomixed | db:bibliomixed">
351 <xsl:variable name="node" select="."/>
352 <xsl:variable name="if"><xsl:call-template name="db.profile.test"/></xsl:variable>
353 <xsl:if test="$if != ''">
354 <div>
355 <xsl:call-template name="html.class.attr">
356 <xsl:with-param name="class" select="'biblimixed'"/>
357 </xsl:call-template>
358 <xsl:call-template name="html.lang.attrs"/>
359 <xsl:call-template name="db2html.anchor"/>
360 <xsl:call-template name="db2html.biblioentry.label"/>
361 <xsl:apply-templates mode="db2html.biblioentry.mode"
362 select="node()[not(set:has-same-node(., $node/*[1]/self::abbrev | $node/*[1]/self::db:abbrev))]"/>
363 </div>
364 </xsl:if>
365 </xsl:template>
366
367 <!-- = bibliolist = -->
368 <xsl:template match="bibliolist | db:bibliolist">
369 <xsl:call-template name="db2html.block.formal">
370 <xsl:with-param name="class" select="'list'"/>
371 </xsl:call-template>
372 </xsl:template>
373
374 </xsl:stylesheet>