source: trunk/Distribution/XSL/fo/refentry.xsl@ 2

Last change on this file since 2 was 2, checked in by jkacer, 18 years ago

Added all DocBook Framework stuff:

  • DocBook DTD
  • Transformation software FOP 0.20.5 and Saxon 6
  • XSL styles
  • Rexx scripts

Also added some WarpIN-related stuff for creation of WarpIN installation packages.
This state corresponds to version 1.0.0 from November 2005, just slightly modified to carry versioning information (Rexx scripts).

File size: 22.0 KB
Line 
1<?xml version='1.0'?>
2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:fo="http://www.w3.org/1999/XSL/Format"
4 xmlns:axf="http://www.antennahouse.com/names/XSL/Extensions"
5 version='1.0'>
6
7<!-- ********************************************************************
8 $Id: refentry.xsl,v 1.27 2005/06/01 10:25:16 xmldoc Exp $
9 ********************************************************************
10
11 This file is part of the XSL DocBook Stylesheet distribution.
12 See ../README or http://nwalsh.com/docbook/xsl/ for copyright
13 and other information.
14
15 ******************************************************************** -->
16
17<!-- ==================================================================== -->
18
19<xsl:template match="reference">
20 <xsl:if test="not(partintro)">
21 <xsl:variable name="id">
22 <xsl:call-template name="object.id"/>
23 </xsl:variable>
24 <xsl:variable name="master-reference">
25 <xsl:call-template name="select.pagemaster"/>
26 </xsl:variable>
27
28 <fo:page-sequence hyphenate="{$hyphenate}"
29 master-reference="{$master-reference}">
30 <xsl:attribute name="language">
31 <xsl:call-template name="l10n.language"/>
32 </xsl:attribute>
33 <xsl:attribute name="format">
34 <xsl:call-template name="page.number.format">
35 <xsl:with-param name="master-reference" select="$master-reference"/>
36 </xsl:call-template>
37 </xsl:attribute>
38
39 <xsl:attribute name="initial-page-number">
40 <xsl:call-template name="initial.page.number">
41 <xsl:with-param name="master-reference" select="$master-reference"/>
42 </xsl:call-template>
43 </xsl:attribute>
44
45 <xsl:attribute name="force-page-count">
46 <xsl:call-template name="force.page.count">
47 <xsl:with-param name="master-reference" select="$master-reference"/>
48 </xsl:call-template>
49 </xsl:attribute>
50
51 <xsl:attribute name="hyphenation-character">
52 <xsl:call-template name="gentext">
53 <xsl:with-param name="key" select="'hyphenation-character'"/>
54 </xsl:call-template>
55 </xsl:attribute>
56 <xsl:attribute name="hyphenation-push-character-count">
57 <xsl:call-template name="gentext">
58 <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
59 </xsl:call-template>
60 </xsl:attribute>
61 <xsl:attribute name="hyphenation-remain-character-count">
62 <xsl:call-template name="gentext">
63 <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
64 </xsl:call-template>
65 </xsl:attribute>
66
67 <xsl:apply-templates select="." mode="running.head.mode">
68 <xsl:with-param name="master-reference" select="$master-reference"/>
69 </xsl:apply-templates>
70 <xsl:apply-templates select="." mode="running.foot.mode">
71 <xsl:with-param name="master-reference" select="$master-reference"/>
72 </xsl:apply-templates>
73
74 <fo:flow flow-name="xsl-region-body">
75 <xsl:call-template name="set.flow.properties">
76 <xsl:with-param name="element" select="local-name(.)"/>
77 <xsl:with-param name="master-reference" select="$master-reference"/>
78 </xsl:call-template>
79
80 <fo:block id="{$id}">
81 <xsl:call-template name="reference.titlepage"/>
82 </fo:block>
83 <!-- Create one page sequence if no pagebreaks needed -->
84 <xsl:if test="$refentry.pagebreak = 0">
85 <xsl:apply-templates select="refentry"/>
86 </xsl:if>
87 </fo:flow>
88 </fo:page-sequence>
89 </xsl:if>
90 <xsl:apply-templates select="partintro"/>
91 <xsl:if test="$refentry.pagebreak != 0">
92 <xsl:apply-templates select="refentry"/>
93 </xsl:if>
94</xsl:template>
95
96<xsl:template match="reference" mode="reference.titlepage.mode">
97 <xsl:call-template name="reference.titlepage"/>
98</xsl:template>
99
100<xsl:template match="reference/partintro">
101 <xsl:variable name="id">
102 <xsl:call-template name="object.id">
103 <xsl:with-param name="object" select="ancestor::reference"/>
104 </xsl:call-template>
105 </xsl:variable>
106 <xsl:variable name="master-reference">
107 <xsl:call-template name="select.pagemaster"/>
108 </xsl:variable>
109
110 <fo:page-sequence hyphenate="{$hyphenate}"
111 master-reference="{$master-reference}">
112 <xsl:attribute name="language">
113 <xsl:call-template name="l10n.language"/>
114 </xsl:attribute>
115 <xsl:attribute name="format">
116 <xsl:call-template name="page.number.format">
117 <xsl:with-param name="master-reference" select="$master-reference"/>
118 </xsl:call-template>
119 </xsl:attribute>
120
121 <xsl:attribute name="initial-page-number">
122 <xsl:call-template name="initial.page.number">
123 <xsl:with-param name="master-reference" select="$master-reference"/>
124 </xsl:call-template>
125 </xsl:attribute>
126
127 <xsl:attribute name="force-page-count">
128 <xsl:call-template name="force.page.count">
129 <xsl:with-param name="master-reference" select="$master-reference"/>
130 </xsl:call-template>
131 </xsl:attribute>
132
133 <xsl:attribute name="hyphenation-character">
134 <xsl:call-template name="gentext">
135 <xsl:with-param name="key" select="'hyphenation-character'"/>
136 </xsl:call-template>
137 </xsl:attribute>
138 <xsl:attribute name="hyphenation-push-character-count">
139 <xsl:call-template name="gentext">
140 <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
141 </xsl:call-template>
142 </xsl:attribute>
143 <xsl:attribute name="hyphenation-remain-character-count">
144 <xsl:call-template name="gentext">
145 <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
146 </xsl:call-template>
147 </xsl:attribute>
148
149 <xsl:apply-templates select="." mode="running.head.mode">
150 <xsl:with-param name="master-reference" select="$master-reference"/>
151 </xsl:apply-templates>
152 <xsl:apply-templates select="." mode="running.foot.mode">
153 <xsl:with-param name="master-reference" select="$master-reference"/>
154 </xsl:apply-templates>
155
156 <fo:flow flow-name="xsl-region-body">
157 <xsl:call-template name="set.flow.properties">
158 <xsl:with-param name="element" select="local-name(.)"/>
159 <xsl:with-param name="master-reference" select="$master-reference"/>
160 </xsl:call-template>
161 <fo:block id="{$id}">
162 <xsl:apply-templates select=".." mode="reference.titlepage.mode"/>
163 </fo:block>
164 <xsl:if test="title">
165 <xsl:call-template name="partintro.titlepage"/>
166 </xsl:if>
167 <xsl:apply-templates/>
168 <!-- Create one page sequence if no pagebreaks needed -->
169 <xsl:if test="$refentry.pagebreak = 0">
170 <xsl:apply-templates select="../refentry"/>
171 </xsl:if>
172 </fo:flow>
173 </fo:page-sequence>
174</xsl:template>
175
176<xsl:template match="reference/docinfo|refentry/refentryinfo"></xsl:template>
177<xsl:template match="reference/title"></xsl:template>
178<xsl:template match="reference/subtitle"></xsl:template>
179
180<!-- ==================================================================== -->
181
182<xsl:template match="refentry">
183 <xsl:variable name="id">
184 <xsl:call-template name="object.id"/>
185 </xsl:variable>
186
187 <xsl:variable name="master-reference">
188 <xsl:call-template name="select.pagemaster"/>
189 </xsl:variable>
190
191 <xsl:variable name="refentry.content">
192 <fo:block id="{$id}">
193 <xsl:apply-templates/>
194 </fo:block>
195 </xsl:variable>
196
197 <xsl:choose>
198 <xsl:when test="not(parent::*) or
199 (parent::reference and $refentry.pagebreak != 0) or
200 parent::part">
201 <!-- make a page sequence -->
202 <fo:page-sequence hyphenate="{$hyphenate}"
203 master-reference="{$master-reference}">
204 <xsl:attribute name="language">
205 <xsl:call-template name="l10n.language"/>
206 </xsl:attribute>
207 <xsl:attribute name="format">
208 <xsl:call-template name="page.number.format">
209 <xsl:with-param name="master-reference" select="$master-reference"/>
210 </xsl:call-template>
211 </xsl:attribute>
212
213 <xsl:attribute name="initial-page-number">
214 <xsl:call-template name="initial.page.number">
215 <xsl:with-param name="master-reference" select="$master-reference"/>
216 </xsl:call-template>
217 </xsl:attribute>
218
219 <xsl:attribute name="force-page-count">
220 <xsl:call-template name="force.page.count">
221 <xsl:with-param name="master-reference" select="$master-reference"/>
222 </xsl:call-template>
223 </xsl:attribute>
224
225 <xsl:attribute name="hyphenation-character">
226 <xsl:call-template name="gentext">
227 <xsl:with-param name="key" select="'hyphenation-character'"/>
228 </xsl:call-template>
229 </xsl:attribute>
230 <xsl:attribute name="hyphenation-push-character-count">
231 <xsl:call-template name="gentext">
232 <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
233 </xsl:call-template>
234 </xsl:attribute>
235 <xsl:attribute name="hyphenation-remain-character-count">
236 <xsl:call-template name="gentext">
237 <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
238 </xsl:call-template>
239 </xsl:attribute>
240
241 <xsl:apply-templates select="." mode="running.head.mode">
242 <xsl:with-param name="master-reference" select="$master-reference"/>
243 </xsl:apply-templates>
244 <xsl:apply-templates select="." mode="running.foot.mode">
245 <xsl:with-param name="master-reference" select="$master-reference"/>
246 </xsl:apply-templates>
247
248 <fo:flow flow-name="xsl-region-body">
249 <xsl:call-template name="set.flow.properties">
250 <xsl:with-param name="element" select="local-name(.)"/>
251 <xsl:with-param name="master-reference" select="$master-reference"/>
252 </xsl:call-template>
253
254 <xsl:copy-of select="$refentry.content"/>
255 </fo:flow>
256 </fo:page-sequence>
257 </xsl:when>
258 <xsl:otherwise>
259 <fo:block>
260 <xsl:if test="$refentry.pagebreak != 0">
261 <xsl:attribute name="break-before">page</xsl:attribute>
262 </xsl:if>
263 <xsl:copy-of select="$refentry.content"/>
264 </fo:block>
265 </xsl:otherwise>
266 </xsl:choose>
267</xsl:template>
268
269<xsl:template match="refmeta">
270</xsl:template>
271
272<xsl:template match="manvolnum">
273 <xsl:if test="$refentry.xref.manvolnum != 0">
274 <xsl:text>(</xsl:text>
275 <xsl:apply-templates/>
276 <xsl:text>)</xsl:text>
277 </xsl:if>
278</xsl:template>
279
280<xsl:template match="refmiscinfo">
281</xsl:template>
282
283<xsl:template match="refentrytitle">
284 <xsl:call-template name="inline.charseq"/>
285</xsl:template>
286
287<xsl:template match="refnamediv">
288 <xsl:variable name="id">
289 <xsl:call-template name="object.id"/>
290 </xsl:variable>
291
292 <fo:block id="{$id}">
293
294 <!-- if refentry.generate.name is non-zero, then we need to generate a -->
295 <!-- localized "Name" subheading for this refnamdiv (unless it has a -->
296 <!-- preceding sibling that is a refnamediv, in which case we have already -->
297 <!-- generated a "Name" subheading, so we don't need to do it again -->
298 <xsl:if test="$refentry.generate.name != 0">
299 <xsl:choose>
300 <xsl:when test="preceding-sibling::refnamediv">
301 <!-- no generated title on secondary refnamedivs! -->
302 </xsl:when>
303 <xsl:otherwise>
304 <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"
305 xsl:use-attribute-sets="refnamediv.titlepage.recto.style"
306 font-family="{$title.fontset}">
307 <!-- Contents of what is now the format.refentry.subheading -->
308 <!-- template were formerly intended to be used only to -->
309 <!-- process those subsections of Refentry that have "real" -->
310 <!-- title children. So as a kludge to get around the fact -->
311 <!-- that the template still basically "expects" to be -->
312 <!-- processing that kind of a node, when we call the -->
313 <!-- template to process generated titles, we must call it -->
314 <!-- with values for the "offset" and "section" parameters -->
315 <!-- that are different from the default values in the -->
316 <!-- format.refentry.subheading template itself. Because -->
317 <!-- those defaults are the values appropriate for processing -->
318 <!-- "real" title nodes. -->
319 <xsl:call-template name="format.refentry.subheading">
320 <xsl:with-param name="section" select="self::*"/>
321 <xsl:with-param name="offset" select="1"/>
322 <xsl:with-param name="gentext.key" select="'RefName'"/>
323 </xsl:call-template>
324 </fo:block>
325 </xsl:otherwise>
326 </xsl:choose>
327 </xsl:if>
328
329 <xsl:if test="$refentry.generate.title != 0">
330 <xsl:variable name="section.level">
331 <xsl:call-template name="refentry.level">
332 <xsl:with-param name="node" select="ancestor::refentry"/>
333 </xsl:call-template>
334 </xsl:variable>
335
336 <xsl:variable name="reftitle">
337 <xsl:choose>
338 <xsl:when test="../refmeta/refentrytitle">
339 <xsl:apply-templates select="../refmeta/refentrytitle"/>
340 </xsl:when>
341 <xsl:otherwise>
342 <xsl:apply-templates select="refname[1]"/>
343 </xsl:otherwise>
344 </xsl:choose>
345 </xsl:variable>
346
347 <!-- xsl:use-attribute-sets takes only a Qname, not a variable -->
348 <xsl:choose>
349 <xsl:when test="preceding-sibling::refnamediv">
350 <!-- no title on secondary refnamedivs! -->
351 </xsl:when>
352 <xsl:when test="$section.level = 1">
353 <fo:block xsl:use-attribute-sets="refentry.title.properties">
354 <fo:block xsl:use-attribute-sets="section.title.level1.properties">
355 <xsl:value-of select="$reftitle"/>
356 </fo:block>
357 </fo:block>
358 </xsl:when>
359 <xsl:when test="$section.level = 2">
360 <fo:block xsl:use-attribute-sets="refentry.title.properties">
361 <fo:block xsl:use-attribute-sets="section.title.level2.properties">
362 <xsl:value-of select="$reftitle"/>
363 </fo:block>
364 </fo:block>
365 </xsl:when>
366 <xsl:when test="$section.level = 3">
367 <fo:block xsl:use-attribute-sets="refentry.title.properties">
368 <fo:block xsl:use-attribute-sets="section.title.level3.properties">
369 <xsl:value-of select="$reftitle"/>
370 </fo:block>
371 </fo:block>
372 </xsl:when>
373 <xsl:when test="$section.level = 4">
374 <fo:block xsl:use-attribute-sets="refentry.title.properties">
375 <fo:block xsl:use-attribute-sets="section.title.level4.properties">
376 <xsl:value-of select="$reftitle"/>
377 </fo:block>
378 </fo:block>
379 </xsl:when>
380 <xsl:when test="$section.level = 5">
381 <fo:block xsl:use-attribute-sets="refentry.title.properties">
382 <fo:block xsl:use-attribute-sets="section.title.level5.properties">
383 <xsl:value-of select="$reftitle"/>
384 </fo:block>
385 </fo:block>
386 </xsl:when>
387 <xsl:otherwise>
388 <fo:block xsl:use-attribute-sets="refentry.title.properties">
389 <fo:block xsl:use-attribute-sets="section.title.level6.properties">
390 <xsl:value-of select="$reftitle"/>
391 </fo:block>
392 </fo:block>
393 </xsl:otherwise>
394 </xsl:choose>
395 </xsl:if>
396
397 <fo:block>
398 <xsl:if test="not(following-sibling::refnamediv)">
399 <xsl:attribute name="space-after">1em</xsl:attribute>
400 </xsl:if>
401 <xsl:choose>
402 <xsl:when test="../refmeta/refentrytitle">
403 <xsl:apply-templates select="../refmeta/refentrytitle"/>
404 </xsl:when>
405 <xsl:when test="refdescriptor">
406 <xsl:apply-templates select="refdescriptor[1]"/>
407 </xsl:when>
408 <xsl:otherwise>
409 <xsl:apply-templates select="refname[1]"/>
410 </xsl:otherwise>
411 </xsl:choose>
412 <xsl:apply-templates select="refpurpose"/>
413 </fo:block>
414
415 <!-- what was this for?
416 <fo:block>
417 <xsl:choose>
418 <xsl:when test="refdescriptor">
419 <xsl:apply-templates select="refdescriptor"/>
420 </xsl:when>
421 <xsl:otherwise>
422 <xsl:for-each select="refname">
423 <xsl:apply-templates select="."/>
424 <xsl:if test="following-sibling::refname">
425 <xsl:text>, </xsl:text>
426 </xsl:if>
427 </xsl:for-each>
428 </xsl:otherwise>
429 </xsl:choose>
430 </fo:block>
431 -->
432 </fo:block>
433</xsl:template>
434
435<xsl:template match="refname">
436 <xsl:apply-templates/>
437</xsl:template>
438
439<xsl:template match="refpurpose">
440 <xsl:text> </xsl:text>
441 <xsl:call-template name="dingbat">
442 <xsl:with-param name="dingbat">em-dash</xsl:with-param>
443 </xsl:call-template>
444 <xsl:text> </xsl:text>
445 <xsl:apply-templates/>
446</xsl:template>
447
448<xsl:template match="refdescriptor">
449 <xsl:apply-templates/>
450</xsl:template>
451
452<xsl:template match="refclass">
453 <fo:block font-weight="bold">
454 <xsl:if test="@role">
455 <xsl:value-of select="@role"/>
456 <xsl:text>: </xsl:text>
457 </xsl:if>
458 <xsl:apply-templates/>
459 </fo:block>
460</xsl:template>
461
462<xsl:template match="refsynopsisdiv">
463 <xsl:variable name="id">
464 <xsl:call-template name="object.id"/>
465 </xsl:variable>
466
467 <fo:block id="{$id}">
468 <xsl:call-template name="refsynopsisdiv.titlepage"/>
469 <xsl:apply-templates/>
470 </fo:block>
471</xsl:template>
472
473<xsl:template match="refsection">
474 <xsl:variable name="id">
475 <xsl:call-template name="object.id"/>
476 </xsl:variable>
477
478 <fo:block id="{$id}">
479 <xsl:call-template name="refsection.titlepage"/>
480 <xsl:apply-templates/>
481 </fo:block>
482</xsl:template>
483
484<xsl:template match="refsect1">
485 <xsl:variable name="id">
486 <xsl:call-template name="object.id"/>
487 </xsl:variable>
488
489 <fo:block id="{$id}">
490 <xsl:call-template name="refsect1.titlepage"/>
491 <xsl:apply-templates/>
492 </fo:block>
493</xsl:template>
494
495<xsl:template match="refsect2">
496 <xsl:variable name="id">
497 <xsl:call-template name="object.id"/>
498 </xsl:variable>
499
500 <fo:block id="{$id}">
501 <xsl:call-template name="refsect2.titlepage"/>
502 <xsl:apply-templates/>
503 </fo:block>
504</xsl:template>
505
506<xsl:template match="refsect3">
507 <xsl:variable name="id">
508 <xsl:call-template name="object.id"/>
509 </xsl:variable>
510
511 <fo:block id="{$id}">
512 <xsl:call-template name="refsect3.titlepage"/>
513 <xsl:apply-templates/>
514 </fo:block>
515</xsl:template>
516
517<xsl:template match="refsynopsisdiv/title
518 |refsection/title
519 |refsect1/title
520 |refsect2/title
521 |refsect3/title">
522 <!-- nop; titlepage.mode instead -->
523</xsl:template>
524
525<xsl:template match="refsynopsisdiv/title
526 |refsection/title
527 |refsect1/title
528 |refsect2/title
529 |refsect3/title"
530 mode="titlepage.mode"
531 priority="2">
532 <xsl:call-template name="format.refentry.subheading"/>
533</xsl:template>
534
535<xsl:template name="format.refentry.subheading">
536<!-- This template is now called to process generated titles for -->
537<!-- Refnamediv and Refsynopsisdiv, as well as "real" titles for -->
538<!-- Refsynopsisdiv, Refsection, and Refsect[1-3]. -->
539<!-- -->
540<!-- But the contents of this template were formerly intended to be used -->
541<!-- only to process those subsections of Refentry that have "real" title -->
542<!-- children. So as a kludge to get around the fact that the template -->
543<!-- still basically "expects" to be processing that kind of a node, the -->
544<!-- "offset" parameter was added and the "section" variable was changed to -->
545<!-- a parameter so that when called for a generated title on a Refnamediv -->
546<!-- or Refsynopsisdiv, we can call it like this: -->
547<!-- -->
548<!-- <xsl:call-template name="format.refentry.subheading"> -->
549<!-- <xsl:with-param name="section" select="self::*"/> -->
550<!-- <xsl:with-param name="offset" select="1"/> -->
551<!-- <xsl:with-param name="gentext.key" select="'RefName'"/> -->
552<!-- </xsl:call-template> -->
553<!-- -->
554 <xsl:param name="section" select="parent::*"/>
555 <xsl:param name="offset" select="0"/>
556 <xsl:param name="gentext.key"/>
557
558 <fo:block keep-with-next.within-column="always">
559 <xsl:variable name="id">
560 <xsl:call-template name="object.id">
561 <xsl:with-param name="object" select="$section"/>
562 </xsl:call-template>
563 </xsl:variable>
564
565 <xsl:variable name="level">
566 <xsl:call-template name="section.level">
567 <xsl:with-param name="node" select="$section"/>
568 </xsl:call-template>
569 </xsl:variable>
570
571 <xsl:variable name="title">
572 <!-- If we have a non-empty value for the $gentext.key param, then we -->
573 <!-- generate an appropriate title here. Otherwise, we have a real -->
574 <!-- title child, so we copy contents of that to the result tree. -->
575 <xsl:choose>
576 <xsl:when test="$gentext.key != ''">
577 <xsl:call-template name="gentext">
578 <xsl:with-param name="key" select="$gentext.key"/>
579 </xsl:call-template>
580 </xsl:when>
581 <xsl:otherwise>
582 <xsl:apply-templates select="$section" mode="object.title.markup">
583 <xsl:with-param name="allow-anchors" select="1"/>
584 </xsl:apply-templates>
585 </xsl:otherwise>
586 </xsl:choose>
587 </xsl:variable>
588
589 <xsl:if test="$passivetex.extensions != 0">
590 <fotex:bookmark xmlns:fotex="http://www.tug.org/fotex"
591 fotex-bookmark-level="{$level + 2 + $offset}"
592 fotex-bookmark-label="{$id}">
593 <xsl:value-of select="$title"/>
594 </fotex:bookmark>
595 </xsl:if>
596
597 <xsl:if test="$axf.extensions != 0">
598 <xsl:attribute name="axf:outline-level">
599 <xsl:value-of select="count(ancestor::*)-1 + $offset"/>
600 </xsl:attribute>
601 <xsl:attribute name="axf:outline-expand">false</xsl:attribute>
602 <xsl:attribute name="axf:outline-title">
603 <xsl:value-of select="$title"/>
604 </xsl:attribute>
605 </xsl:if>
606
607 <xsl:call-template name="section.heading">
608 <xsl:with-param name="level" select="$level + $offset"/>
609 <xsl:with-param name="title" select="$title"/>
610 </xsl:call-template>
611 </fo:block>
612</xsl:template>
613
614<!-- ==================================================================== -->
615
616</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.