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: division.xsl,v 1.30 2005/12/29 19:14:15 bobstayton 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 name="division.title">
20  <xsl:param name="node" select="."/>
21  <xsl:variable name="id">
22    <xsl:call-template name="object.id">
23      <xsl:with-param name="object" select="$node"/>
24    </xsl:call-template>
25  </xsl:variable>
26  <xsl:variable name="title">
27    <xsl:apply-templates select="$node" mode="object.title.markup"/>
28  </xsl:variable>
29
30  <xsl:if test="$passivetex.extensions != 0">
31    <fotex:bookmark xmlns:fotex="http://www.tug.org/fotex"
32                    fotex-bookmark-level="1"
33                    fotex-bookmark-label="{$id}">
34      <xsl:value-of select="$title"/>
35    </fotex:bookmark>
36  </xsl:if>
37
38  <fo:block keep-with-next.within-column="always"
39            hyphenate="false">
40    <xsl:if test="$axf.extensions != 0">
41      <xsl:attribute name="axf:outline-level">
42        <xsl:choose>
43          <xsl:when test="count($node/ancestor::*) > 0">
44            <xsl:value-of select="count($node/ancestor::*)"/>
45          </xsl:when>
46          <xsl:otherwise>1</xsl:otherwise>
47        </xsl:choose>
48      </xsl:attribute>
49      <xsl:attribute name="axf:outline-expand">false</xsl:attribute>
50      <xsl:attribute name="axf:outline-title">
51        <xsl:value-of select="normalize-space($title)"/>
52      </xsl:attribute>
53    </xsl:if>
54    <xsl:copy-of select="$title"/>
55  </fo:block>
56</xsl:template>
57
58<!-- ==================================================================== -->
59
60<xsl:template match="set">
61  <xsl:variable name="id">
62    <xsl:call-template name="object.id"/>
63  </xsl:variable>
64
65  <xsl:variable name="preamble"
66                select="*[not(self::book or self::setindex)]"/>
67
68  <xsl:variable name="content" select="book|setindex"/>
69
70  <xsl:variable name="titlepage-master-reference">
71    <xsl:call-template name="select.pagemaster">
72      <xsl:with-param name="pageclass" select="'titlepage'"/>
73    </xsl:call-template>
74  </xsl:variable>
75
76  <xsl:variable name="lot-master-reference">
77    <xsl:call-template name="select.pagemaster">
78      <xsl:with-param name="pageclass" select="'lot'"/>
79    </xsl:call-template>
80  </xsl:variable>
81
82  <xsl:if test="$preamble">
83    <fo:page-sequence hyphenate="{$hyphenate}"
84                      master-reference="{$titlepage-master-reference}">
85      <xsl:attribute name="language">
86        <xsl:call-template name="l10n.language"/>
87      </xsl:attribute>
88      <xsl:attribute name="format">
89        <xsl:call-template name="page.number.format">
90          <xsl:with-param name="master-reference" 
91                          select="$titlepage-master-reference"/>
92        </xsl:call-template>
93      </xsl:attribute>
94
95      <xsl:attribute name="initial-page-number">
96        <xsl:call-template name="initial.page.number">
97          <xsl:with-param name="master-reference" 
98                          select="$titlepage-master-reference"/>
99        </xsl:call-template>
100      </xsl:attribute>
101
102      <xsl:attribute name="force-page-count">
103        <xsl:call-template name="force.page.count">
104          <xsl:with-param name="master-reference" 
105                          select="$titlepage-master-reference"/>
106        </xsl:call-template>
107      </xsl:attribute>
108
109      <xsl:attribute name="hyphenation-character">
110        <xsl:call-template name="gentext">
111          <xsl:with-param name="key" select="'hyphenation-character'"/>
112        </xsl:call-template>
113      </xsl:attribute>
114      <xsl:attribute name="hyphenation-push-character-count">
115        <xsl:call-template name="gentext">
116          <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
117        </xsl:call-template>
118      </xsl:attribute>
119      <xsl:attribute name="hyphenation-remain-character-count">
120        <xsl:call-template name="gentext">
121          <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
122        </xsl:call-template>
123      </xsl:attribute>
124
125      <xsl:apply-templates select="." mode="running.head.mode">
126        <xsl:with-param name="master-reference" select="$titlepage-master-reference"/>
127      </xsl:apply-templates>
128
129      <xsl:apply-templates select="." mode="running.foot.mode">
130        <xsl:with-param name="master-reference" select="$titlepage-master-reference"/>
131      </xsl:apply-templates>
132
133      <fo:flow flow-name="xsl-region-body">
134        <xsl:call-template name="set.flow.properties">
135          <xsl:with-param name="element" select="local-name(.)"/>
136          <xsl:with-param name="master-reference" 
137                          select="$titlepage-master-reference"/>
138        </xsl:call-template>
139
140        <fo:block id="{$id}">
141          <xsl:call-template name="set.titlepage"/>
142        </fo:block>
143      </fo:flow>
144    </fo:page-sequence>
145  </xsl:if>
146
147  <xsl:variable name="toc.params">
148    <xsl:call-template name="find.path.params">
149      <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
150    </xsl:call-template>
151  </xsl:variable>
152
153  <xsl:if test="contains($toc.params, 'toc')">
154    <fo:page-sequence hyphenate="{$hyphenate}"
155                      master-reference="{$lot-master-reference}">
156      <xsl:attribute name="language">
157        <xsl:call-template name="l10n.language"/>
158      </xsl:attribute>
159      <xsl:attribute name="format">
160        <xsl:call-template name="page.number.format">
161          <xsl:with-param name="element" select="'toc'"/>
162          <xsl:with-param name="master-reference"
163                          select="$lot-master-reference"/>
164        </xsl:call-template>
165      </xsl:attribute>
166      <xsl:attribute name="initial-page-number">
167        <xsl:call-template name="initial.page.number">
168          <xsl:with-param name="master-reference"
169                          select="$lot-master-reference"/>
170        </xsl:call-template>
171      </xsl:attribute>
172      <xsl:attribute name="force-page-count">
173        <xsl:call-template name="force.page.count">
174          <xsl:with-param name="master-reference"
175                          select="$lot-master-reference"/>
176        </xsl:call-template>
177      </xsl:attribute>
178
179      <xsl:attribute name="hyphenation-character">
180        <xsl:call-template name="gentext">
181          <xsl:with-param name="key" select="'hyphenation-character'"/>
182        </xsl:call-template>
183      </xsl:attribute>
184      <xsl:attribute name="hyphenation-push-character-count">
185        <xsl:call-template name="gentext">
186          <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
187        </xsl:call-template>
188      </xsl:attribute>
189      <xsl:attribute name="hyphenation-remain-character-count">
190        <xsl:call-template name="gentext">
191          <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
192        </xsl:call-template>
193      </xsl:attribute>
194
195      <xsl:apply-templates select="." mode="running.head.mode">
196        <xsl:with-param name="master-reference" select="$lot-master-reference"/>
197      </xsl:apply-templates>
198
199      <xsl:apply-templates select="." mode="running.foot.mode">
200        <xsl:with-param name="master-reference" select="$lot-master-reference"/>
201      </xsl:apply-templates>
202
203      <fo:flow flow-name="xsl-region-body">
204        <xsl:call-template name="set.flow.properties">
205          <xsl:with-param name="element" select="local-name(.)"/>
206          <xsl:with-param name="master-reference" 
207                          select="$lot-master-reference"/>
208        </xsl:call-template>
209
210        <xsl:call-template name="set.toc"/>
211      </fo:flow>
212    </fo:page-sequence>
213  </xsl:if>
214
215  <xsl:apply-templates select="$content"/>
216</xsl:template>
217
218<xsl:template match="set/setinfo"></xsl:template>
219<xsl:template match="set/title"></xsl:template>
220<xsl:template match="set/subtitle"></xsl:template>
221
222<!-- ==================================================================== -->
223
224<xsl:template match="book">
225  <xsl:variable name="id">
226    <xsl:call-template name="object.id"/>
227  </xsl:variable>
228
229  <xsl:variable name="preamble"
230                select="title|subtitle|titleabbrev|bookinfo"/>
231
232  <xsl:variable name="content"
233                select="node()[not(self::title or self::subtitle
234                            or self::titleabbrev
235                            or self::bookinfo)]"/>
236
237  <xsl:variable name="titlepage-master-reference">
238    <xsl:call-template name="select.pagemaster">
239      <xsl:with-param name="pageclass" select="'titlepage'"/>
240    </xsl:call-template>
241  </xsl:variable>
242
243  <xsl:variable name="lot-master-reference">
244    <xsl:call-template name="select.pagemaster">
245      <xsl:with-param name="pageclass" select="'lot'"/>
246    </xsl:call-template>
247  </xsl:variable>
248
249  <xsl:if test="$preamble">
250    <fo:page-sequence hyphenate="{$hyphenate}"
251                      master-reference="{$titlepage-master-reference}">
252      <xsl:attribute name="language">
253        <xsl:call-template name="l10n.language"/>
254      </xsl:attribute>
255      <xsl:attribute name="format">
256        <xsl:call-template name="page.number.format">
257          <xsl:with-param name="master-reference"
258                          select="$titlepage-master-reference"/>
259        </xsl:call-template>
260      </xsl:attribute>
261      <xsl:attribute name="initial-page-number">
262        <xsl:call-template name="initial.page.number">
263          <xsl:with-param name="master-reference" 
264	                  select="$titlepage-master-reference"/>
265        </xsl:call-template>
266      </xsl:attribute>
267      <xsl:attribute name="force-page-count">
268        <xsl:call-template name="force.page.count">
269          <xsl:with-param name="master-reference" 
270	                  select="$titlepage-master-reference"/>
271        </xsl:call-template>
272      </xsl:attribute>
273
274      <xsl:attribute name="hyphenation-character">
275        <xsl:call-template name="gentext">
276          <xsl:with-param name="key" select="'hyphenation-character'"/>
277        </xsl:call-template>
278      </xsl:attribute>
279      <xsl:attribute name="hyphenation-push-character-count">
280        <xsl:call-template name="gentext">
281          <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
282        </xsl:call-template>
283      </xsl:attribute>
284      <xsl:attribute name="hyphenation-remain-character-count">
285        <xsl:call-template name="gentext">
286          <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
287        </xsl:call-template>
288      </xsl:attribute>
289
290      <xsl:apply-templates select="." mode="running.head.mode">
291        <xsl:with-param name="master-reference" select="$titlepage-master-reference"/>
292      </xsl:apply-templates>
293
294      <xsl:apply-templates select="." mode="running.foot.mode">
295        <xsl:with-param name="master-reference" select="$titlepage-master-reference"/>
296      </xsl:apply-templates>
297
298      <fo:flow flow-name="xsl-region-body">
299        <xsl:call-template name="set.flow.properties">
300          <xsl:with-param name="element" select="local-name(.)"/>
301          <xsl:with-param name="master-reference" 
302                          select="$titlepage-master-reference"/>
303        </xsl:call-template>
304
305        <fo:block id="{$id}">
306          <xsl:call-template name="book.titlepage"/>
307        </fo:block>
308      </fo:flow>
309    </fo:page-sequence>
310  </xsl:if>
311
312  <xsl:apply-templates select="dedication" mode="dedication"/>
313
314  <xsl:variable name="toc.params">
315    <xsl:call-template name="find.path.params">
316      <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
317    </xsl:call-template>
318  </xsl:variable>
319
320  <xsl:if test="contains($toc.params, 'toc')">
321    <fo:page-sequence hyphenate="{$hyphenate}"
322                      master-reference="{$lot-master-reference}">
323      <xsl:attribute name="language">
324        <xsl:call-template name="l10n.language"/>
325      </xsl:attribute>
326      <xsl:attribute name="format">
327        <xsl:call-template name="page.number.format">
328          <xsl:with-param name="element" select="'toc'"/>
329          <xsl:with-param name="master-reference" 
330                          select="$lot-master-reference"/>
331        </xsl:call-template>
332      </xsl:attribute>
333      <xsl:attribute name="initial-page-number">
334        <xsl:call-template name="initial.page.number">
335        <xsl:with-param name="element" select="'toc'"/>
336        <xsl:with-param name="master-reference" 
337                        select="$lot-master-reference"/>
338         </xsl:call-template>
339      </xsl:attribute>
340      <xsl:attribute name="force-page-count">
341        <xsl:call-template name="force.page.count">
342          <xsl:with-param name="master-reference" 
343	                  select="$lot-master-reference"/>
344        </xsl:call-template>
345      </xsl:attribute>
346
347      <xsl:attribute name="hyphenation-character">
348        <xsl:call-template name="gentext">
349          <xsl:with-param name="key" select="'hyphenation-character'"/>
350        </xsl:call-template>
351      </xsl:attribute>
352      <xsl:attribute name="hyphenation-push-character-count">
353        <xsl:call-template name="gentext">
354          <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
355        </xsl:call-template>
356      </xsl:attribute>
357      <xsl:attribute name="hyphenation-remain-character-count">
358        <xsl:call-template name="gentext">
359          <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
360        </xsl:call-template>
361      </xsl:attribute>
362
363      <xsl:apply-templates select="." mode="running.head.mode">
364        <xsl:with-param name="master-reference" select="$lot-master-reference"/>
365        <xsl:with-param name="gentext-key" select="'TableofContents'"/>
366      </xsl:apply-templates>
367
368      <xsl:apply-templates select="." mode="running.foot.mode">
369        <xsl:with-param name="master-reference" select="$lot-master-reference"/>
370        <xsl:with-param name="gentext-key" select="'TableofContents'"/>
371      </xsl:apply-templates>
372
373      <fo:flow flow-name="xsl-region-body">
374        <xsl:call-template name="set.flow.properties">
375          <xsl:with-param name="element" select="local-name(.)"/>
376          <xsl:with-param name="master-reference" 
377                          select="$lot-master-reference"/>
378        </xsl:call-template>
379
380        <xsl:call-template name="division.toc">
381          <xsl:with-param name="toc.title.p" 
382                          select="contains($toc.params, 'title')"/>
383        </xsl:call-template>
384      </fo:flow>
385    </fo:page-sequence>
386  </xsl:if>
387
388  <xsl:if test="contains($toc.params,'figure') and .//figure">
389    <fo:page-sequence hyphenate="{$hyphenate}"
390                      master-reference="{$lot-master-reference}">
391      <xsl:attribute name="language">
392        <xsl:call-template name="l10n.language"/>
393      </xsl:attribute>
394      <xsl:attribute name="format">
395        <xsl:call-template name="page.number.format">
396          <xsl:with-param name="element" select="'toc'"/>
397          <xsl:with-param name="master-reference" 
398                          select="$lot-master-reference"/>
399        </xsl:call-template>
400      </xsl:attribute>
401      <xsl:attribute name="initial-page-number">
402        <xsl:call-template name="initial.page.number">
403          <xsl:with-param name="element" select="'toc'"/>
404          <xsl:with-param name="master-reference" 
405                          select="$lot-master-reference"/>
406        </xsl:call-template>
407      </xsl:attribute>
408      <xsl:attribute name="force-page-count">
409        <xsl:call-template name="force.page.count">
410          <xsl:with-param name="master-reference" 
411                          select="$lot-master-reference"/>
412        </xsl:call-template>
413      </xsl:attribute>
414
415      <xsl:attribute name="hyphenation-character">
416        <xsl:call-template name="gentext">
417          <xsl:with-param name="key" select="'hyphenation-character'"/>
418        </xsl:call-template>
419      </xsl:attribute>
420      <xsl:attribute name="hyphenation-push-character-count">
421        <xsl:call-template name="gentext">
422          <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
423        </xsl:call-template>
424      </xsl:attribute>
425      <xsl:attribute name="hyphenation-remain-character-count">
426        <xsl:call-template name="gentext">
427          <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
428        </xsl:call-template>
429      </xsl:attribute>
430
431      <xsl:apply-templates select="." mode="running.head.mode">
432        <xsl:with-param name="master-reference" select="$lot-master-reference"/>
433        <xsl:with-param name="gentext-key" select="'ListofFigures'"/>
434      </xsl:apply-templates>
435
436      <xsl:apply-templates select="." mode="running.foot.mode">
437        <xsl:with-param name="master-reference" select="$lot-master-reference"/>
438        <xsl:with-param name="gentext-key" select="'ListofFigures'"/>
439      </xsl:apply-templates>
440
441      <fo:flow flow-name="xsl-region-body">
442        <xsl:call-template name="set.flow.properties">
443          <xsl:with-param name="element" select="local-name(.)"/>
444          <xsl:with-param name="master-reference" 
445                          select="$lot-master-reference"/>
446        </xsl:call-template>
447
448        <xsl:call-template name="list.of.titles">
449          <xsl:with-param name="titles" select="'figure'"/>
450          <xsl:with-param name="nodes" select=".//figure"/>
451        </xsl:call-template>
452      </fo:flow>
453    </fo:page-sequence>
454  </xsl:if>
455
456  <xsl:if test="contains($toc.params,'table') and .//table">
457    <fo:page-sequence hyphenate="{$hyphenate}"
458                      master-reference="{$lot-master-reference}">
459      <xsl:attribute name="language">
460        <xsl:call-template name="l10n.language"/>
461      </xsl:attribute>
462      <xsl:attribute name="format">
463        <xsl:call-template name="page.number.format">
464          <xsl:with-param name="element" select="'toc'"/>
465          <xsl:with-param name="master-reference" 
466                          select="$lot-master-reference"/>
467        </xsl:call-template>
468      </xsl:attribute>
469      <xsl:attribute name="initial-page-number">
470        <xsl:call-template name="initial.page.number">
471        <xsl:with-param name="element" select="'toc'"/>
472        <xsl:with-param name="master-reference" 
473                        select="$lot-master-reference"/>
474         </xsl:call-template>
475      </xsl:attribute>
476      <xsl:attribute name="force-page-count">
477        <xsl:call-template name="force.page.count">
478          <xsl:with-param name="master-reference" 
479	                  select="$lot-master-reference"/>
480        </xsl:call-template>
481      </xsl:attribute>
482
483      <xsl:attribute name="hyphenation-character">
484        <xsl:call-template name="gentext">
485          <xsl:with-param name="key" select="'hyphenation-character'"/>
486        </xsl:call-template>
487      </xsl:attribute>
488      <xsl:attribute name="hyphenation-push-character-count">
489        <xsl:call-template name="gentext">
490          <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
491        </xsl:call-template>
492      </xsl:attribute>
493      <xsl:attribute name="hyphenation-remain-character-count">
494        <xsl:call-template name="gentext">
495          <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
496        </xsl:call-template>
497      </xsl:attribute>
498
499      <xsl:apply-templates select="." mode="running.head.mode">
500        <xsl:with-param name="master-reference" select="$lot-master-reference"/>
501        <xsl:with-param name="gentext-key" select="'ListofTables'"/>
502      </xsl:apply-templates>
503
504      <xsl:apply-templates select="." mode="running.foot.mode">
505        <xsl:with-param name="master-reference" select="$lot-master-reference"/>
506        <xsl:with-param name="gentext-key" select="'ListofTables'"/>
507      </xsl:apply-templates>
508
509      <fo:flow flow-name="xsl-region-body">
510        <xsl:call-template name="set.flow.properties">
511          <xsl:with-param name="element" select="local-name(.)"/>
512          <xsl:with-param name="master-reference" 
513                          select="$lot-master-reference"/>
514        </xsl:call-template>
515
516        <xsl:call-template name="list.of.titles">
517          <xsl:with-param name="titles" select="'table'"/>
518          <xsl:with-param name="nodes" select=".//table"/>
519        </xsl:call-template>
520      </fo:flow>
521    </fo:page-sequence>
522  </xsl:if>
523
524  <xsl:if test="contains($toc.params,'example') and .//example">
525    <fo:page-sequence hyphenate="{$hyphenate}"
526                      master-reference="{$lot-master-reference}">
527      <xsl:attribute name="language">
528        <xsl:call-template name="l10n.language"/>
529      </xsl:attribute>
530      <xsl:attribute name="format">
531        <xsl:call-template name="page.number.format">
532          <xsl:with-param name="element" select="'toc'"/>
533          <xsl:with-param name="master-reference" 
534                          select="$lot-master-reference"/>
535        </xsl:call-template>
536      </xsl:attribute>
537      <xsl:attribute name="initial-page-number">
538        <xsl:call-template name="initial.page.number">
539        <xsl:with-param name="element" select="'toc'"/>
540        <xsl:with-param name="master-reference" 
541                        select="$lot-master-reference"/>
542         </xsl:call-template>
543      </xsl:attribute>
544      <xsl:attribute name="force-page-count">
545        <xsl:call-template name="force.page.count">
546          <xsl:with-param name="master-reference" 
547	                  select="$lot-master-reference"/>
548        </xsl:call-template>
549      </xsl:attribute>
550
551      <xsl:attribute name="hyphenation-character">
552        <xsl:call-template name="gentext">
553          <xsl:with-param name="key" select="'hyphenation-character'"/>
554        </xsl:call-template>
555      </xsl:attribute>
556      <xsl:attribute name="hyphenation-push-character-count">
557        <xsl:call-template name="gentext">
558          <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
559        </xsl:call-template>
560      </xsl:attribute>
561      <xsl:attribute name="hyphenation-remain-character-count">
562        <xsl:call-template name="gentext">
563          <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
564        </xsl:call-template>
565      </xsl:attribute>
566
567      <xsl:apply-templates select="." mode="running.head.mode">
568        <xsl:with-param name="master-reference" select="$lot-master-reference"/>
569        <xsl:with-param name="gentext-key" select="'ListofExamples'"/>
570      </xsl:apply-templates>
571
572      <xsl:apply-templates select="." mode="running.foot.mode">
573        <xsl:with-param name="master-reference" select="$lot-master-reference"/>
574        <xsl:with-param name="gentext-key" select="'ListofExamples'"/>
575      </xsl:apply-templates>
576
577      <fo:flow flow-name="xsl-region-body">
578        <xsl:call-template name="set.flow.properties">
579          <xsl:with-param name="element" select="local-name(.)"/>
580          <xsl:with-param name="master-reference" 
581                          select="$lot-master-reference"/>
582        </xsl:call-template>
583
584        <xsl:call-template name="list.of.titles">
585          <xsl:with-param name="titles" select="'example'"/>
586          <xsl:with-param name="nodes" select=".//example"/>
587        </xsl:call-template>
588      </fo:flow>
589    </fo:page-sequence>
590  </xsl:if>
591
592  <xsl:if test="contains($toc.params,'equation') and .//equation">
593    <fo:page-sequence hyphenate="{$hyphenate}"
594                      master-reference="{$lot-master-reference}">
595      <xsl:attribute name="language">
596        <xsl:call-template name="l10n.language"/>
597      </xsl:attribute>
598      <xsl:attribute name="format">
599        <xsl:call-template name="page.number.format">
600          <xsl:with-param name="element" select="'toc'"/>
601          <xsl:with-param name="master-reference" 
602                          select="$lot-master-reference"/>
603        </xsl:call-template>
604      </xsl:attribute>
605      <xsl:attribute name="initial-page-number">
606        <xsl:call-template name="initial.page.number">
607        <xsl:with-param name="element" select="'toc'"/>
608        <xsl:with-param name="master-reference" 
609                        select="$lot-master-reference"/>
610         </xsl:call-template>
611      </xsl:attribute>
612
613      <xsl:attribute name="force-page-count">
614        <xsl:call-template name="force.page.count">
615          <xsl:with-param name="master-reference" 
616	                  select="$lot-master-reference"/>
617        </xsl:call-template>
618      </xsl:attribute>
619
620      <xsl:attribute name="hyphenation-character">
621        <xsl:call-template name="gentext">
622          <xsl:with-param name="key" select="'hyphenation-character'"/>
623        </xsl:call-template>
624      </xsl:attribute>
625      <xsl:attribute name="hyphenation-push-character-count">
626        <xsl:call-template name="gentext">
627          <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
628        </xsl:call-template>
629      </xsl:attribute>
630      <xsl:attribute name="hyphenation-remain-character-count">
631        <xsl:call-template name="gentext">
632          <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
633        </xsl:call-template>
634      </xsl:attribute>
635
636      <xsl:apply-templates select="." mode="running.head.mode">
637        <xsl:with-param name="master-reference" select="$lot-master-reference"/>
638        <xsl:with-param name="gentext-key" select="'ListofEquations'"/>
639      </xsl:apply-templates>
640
641      <xsl:apply-templates select="." mode="running.foot.mode">
642        <xsl:with-param name="master-reference" select="$lot-master-reference"/>
643        <xsl:with-param name="gentext-key" select="'ListofEquations'"/>
644      </xsl:apply-templates>
645
646      <fo:flow flow-name="xsl-region-body">
647        <xsl:call-template name="set.flow.properties">
648          <xsl:with-param name="element" select="local-name(.)"/>
649          <xsl:with-param name="master-reference" 
650                          select="$lot-master-reference"/>
651        </xsl:call-template>
652
653        <xsl:call-template name="list.of.titles">
654          <xsl:with-param name="titles" select="'equation'"/>
655          <xsl:with-param name="nodes" select=".//equation[title]"/>
656        </xsl:call-template>
657      </fo:flow>
658    </fo:page-sequence>
659  </xsl:if>
660
661  <xsl:if test="contains($toc.params,'procedure') and .//procedure">
662    <fo:page-sequence hyphenate="{$hyphenate}"
663                      master-reference="{$lot-master-reference}">
664      <xsl:attribute name="language">
665        <xsl:call-template name="l10n.language"/>
666      </xsl:attribute>
667      <xsl:attribute name="format">
668        <xsl:call-template name="page.number.format">
669          <xsl:with-param name="element" select="'toc'"/>
670          <xsl:with-param name="master-reference" 
671                          select="$lot-master-reference"/>
672        </xsl:call-template>
673      </xsl:attribute>
674      <xsl:attribute name="initial-page-number">
675        <xsl:call-template name="initial.page.number">
676        <xsl:with-param name="element" select="'toc'"/>
677        <xsl:with-param name="master-reference" 
678                        select="$lot-master-reference"/>
679         </xsl:call-template>
680      </xsl:attribute>
681      <xsl:attribute name="force-page-count">
682        <xsl:call-template name="force.page.count">
683          <xsl:with-param name="master-reference" 
684	                  select="$lot-master-reference"/>
685        </xsl:call-template>
686      </xsl:attribute>
687
688      <xsl:attribute name="hyphenation-character">
689        <xsl:call-template name="gentext">
690          <xsl:with-param name="key" select="'hyphenation-character'"/>
691        </xsl:call-template>
692      </xsl:attribute>
693      <xsl:attribute name="hyphenation-push-character-count">
694        <xsl:call-template name="gentext">
695          <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
696        </xsl:call-template>
697      </xsl:attribute>
698      <xsl:attribute name="hyphenation-remain-character-count">
699        <xsl:call-template name="gentext">
700          <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
701        </xsl:call-template>
702      </xsl:attribute>
703
704      <xsl:apply-templates select="." mode="running.head.mode">
705        <xsl:with-param name="master-reference" select="$lot-master-reference"/>
706        <xsl:with-param name="gentext-key" select="'ListofProcedures'"/>
707      </xsl:apply-templates>
708
709      <xsl:apply-templates select="." mode="running.foot.mode">
710        <xsl:with-param name="master-reference" select="$lot-master-reference"/>
711        <xsl:with-param name="gentext-key" select="'ListofProcedures'"/>
712      </xsl:apply-templates>
713
714      <fo:flow flow-name="xsl-region-body">
715        <xsl:call-template name="set.flow.properties">
716          <xsl:with-param name="element" select="local-name(.)"/>
717          <xsl:with-param name="master-reference" 
718                          select="$lot-master-reference"/>
719        </xsl:call-template>
720
721        <xsl:call-template name="list.of.titles">
722          <xsl:with-param name="titles" select="'procedure'"/>
723          <xsl:with-param name="nodes" select=".//procedure[title]"/>
724        </xsl:call-template>
725      </fo:flow>
726    </fo:page-sequence>
727  </xsl:if>
728
729  <xsl:apply-templates select="$content"/>
730</xsl:template>
731
732<xsl:template match="book/bookinfo"></xsl:template>
733<xsl:template match="book/title"></xsl:template>
734<xsl:template match="book/subtitle"></xsl:template>
735
736<!-- ==================================================================== -->
737
738<xsl:template match="part">
739  <xsl:if test="not(partintro)">
740    <xsl:apply-templates select="." mode="part.titlepage.mode"/>
741    <xsl:call-template name="generate.part.toc"/>
742  </xsl:if>
743  <xsl:apply-templates/>
744</xsl:template>
745
746<xsl:template match="part" mode="part.titlepage.mode">
747  <!-- done this way to force the context node to be the part -->
748  <xsl:param name="additional.content"/>
749
750  <xsl:variable name="id">
751    <xsl:call-template name="object.id"/>
752  </xsl:variable>
753
754  <xsl:variable name="titlepage-master-reference">
755    <xsl:call-template name="select.pagemaster">
756      <xsl:with-param name="pageclass" select="'titlepage'"/>
757    </xsl:call-template>
758  </xsl:variable>
759
760  <fo:page-sequence hyphenate="{$hyphenate}"
761                    master-reference="{$titlepage-master-reference}">
762    <xsl:attribute name="language">
763      <xsl:call-template name="l10n.language"/>
764    </xsl:attribute>
765    <xsl:attribute name="format">
766      <xsl:call-template name="page.number.format">
767        <xsl:with-param name="master-reference" 
768                        select="$titlepage-master-reference"/>
769      </xsl:call-template>
770    </xsl:attribute>
771
772    <xsl:attribute name="initial-page-number">
773      <xsl:call-template name="initial.page.number">
774        <xsl:with-param name="master-reference" 
775                        select="$titlepage-master-reference"/>
776      </xsl:call-template>
777    </xsl:attribute>
778
779    <xsl:attribute name="force-page-count">
780      <xsl:call-template name="force.page.count">
781        <xsl:with-param name="master-reference" 
782                        select="$titlepage-master-reference"/>
783      </xsl:call-template>
784    </xsl:attribute>
785
786    <xsl:attribute name="hyphenation-character">
787      <xsl:call-template name="gentext">
788        <xsl:with-param name="key" select="'hyphenation-character'"/>
789      </xsl:call-template>
790    </xsl:attribute>
791    <xsl:attribute name="hyphenation-push-character-count">
792      <xsl:call-template name="gentext">
793        <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
794      </xsl:call-template>
795    </xsl:attribute>
796    <xsl:attribute name="hyphenation-remain-character-count">
797      <xsl:call-template name="gentext">
798        <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
799      </xsl:call-template>
800    </xsl:attribute>
801
802    <xsl:apply-templates select="." mode="running.head.mode">
803      <xsl:with-param name="master-reference" select="$titlepage-master-reference"/>
804    </xsl:apply-templates>
805
806    <xsl:apply-templates select="." mode="running.foot.mode">
807      <xsl:with-param name="master-reference" select="$titlepage-master-reference"/>
808    </xsl:apply-templates>
809
810    <fo:flow flow-name="xsl-region-body">
811      <xsl:call-template name="set.flow.properties">
812        <xsl:with-param name="element" select="local-name(.)"/>
813        <xsl:with-param name="master-reference" 
814                        select="$titlepage-master-reference"/>
815      </xsl:call-template>
816
817      <fo:block id="{$id}">
818        <xsl:call-template name="part.titlepage"/>
819      </fo:block>
820      <xsl:copy-of select="$additional.content"/>
821    </fo:flow>
822  </fo:page-sequence>
823</xsl:template>
824
825<xsl:template match="part/docinfo|partinfo"></xsl:template>
826<xsl:template match="part/title"></xsl:template>
827<xsl:template match="part/subtitle"></xsl:template>
828
829<!-- ==================================================================== -->
830
831<xsl:template name="generate.part.toc">
832  <xsl:param name="part" select="."/>
833
834  <xsl:variable name="lot-master-reference">
835    <xsl:call-template name="select.pagemaster">
836      <xsl:with-param name="pageclass" select="'lot'"/>
837    </xsl:call-template>
838  </xsl:variable>
839
840  <xsl:variable name="toc.params">
841    <xsl:call-template name="find.path.params">
842      <xsl:with-param name="node" select="$part"/>
843      <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
844    </xsl:call-template>
845  </xsl:variable>
846
847  <xsl:variable name="nodes" select="reference|
848                                     preface|
849                                     chapter|
850                                     appendix|
851                                     article|
852                                     bibliography|
853                                     glossary|
854                                     index"/>
855
856  <xsl:if test="count($nodes) &gt; 0 and contains($toc.params, 'toc')">
857    <fo:page-sequence hyphenate="{$hyphenate}"
858                      master-reference="{$lot-master-reference}">
859      <xsl:attribute name="language">
860        <xsl:call-template name="l10n.language"/>
861      </xsl:attribute>
862      <xsl:attribute name="format">
863        <xsl:call-template name="page.number.format">
864          <xsl:with-param name="element" select="'toc'"/>
865          <xsl:with-param name="master-reference" 
866                          select="$lot-master-reference"/>
867        </xsl:call-template>
868      </xsl:attribute>
869      <xsl:attribute name="initial-page-number">
870        <xsl:call-template name="initial.page.number">
871          <xsl:with-param name="element" select="'toc'"/>
872          <xsl:with-param name="master-reference" 
873                          select="$lot-master-reference"/>
874         </xsl:call-template>
875      </xsl:attribute>
876      <xsl:attribute name="force-page-count">
877        <xsl:call-template name="force.page.count">
878          <xsl:with-param name="master-reference" 
879                          select="$lot-master-reference"/>
880        </xsl:call-template>
881      </xsl:attribute>
882
883      <xsl:attribute name="hyphenation-character">
884        <xsl:call-template name="gentext">
885          <xsl:with-param name="key" select="'hyphenation-character'"/>
886        </xsl:call-template>
887      </xsl:attribute>
888      <xsl:attribute name="hyphenation-push-character-count">
889        <xsl:call-template name="gentext">
890          <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
891        </xsl:call-template>
892      </xsl:attribute>
893      <xsl:attribute name="hyphenation-remain-character-count">
894        <xsl:call-template name="gentext">
895          <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
896        </xsl:call-template>
897      </xsl:attribute>
898
899      <xsl:apply-templates select="$part" mode="running.head.mode">
900        <xsl:with-param name="master-reference" select="$lot-master-reference"/>
901      </xsl:apply-templates>
902
903      <xsl:apply-templates select="$part" mode="running.foot.mode">
904        <xsl:with-param name="master-reference" select="$lot-master-reference"/>
905      </xsl:apply-templates>
906
907      <fo:flow flow-name="xsl-region-body">
908        <xsl:call-template name="set.flow.properties">
909          <xsl:with-param name="element" select="local-name(.)"/>
910          <xsl:with-param name="master-reference" 
911                          select="$lot-master-reference"/>
912        </xsl:call-template>
913
914        <xsl:call-template name="division.toc">
915          <xsl:with-param name="toc-context" select="$part"/>
916          <xsl:with-param name="toc.title.p" 
917                          select="contains($toc.params, 'title')"/>
918        </xsl:call-template>
919
920      </fo:flow>
921    </fo:page-sequence>
922  </xsl:if>
923</xsl:template>
924
925<!-- ==================================================================== -->
926
927<xsl:template match="part/partintro">
928  <xsl:apply-templates select=".." mode="part.titlepage.mode">
929    <xsl:with-param name="additional.content">
930      <xsl:if test="title">
931        <xsl:call-template name="partintro.titlepage"/>
932      </xsl:if>
933      <xsl:apply-templates/>
934    </xsl:with-param>
935  </xsl:apply-templates>
936
937  <xsl:call-template name="generate.part.toc">
938    <xsl:with-param name="part" select=".."/>
939  </xsl:call-template>
940</xsl:template>
941
942<xsl:template match="partintro/title"></xsl:template>
943<xsl:template match="partintro/subtitle"></xsl:template>
944<xsl:template match="partintro/titleabbrev"></xsl:template>
945
946<!-- ==================================================================== -->
947
948<xsl:template match="book" mode="division.number">
949  <xsl:number from="set" count="book" format="1."/>
950</xsl:template>
951
952<xsl:template match="part" mode="division.number">
953  <xsl:number from="book" count="part" format="I."/>
954</xsl:template>
955
956</xsl:stylesheet>
957
958