Debian Codegraph @

docs/xsl-generic/manpages/info.xsl

raw
1 <?xml version='1.0'?>
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:date="http://exslt.org/dates-and-times"
4 xmlns:exsl="http://exslt.org/common"
5 exclude-result-prefixes="date exsl"
6 version='1.0'>
7
8 <!-- ********************************************************************
9 $Id: info.xsl 7087 2007-07-19 07:20:38Z xmldoc $
10 ********************************************************************
11
12 This file is part of the XSL DocBook Stylesheet distribution.
13 See ../README or http://docbook.sf.net/release/xsl/current/ for
14 copyright and other information.
15
16 ******************************************************************** -->
17
18 <xsl:variable name="blurb-indent">
19 <xsl:choose>
20 <xsl:when test="not($man.indent.blurbs = 0)">
21 <xsl:value-of select="$man.indent.width"/>
22 </xsl:when>
23 <xsl:when test="not($man.indent.refsect = 0)">
24 <!-- * "zq" is the name of a register we set for -->
25 <!-- * preserving the original default indent value -->
26 <!-- * when $man.indent.refsect is non-zero; -->
27 <!-- * "u" is a roff unit specifier -->
28 <xsl:text>\n(zqu</xsl:text>
29 </xsl:when>
30 <xsl:otherwise/> <!-- * otherwise, just leave it empty -->
31 </xsl:choose>
32 </xsl:variable>
33
34 <!-- ================================================================== -->
35 <!-- * About the $info param used in this stylesheet -->
36 <!-- * -->
37 <!-- * The $info param is a "master info" node set that contains -->
38 <!-- * the entire contents of the *info child of the current -->
39 <!-- * Refentry, plus the entire contents of the *info children of -->
40 <!-- * all ancestors of the current Refentry, in document order. -->
41 <!-- * -->
42 <!-- * We try to find a "best match" for selecting content from -->
43 <!-- * $infor; we look through it in reverse document order until we -->
44 <!-- * can find something usable. -->
45 <!-- * -->
46 <!-- * Specifically what the basic metadata-gathering XPath expression -->
47 <!-- * in this stylesheet does is: -->
48 <!-- * -->
49 <!-- * 1. Look through the entire "master info" node set.-->
50 <!-- * 2. Get the last node in the set that contains, for -->
51 <!-- * example, an Author element. That amounts to being the -->
52 <!-- * closest *info node to the Refentry - either its *info -->
53 <!-- * child, or the *info node of its closest ancestor that -->
54 <!-- * contains an Author. -->
55
56 <!-- ================================================================== -->
57 <!-- * Get user "refentry metadata" preferences -->
58 <!-- ================================================================== -->
59 <!-- * The DocBook XSL stylesheets include several user-configurable -->
60 <!-- * global stylesheet parameters for controlling refentry metadata -->
61 <!-- * gathering. Those parameters are not read directly by the other -->
62 <!-- * refentry metadata-gathering templates. Instead, they are read -->
63 <!-- * only by the get.refentry.metadata.prefs template, which -->
64 <!-- * assembles them into a structure that is then passed to the -->
65 <!-- * other refentry metadata-gathering template. -->
66
67 <xsl:variable name="get.refentry.metadata.prefs">
68 <!-- * get.refentry.metadata.prefs is in common/refentry.xsl -->
69 <xsl:call-template name="get.refentry.metadata.prefs"/>
70 </xsl:variable>
71
72 <xsl:variable name="refentry.metadata.prefs"
73 select="exsl:node-set($get.refentry.metadata.prefs)"/>
74
75 <!-- * ============================================================== -->
76 <!-- * Get content for Author metadata field. -->
77 <!-- * ============================================================== -->
78
79 <!-- * The make.roff.metatada.author template and metadata.author -->
80 <!-- * mode are used only for populating the Author field in the -->
81 <!-- * metadata "top comment" we embed in roff source of each page. -->
82
83 <xsl:template name="make.roff.metadata.author">
84 <xsl:param name="info"/>
85 <xsl:choose>
86 <xsl:when test="$info//author">
87 <xsl:apply-templates
88 select="(($info[//author])[last()]//author)[1]"
89 mode="metadata.author"/>
90 </xsl:when>
91 <xsl:when test="$info//corpauthor">
92 <xsl:apply-templates
93 select="(($info[//corpauthor])[last()]//corpauthor)[1]"
94 mode="metadata.author"/>
95 </xsl:when>
96 <xsl:when test="$info//editor">
97 <xsl:apply-templates
98 select="(($info[//editor])[last()]//editor)[1]"
99 mode="metadata.author"/>
100 </xsl:when>
101 <xsl:when test="$info//corpcredit">
102 <xsl:apply-templates
103 select="(($info[//corpcredit])[last()]//corpcredit)[1]"
104 mode="metadata.author"/>
105 </xsl:when>
106 <xsl:when test="$info//othercredit">
107 <xsl:apply-templates
108 select="(($info[//othercredit])[last()]//othercredit)[1]"
109 mode="metadata.author"/>
110 </xsl:when>
111 <xsl:when test="$info//collab">
112 <xsl:apply-templates
113 select="(($info[//collab])[last()]//collab)[1]"
114 mode="metadata.author"/>
115 </xsl:when>
116 <xsl:when test="$info//orgname">
117 <xsl:apply-templates
118 select="(($info[//orgname])[last()]//orgname)[1]"
119 mode="metadata.author"/>
120 </xsl:when>
121 <xsl:when test="$info//publishername">
122 <xsl:apply-templates
123 select="(($info[//publishername])[last()]//publishername)[1]"
124 mode="metadata.author"/>
125 </xsl:when>
126 <xsl:otherwise/> <!-- * do nothing, no author info found -->
127 </xsl:choose>
128 </xsl:template>
129
130 <xsl:template match="author|editor|othercredit|collab" mode="metadata.author">
131 <xsl:choose>
132 <xsl:when test="collabname">
133 <!-- * If this node is a Collab, then it should have a -->
134 <!-- * Collabname child, so get that. -->
135 <xsl:variable name="contents">
136 <xsl:apply-templates select="collabname"/>
137 </xsl:variable>
138 <xsl:value-of select="normalize-space($contents)"/>
139 </xsl:when>
140 <xsl:otherwise>
141 <!-- * Otherwise, this node is not a Collab, but instead -->
142 <!-- * an author|editor|othercredit, which must have a name -->
143 <!-- * of some kind; so get that name -->
144 <xsl:call-template name="person.name.normalized"/>
145 </xsl:otherwise>
146 </xsl:choose>
147 <xsl:if test=".//email|address/otheraddr/ulink">
148 <xsl:text> </xsl:text>
149 <!-- * For each attribution found, use only the first e-mail -->
150 <!-- * address or ulink value found -->
151 <xsl:apply-templates select="(.//email|address/otheraddr/ulink)[1]"
152 mode="metadata.author"/>
153 </xsl:if>
154 </xsl:template>
155
156 <xsl:template match="email|address/otheraddr/ulink" mode="metadata.author">
157 <xsl:text>&lt;</xsl:text>
158 <xsl:choose>
159 <xsl:when test="self::email">
160 <xsl:variable name="contents">
161 <xsl:apply-templates/>
162 </xsl:variable>
163 <xsl:value-of select="normalize-space($contents)"/>
164 </xsl:when>
165 <xsl:when test="self::ulink">
166 <xsl:variable name="contents">
167 <xsl:apply-templates select="."/>
168 </xsl:variable>
169 <xsl:value-of select="normalize-space($contents)"/>
170 </xsl:when>
171 </xsl:choose>
172 <xsl:text>&gt;</xsl:text>
173 </xsl:template>
174
175 <xsl:template match="corpauthor|corpcredit|orgname|publishername" mode="metadata.author">
176 <xsl:variable name="contents">
177 <xsl:apply-templates/>
178 </xsl:variable>
179 <xsl:value-of select="normalize-space($contents)"/>
180 </xsl:template>
181
182 <!-- * ============================================================== -->
183 <!-- * Assemble the AUTHOR/AUTHORS section -->
184 <!-- * ============================================================== -->
185
186 <xsl:template name="author.section">
187 <xsl:param name="info"/>
188 <!-- * The $info param is a "master info" node set that contains -->
189 <!-- * the entires contents of the *info child of the current -->
190 <!-- * Refentry, plus the entire contents of the *info children of -->
191 <!-- * all ancestors of the current Refentry, in document order. -->
192 <xsl:choose>
193 <xsl:when test="$info//author|$info//editor|$info//collab|
194 $info//corpauthor|$info//corpcredit|
195 $info//othercredit|$info/orgname|
196 $info/publishername|$info/publisher">
197 <xsl:variable name="authorcount">
198 <xsl:value-of
199 select="count(
200 $info//author|$info//editor|$info//collab|
201 $info//corpauthor|$info//corpcredit|
202 $info//othercredit)">
203 </xsl:value-of>
204 </xsl:variable>
205 <xsl:text>.SH "</xsl:text>
206 <xsl:call-template name="make.authorsecttitle">
207 <xsl:with-param name="authorcount" select="$authorcount"/>
208 </xsl:call-template>
209 <!-- * Now output all the actual author, editor, etc. content -->
210 <xsl:for-each
211 select="$info//author|$info//editor|$info//collab|
212 $info//corpauthor|$info//corpcredit|
213 $info//othercredit|$info/orgname|
214 $info/publishername|$info/publisher">
215 <xsl:apply-templates select="." mode="authorsect"/>
216 </xsl:for-each>
217 </xsl:when>
218 <xsl:otherwise/> <!-- * do nothing, no author info found -->
219 </xsl:choose>
220 </xsl:template>
221
222 <xsl:template name="make.authorsecttitle">
223 <!-- * If we have exactly one attributable person/entity, then output -->
224 <!-- * localized gentext for 'Author'; otherwise, output 'Authors'. -->
225 <xsl:param name="authorcount"/>
226 <xsl:param name="authorsecttitle">
227 <xsl:choose>
228 <xsl:when test="$authorcount = 1">
229 <xsl:text>Author</xsl:text>
230 </xsl:when>
231 <xsl:otherwise>
232 <xsl:text>Authors</xsl:text>
233 </xsl:otherwise>
234 </xsl:choose>
235 </xsl:param>
236 <xsl:call-template name="string.upper">
237 <xsl:with-param name="string">
238 <xsl:call-template name="gentext">
239 <xsl:with-param name="key" select="$authorsecttitle"/>
240 </xsl:call-template>
241 </xsl:with-param>
242 </xsl:call-template>
243 <xsl:text>"&#10;</xsl:text>
244 </xsl:template>
245
246 <xsl:template match="author|editor|othercredit" mode="authorsect">
247 <xsl:variable name="person-name">
248 <xsl:call-template name="person.name.normalized"/>
249 </xsl:variable>
250 <!-- * If we have a person-name or email or ulink content, then -->
251 <!-- * output name and email or ulink content on the same line -->
252 <xsl:choose>
253 <xsl:when test="not($person-name = '') or .//email or address/otheraddr/ulink">
254 <xsl:text>.PP&#10;</xsl:text>
255 <!-- * Display person name in bold -->
256 <xsl:call-template name="bold">
257 <xsl:with-param name="node" select="exsl:node-set($person-name)"/>
258 <xsl:with-param name="context" select="."/>
259 </xsl:call-template>
260 <!-- * Display e-mail address(es) and ulink(s) on same line as name -->
261 <xsl:apply-templates select=".//email|address/otheraddr/ulink" mode="authorsect"/>
262 <xsl:text>&#10;</xsl:text>
263 </xsl:when>
264 <xsl:otherwise>
265 <xsl:text>.br&#10;</xsl:text>
266 </xsl:otherwise>
267 </xsl:choose>
268 <!-- * Display affiliation(s) on separate lines -->
269 <xsl:apply-templates select="affiliation" mode="authorsect"/>
270 <!-- * Display direct-child addresses on separate lines -->
271 <xsl:apply-templates select="address" mode="authorsect"/>
272 <!-- * Call template for handling various attribution possibilities -->
273 <xsl:call-template name="attribution"/>
274 </xsl:template>
275
276 <xsl:template match="collab" mode="authorsect">
277 <xsl:text>.PP&#10;</xsl:text>
278 <xsl:call-template name="bold">
279 <xsl:with-param name="node" select="collabname"/>
280 <xsl:with-param name="context" select="."/>
281 </xsl:call-template>
282 <!-- * Display e-mail address(es) and ulink(s) on same line as name -->
283 <xsl:apply-templates select=".//email|address/otheraddr/ulink" mode="authorsect"/>
284 <xsl:text>&#10;</xsl:text>
285 <!-- * Display affilition(s) on separate lines -->
286 <xsl:apply-templates select="affiliation" mode="authorsect"/>
287 </xsl:template>
288
289 <xsl:template match="corpauthor|corpcredit|orgname|publishername" mode="authorsect">
290 <xsl:text>.PP&#10;</xsl:text>
291 <xsl:call-template name="bold">
292 <xsl:with-param name="node" select="."/>
293 <xsl:with-param name="context" select="."/>
294 </xsl:call-template>
295 <xsl:text>&#10;</xsl:text>
296 <xsl:if test="self::publishername">
297 <!-- * Display localized "Publisher" gentext -->
298 <xsl:call-template name="publisher.attribution"/>
299 </xsl:if>
300 </xsl:template>
301
302 <xsl:template match="publisher" mode="authorsect">
303 <xsl:text>.PP&#10;</xsl:text>
304 <xsl:call-template name="bold">
305 <xsl:with-param name="node" select="publishername"/>
306 <xsl:with-param name="context" select="."/>
307 </xsl:call-template>
308 <!-- * Display e-mail address(es) and ulink(s) on same line as name -->
309 <xsl:apply-templates select=".//email|address/otheraddr/ulink" mode="authorsect"/>
310 <!-- * Display addresses on separate lines -->
311 <xsl:apply-templates select="address" mode="authorsect"/>
312 <!-- * Display localized "Publisher" literal -->
313 <xsl:call-template name="publisher.attribution"/>
314 </xsl:template>
315
316 <xsl:template name="publisher.attribution">
317 <xsl:text>&#10;</xsl:text>
318 <xsl:text>.sp -1n&#10;</xsl:text>
319 <xsl:text>.IP ""</xsl:text>
320 <xsl:if test="not($blurb-indent = '')">
321 <xsl:text> </xsl:text>
322 <xsl:value-of select="$blurb-indent"/>
323 </xsl:if>
324 <xsl:text>&#10;</xsl:text>
325 <xsl:call-template name="gentext">
326 <xsl:with-param name="key" select="'Publisher'"/>
327 </xsl:call-template>
328 <xsl:text>.&#10;</xsl:text>
329 </xsl:template>
330
331 <xsl:template match="email|address/otheraddr/ulink" mode="authorsect">
332 <xsl:choose>
333 <xsl:when test="preceding-sibling::*[descendant-or-self::email]
334 or preceding-sibling::address/otheraddr/ulink
335 or ancestor::address[preceding-sibling::*[descendant-or-self::email]]
336 or ancestor::address[preceding-sibling::address/otheraddr/ulink]">
337 <!-- * This is not the first instance, so do nothing. -->
338 </xsl:when>
339 <xsl:otherwise>
340 <!-- * This is first instances of an e-mail address or ulink, -->
341 <!-- * so put a space before it. -->
342 <xsl:text> </xsl:text>
343 </xsl:otherwise>
344 </xsl:choose>
345 <!-- * Note that the reason for the \& character after the opening -->
346 <!-- * angle bracket and before the closing angle bracket is to -->
347 <!-- * prevent groff from inserting a linebreak at those points and -->
348 <!-- * outputting a hyphen character where the break occurs -->
349 <xsl:text>&lt;\&amp;</xsl:text>
350 <xsl:choose>
351 <xsl:when test="self::email">
352 <xsl:variable name="contents">
353 <xsl:apply-templates/>
354 </xsl:variable>
355 <xsl:value-of select="normalize-space($contents)"/>
356 </xsl:when>
357 <xsl:when test="self::ulink">
358 <xsl:variable name="contents">
359 <xsl:apply-templates select="."/>
360 </xsl:variable>
361 <xsl:value-of select="normalize-space($contents)"/>
362 </xsl:when>
363 </xsl:choose>
364 <xsl:text>\&amp;&gt;</xsl:text>
365 <xsl:choose>
366 <xsl:when test="not(following-sibling::*[descendant-or-self::email]
367 or following-sibling::address/otheraddr/ulink
368 or ancestor::address[following-sibling::*[descendant-or-self::email]]
369 or ancestor::address[following-sibling::address/otheraddr/ulink])">
370 <!-- * This is the final instance, so do nothing. -->
371 </xsl:when>
372 <xsl:otherwise>
373 <!-- * Separate multiple e-mail addresses or ulinks with a comma -->
374 <xsl:text>, </xsl:text>
375 </xsl:otherwise>
376 </xsl:choose>
377 </xsl:template>
378
379 <xsl:template match="affiliation" mode="authorsect">
380 <!-- * Get the string value of the contents of this Affiliation. If the -->
381 <!-- * affiliation only contains an Address child whose only content is -->
382 <!-- * an email address or ulink, then these contents will end up empty. -->
383 <xsl:variable name="contents">
384 <xsl:apply-templates mode="authorsect"/>
385 </xsl:variable>
386 <!-- * If contents are actually empty except for an email address -->
387 <!-- * or ulink, then output nothing. -->
388 <xsl:if test="$contents != ''">
389 <xsl:text>.br&#10;</xsl:text>
390 <xsl:for-each select="shortaffil|jobtitle|orgname|orgdiv|address">
391 <!-- * only display output of nodes other than email or ulink -->
392 <xsl:apply-templates select="node()[not(self::email) and not(self::otheraddr/ulink)]"/>
393 <xsl:choose>
394 <xsl:when test="position() = last()"/> <!-- do nothing -->
395 <xsl:otherwise>
396 <!-- * only add comma if the node has a child node other than -->
397 <!-- * an email address or ulink -->
398 <xsl:if test="child::node()[not(self::email) and not(self::otheraddr/ulink)]">
399 <xsl:text>, </xsl:text>
400 </xsl:if>
401 </xsl:otherwise>
402 </xsl:choose>
403 </xsl:for-each>
404 <xsl:text>&#10;</xsl:text>
405 <xsl:choose>
406 <xsl:when test="position() = last()"/> <!-- do nothing -->
407 <xsl:otherwise>
408 <!-- * put a line break after every Affiliation instance except -->
409 <!-- * the last one in the set -->
410 <xsl:text>.br&#10;</xsl:text>
411 </xsl:otherwise>
412 </xsl:choose>
413 </xsl:if>
414 </xsl:template>
415
416 <xsl:template match="address" mode="authorsect">
417 <xsl:variable name="contents"
418 select="normalize-space(node()[not(self::email)
419 and not(self::otheraddr/ulink)])"/>
420 <!-- * If this contents of this Address do not contain anything except -->
421 <!-- * an email address or ulink, then output nothing. -->
422 <xsl:if test="$contents != ''">
423 <xsl:text>&#10;</xsl:text>
424 <xsl:text>.br&#10;</xsl:text>
425 <!--* Skip email and ulink descendants of Address (rendered elsewhere) -->
426 <xsl:apply-templates select="node()[not(self::email) and not(self::otheraddr/ulink)]"/>
427 </xsl:if>
428 </xsl:template>
429
430 <xsl:template name="attribution">
431 <!-- * Determine appropriate attribution for a particular person's role. -->
432 <xsl:choose>
433 <!-- * if we have a *blurb or contrib, just use that -->
434 <xsl:when test="contrib|personblurb|authorblurb">
435 <xsl:apply-templates select="contrib|personblurb|authorblurb" mode="authorsect"/>
436 <xsl:text>&#10;</xsl:text>
437 </xsl:when>
438 <!-- * If we have no *blurb or contrib, but this is an Author or -->
439 <!-- * Editor, then render the corresponding localized gentext -->
440 <xsl:when test="self::author">
441 <xsl:text>&#10;</xsl:text>
442 <xsl:text>.sp -1n&#10;</xsl:text>
443 <xsl:text>.IP ""</xsl:text>
444 <xsl:if test="not($blurb-indent = '')">
445 <xsl:text> </xsl:text>
446 <xsl:value-of select="$blurb-indent"/>
447 </xsl:if>
448 <xsl:text>&#10;</xsl:text>
449 <xsl:call-template name="gentext">
450 <xsl:with-param name="key" select="'Author'"/>
451 </xsl:call-template>
452 <xsl:text>.&#10;</xsl:text>
453 </xsl:when>
454 <xsl:when test="self::editor">
455 <xsl:text>&#10;</xsl:text>
456 <xsl:text>.sp -1n&#10;</xsl:text>
457 <xsl:text>.IP ""</xsl:text>
458 <xsl:if test="not($blurb-indent = '')">
459 <xsl:text> </xsl:text>
460 <xsl:value-of select="$blurb-indent"/>
461 </xsl:if>
462 <xsl:text>&#10;</xsl:text>
463 <xsl:call-template name="gentext">
464 <xsl:with-param name="key" select="'Editor'"/>
465 </xsl:call-template>
466 <xsl:text>.&#10;</xsl:text>
467 </xsl:when>
468 <!-- * If we have no *blurb or contrib, but this is an Othercredit, -->
469 <!-- * check value of Class attribute and use corresponding gentext. -->
470 <xsl:when test="self::othercredit">
471 <xsl:choose>
472 <xsl:when test="@class and @class != 'other'">
473 <xsl:text>&#10;</xsl:text>
474 <xsl:text>.sp -1n&#10;</xsl:text>
475 <xsl:text>.IP ""</xsl:text>
476 <xsl:if test="not($blurb-indent = '')">
477 <xsl:text> </xsl:text>
478 <xsl:value-of select="$blurb-indent"/>
479 </xsl:if>
480 <xsl:text>&#10;</xsl:text>
481 <xsl:call-template name="gentext">
482 <xsl:with-param name="key" select="@class"/>
483 </xsl:call-template>
484 <xsl:text>.&#10;</xsl:text>
485 </xsl:when>
486 <xsl:otherwise>
487 <!-- * We have an Othercredit, but not usable value for the Class -->
488 <!-- * attribute, so nothing to show, do nothing -->
489 </xsl:otherwise>
490 </xsl:choose>
491 </xsl:when>
492 <xsl:otherwise>
493 <!-- * We have no *blurb or contrib or anything else we can use to -->
494 <!-- * display appropriate attribution for this person, so do nothing -->
495 </xsl:otherwise>
496 </xsl:choose>
497 </xsl:template>
498
499 <xsl:template match="personblurb|authorblurb" mode="authorsect">
500 <xsl:call-template name="mark.up.blurb.or.contrib"/>
501 <!-- * yeah, it's possible for a *blurb to have a "title" -->
502 <xsl:apply-templates select="title"/>
503 <xsl:apply-templates select="*[not(self::title)]"/>
504 </xsl:template>
505
506 <xsl:template match="personblurb/title|authorblurb/title">
507 <!-- * always render period after title -->
508 <xsl:variable name="contents">
509 <xsl:apply-templates/>
510 </xsl:variable>
511 <xsl:value-of select="normalize-space($contents)"/>
512 <xsl:text>.</xsl:text>
513 <!-- * render space after Title+period if the title is followed -->
514 <!-- * by something element content -->
515 <xsl:if test="following-sibling::*[name() != '']">
516 <xsl:text> </xsl:text>
517 </xsl:if>
518 </xsl:template>
519
520 <xsl:template match="contrib" mode="authorsect">
521 <xsl:call-template name="mark.up.blurb.or.contrib"/>
522 <xsl:variable name="contents">
523 <xsl:apply-templates/>
524 </xsl:variable>
525 <xsl:value-of select="normalize-space($contents)"/>
526 <xsl:text>&#10;</xsl:text>
527 </xsl:template>
528
529 <xsl:template name="mark.up.blurb.or.contrib">
530 <xsl:choose>
531 <!-- * If this *blurb has a sibling "name" element of some kind, then -->
532 <!-- * we are already outputting the name content, and we need to -->
533 <!-- * indent the *blurb content after that. -->
534 <xsl:when
535 test="../personname|../surname|../firstname
536 |../othername|../lineage|../honorific
537 |../affiliation|../email|../address">
538 <xsl:text>&#10;</xsl:text>
539 <xsl:text>.sp -1n&#10;</xsl:text>
540 <xsl:text>.IP ""</xsl:text>
541 <xsl:if test="not($blurb-indent = '')">
542 <xsl:text> </xsl:text>
543 <xsl:value-of select="$blurb-indent"/>
544 </xsl:if>
545 </xsl:when>
546 <xsl:otherwise>
547 <!-- * otherwise, we have no "name" content, so don't indent; -->
548 <!-- * instead, decide if we need a .PP or just a .br -->
549 <xsl:choose>
550 <xsl:when test="not(preceding-sibling::*)">
551 <!-- * if this *blurb or contrib has no preceding -->
552 <!-- * siblings, then we need to start a new paragraph -->
553 <xsl:text>.PP</xsl:text>
554 </xsl:when>
555 <xsl:otherwise>
556 <!-- * otherwise, this has no preceding siblings, so -->
557 <!-- * just put a linebreak -->
558 <xsl:text>.br</xsl:text>
559 </xsl:otherwise>
560 </xsl:choose>
561 </xsl:otherwise>
562 </xsl:choose>
563 <xsl:text>&#10;</xsl:text>
564 </xsl:template>
565
566 <!-- * ============================================================== -->
567 <!-- * Assemble the COPYRIGHT section -->
568 <!-- * ============================================================== -->
569 <!-- * The COPYRIGHT section is output only if a copyright or -->
570 <!-- * legalnotice is found. It contains the copyright contents -->
571 <!-- * followed by the legalnotice contents. -->
572 <xsl:template name="copyright.section">
573 <xsl:param name="info"/>
574 <xsl:choose>
575 <xsl:when test="$info//copyright|$info//legalnotice">
576 <xsl:text>.SH "</xsl:text>
577 <xsl:call-template name="string.upper">
578 <xsl:with-param name="string">
579 <xsl:call-template name="gentext">
580 <xsl:with-param name="key">Copyright</xsl:with-param>
581 </xsl:call-template>
582 </xsl:with-param>
583 </xsl:call-template>
584 <xsl:text>"&#10;</xsl:text>
585 <!-- * the copyright mode="titlepage.mode" template is -->
586 <!-- * imported from the HTML stylesheets -->
587 <xsl:for-each select="
588 (($info[//copyright])[last()]//copyright)
589 | (($info[//legalnotice])[last()]//legalnotice)">
590 <xsl:choose>
591 <xsl:when test="local-name(.) = 'copyright'">
592 <xsl:variable name="contents">
593 <xsl:apply-templates select="." mode="titlepage.mode"/>
594 </xsl:variable>
595 <xsl:value-of select="normalize-space($contents)"/>
596 <xsl:text>&#10;</xsl:text>
597 <xsl:text>.br&#10;</xsl:text>
598 </xsl:when>
599 <xsl:otherwise>
600 <xsl:apply-templates select="." mode="titlepage.mode"/>
601 <xsl:text>&#10;</xsl:text>
602 <xsl:text>.sp&#10;</xsl:text>
603 </xsl:otherwise>
604 </xsl:choose>
605 </xsl:for-each>
606 </xsl:when>
607 <xsl:otherwise/> <!-- * do nothing, no copyright or legalnotice found -->
608 </xsl:choose>
609 </xsl:template>
610
611 <xsl:template match="legalnotice">
612 <xsl:apply-templates/>
613 </xsl:template>
614
615 <!-- * ============================================================== -->
616
617 <!-- * suppress refmeta and all *info (we grab what we need from them -->
618 <!-- * elsewhere) -->
619
620 <xsl:template match="refmeta"/>
621
622 <xsl:template match="info|refentryinfo|referenceinfo|refsynopsisdivinfo
623 |refsectioninfo|refsect1info|refsect2info|refsect3info
624 |setinfo|bookinfo|articleinfo|chapterinfo|sectioninfo
625 |sect1info|sect2info|sect3info|sect4info|sect5info
626 |partinfo|prefaceinfo|appendixinfo|docinfo"/>
627
628 <!-- ============================================================== -->
629
630 </xsl:stylesheet>