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: autotoc.xsl,v 1.30 2006/05/08 07:31:10 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="set.toc"> 20 <xsl:param name="toc-context" select="."/> 21 22 <xsl:variable name="id"> 23 <xsl:call-template name="object.id"/> 24 </xsl:variable> 25 26 <xsl:variable name="cid"> 27 <xsl:call-template name="object.id"> 28 <xsl:with-param name="object" select="$toc-context"/> 29 </xsl:call-template> 30 </xsl:variable> 31 32 <xsl:variable name="nodes" select="book|setindex"/> 33 34 <xsl:if test="$nodes"> 35 <fo:block id="toc...{$id}" 36 xsl:use-attribute-sets="toc.margin.properties"> 37 <xsl:if test="$axf.extensions != 0"> 38 <xsl:attribute name="axf:outline-level">1</xsl:attribute> 39 <xsl:attribute name="axf:outline-expand">false</xsl:attribute> 40 <xsl:attribute name="axf:outline-title"> 41 <xsl:call-template name="gentext"> 42 <xsl:with-param name="key" select="'TableofContents'"/> 43 </xsl:call-template> 44 </xsl:attribute> 45 </xsl:if> 46 <xsl:call-template name="table.of.contents.titlepage"/> 47 <xsl:apply-templates select="$nodes" mode="toc"> 48 <xsl:with-param name="toc-context" select="$toc-context"/> 49 </xsl:apply-templates> 50 </fo:block> 51 </xsl:if> 52</xsl:template> 53 54<xsl:template name="division.toc"> 55 <xsl:param name="toc-context" select="."/> 56 <xsl:param name="toc.title.p" select="true()"/> 57 58 <xsl:variable name="cid"> 59 <xsl:call-template name="object.id"> 60 <xsl:with-param name="object" select="$toc-context"/> 61 </xsl:call-template> 62 </xsl:variable> 63 64 <xsl:variable name="nodes" 65 select="$toc-context/part 66 |$toc-context/reference 67 |$toc-context/preface 68 |$toc-context/chapter 69 |$toc-context/appendix 70 |$toc-context/article 71 |$toc-context/bibliography 72 |$toc-context/glossary 73 |$toc-context/index"/> 74 75 <xsl:if test="$nodes"> 76 <fo:block id="toc...{$cid}" 77 xsl:use-attribute-sets="toc.margin.properties"> 78 <xsl:if test="$axf.extensions != 0"> 79 <xsl:attribute name="axf:outline-level">1</xsl:attribute> 80 <xsl:attribute name="axf:outline-expand">false</xsl:attribute> 81 <xsl:attribute name="axf:outline-title"> 82 <xsl:call-template name="gentext"> 83 <xsl:with-param name="key" select="'TableofContents'"/> 84 </xsl:call-template> 85 </xsl:attribute> 86 </xsl:if> 87 <xsl:if test="$toc.title.p"> 88 <xsl:call-template name="table.of.contents.titlepage"/> 89 </xsl:if> 90 <xsl:apply-templates select="$nodes" mode="toc"> 91 <xsl:with-param name="toc-context" select="$toc-context"/> 92 </xsl:apply-templates> 93 </fo:block> 94 </xsl:if> 95</xsl:template> 96 97<xsl:template name="component.toc"> 98 <xsl:param name="toc-context" select="."/> 99 <xsl:param name="toc.title.p" select="true()"/> 100 101 <xsl:variable name="id"> 102 <xsl:call-template name="object.id"/> 103 </xsl:variable> 104 105 <xsl:variable name="cid"> 106 <xsl:call-template name="object.id"> 107 <xsl:with-param name="object" select="$toc-context"/> 108 </xsl:call-template> 109 </xsl:variable> 110 111 <xsl:variable name="nodes" select="section|sect1|refentry 112 |article|bibliography|glossary 113 |appendix|index"/> 114 <xsl:if test="$nodes"> 115 <fo:block id="toc...{$id}" 116 xsl:use-attribute-sets="toc.margin.properties"> 117 <xsl:if test="$toc.title.p"> 118 <xsl:call-template name="table.of.contents.titlepage"/> 119 </xsl:if> 120 <xsl:apply-templates select="$nodes" mode="toc"> 121 <xsl:with-param name="toc-context" select="$toc-context"/> 122 </xsl:apply-templates> 123 </fo:block> 124 </xsl:if> 125</xsl:template> 126 127<xsl:template name="component.toc.separator"> 128 <!-- Customize to output something between 129 component.toc and first output --> 130</xsl:template> 131 132<xsl:template name="section.toc"> 133 <xsl:param name="toc-context" select="."/> 134 <xsl:param name="toc.title.p" select="true()"/> 135 136 <xsl:variable name="id"> 137 <xsl:call-template name="object.id"/> 138 </xsl:variable> 139 140 <xsl:variable name="cid"> 141 <xsl:call-template name="object.id"> 142 <xsl:with-param name="object" select="$toc-context"/> 143 </xsl:call-template> 144 </xsl:variable> 145 146 <xsl:variable name="nodes" 147 select="section|sect1|sect2|sect3|sect4|sect5|refentry 148 |bridgehead[$bridgehead.in.toc != 0]"/> 149 150 <xsl:variable name="level"> 151 <xsl:call-template name="section.level"/> 152 </xsl:variable> 153 154 <xsl:if test="$nodes"> 155 <fo:block id="toc...{$id}" 156 xsl:use-attribute-sets="toc.margin.properties"> 157 158 <xsl:if test="$toc.title.p"> 159 <xsl:call-template name="section.heading"> 160 <xsl:with-param name="level" select="$level + 1"/> 161 <xsl:with-param name="title"> 162 <fo:block space-after="0.5em"> 163 <xsl:call-template name="gentext"> 164 <xsl:with-param name="key" select="'TableofContents'"/> 165 </xsl:call-template> 166 </fo:block> 167 </xsl:with-param> 168 </xsl:call-template> 169 </xsl:if> 170 171 <xsl:apply-templates select="$nodes" mode="toc"> 172 <xsl:with-param name="toc-context" select="$toc-context"/> 173 </xsl:apply-templates> 174 </fo:block> 175 </xsl:if> 176</xsl:template> 177 178<xsl:template name="section.toc.separator"> 179 <!-- Customize to output something between 180 section.toc and first output --> 181</xsl:template> 182<!-- ==================================================================== --> 183 184<xsl:template name="toc.line"> 185 <xsl:variable name="id"> 186 <xsl:call-template name="object.id"/> 187 </xsl:variable> 188 189 <xsl:variable name="label"> 190 <xsl:apply-templates select="." mode="label.markup"/> 191 </xsl:variable> 192 193 <fo:block xsl:use-attribute-sets="toc.line.properties" 194 end-indent="{$toc.indent.width}pt" 195 last-line-end-indent="-{$toc.indent.width}pt"> 196 <fo:inline keep-with-next.within-line="always"> 197 <fo:basic-link internal-destination="{$id}"> 198 <xsl:if test="$label != ''"> 199 <xsl:copy-of select="$label"/> 200 <xsl:value-of select="$autotoc.label.separator"/> 201 </xsl:if> 202 <xsl:apply-templates select="." mode="titleabbrev.markup"/> 203 </fo:basic-link> 204 </fo:inline> 205 <fo:inline keep-together.within-line="always"> 206 <xsl:text> </xsl:text> 207 <fo:leader leader-pattern="dots" 208 leader-pattern-width="3pt" 209 leader-alignment="reference-area" 210 keep-with-next.within-line="always"/> 211 <xsl:text> </xsl:text> 212 <fo:basic-link internal-destination="{$id}"> 213 <fo:page-number-citation ref-id="{$id}"/> 214 </fo:basic-link> 215 </fo:inline> 216 </fo:block> 217</xsl:template> 218 219<!-- ==================================================================== --> 220<xsl:template name="qandaset.toc"> 221 <xsl:param name="toc-context" select="."/> 222 <xsl:param name="toc.title.p" select="true()"/> 223 224 <xsl:variable name="id"> 225 <xsl:call-template name="object.id"/> 226 </xsl:variable> 227 228 <xsl:variable name="cid"> 229 <xsl:call-template name="object.id"> 230 <xsl:with-param name="object" select="$toc-context"/> 231 </xsl:call-template> 232 </xsl:variable> 233 234 <xsl:variable name="nodes" select="qandadiv|qandaentry"/> 235 236 <xsl:if test="$nodes"> 237 <fo:block id="toc...{$id}" 238 xsl:use-attribute-sets="toc.margin.properties"> 239 <xsl:if test="$toc.title.p"> 240 <xsl:call-template name="table.of.contents.titlepage"/> 241 </xsl:if> 242 <xsl:apply-templates select="$nodes" mode="toc"> 243 <xsl:with-param name="toc-context" select="$toc-context"/> 244 </xsl:apply-templates> 245 </fo:block> 246 </xsl:if> 247</xsl:template> 248 249<xsl:template name="qandaset.toc.separator"> 250 <!-- Customize to output something between 251 qandaset.toc and first output --> 252</xsl:template> 253 254<xsl:template match="qandadiv" mode="toc"> 255 <xsl:param name="toc-context" select="."/> 256 257 <xsl:variable name="id"> 258 <xsl:call-template name="object.id"/> 259 </xsl:variable> 260 261 <xsl:variable name="cid"> 262 <xsl:call-template name="object.id"> 263 <xsl:with-param name="object" select="$toc-context"/> 264 </xsl:call-template> 265 </xsl:variable> 266 267 <xsl:call-template name="toc.line"/> 268 269 <xsl:variable name="nodes" select="qandadiv|qandaentry"/> 270 271 <xsl:if test="$nodes"> 272 <fo:block id="toc.{$cid}.{$id}"> 273 <xsl:attribute name="margin-left"> 274 <xsl:call-template name="set.toc.indent"/> 275 </xsl:attribute> 276 277 <xsl:apply-templates select="$nodes" mode="toc"> 278 <xsl:with-param name="toc-context" select="$toc-context"/> 279 </xsl:apply-templates> 280 </fo:block> 281 </xsl:if> 282</xsl:template> 283 284<xsl:template match="qandaentry" mode="toc"> 285 <xsl:apply-templates select="question" mode="toc"/> 286</xsl:template> 287 288<xsl:template match="question" mode="toc"> 289 <xsl:variable name="firstchunk"> 290 <xsl:apply-templates select="(*[name(.)!='label'])[1]/node()"/> 291 </xsl:variable> 292 293 <xsl:variable name="deflabel"> 294 <xsl:choose> 295 <xsl:when test="ancestor-or-self::*[@defaultlabel]"> 296 <xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()] 297 /@defaultlabel"/> 298 </xsl:when> 299 <xsl:otherwise> 300 <xsl:value-of select="$qanda.defaultlabel"/> 301 </xsl:otherwise> 302 </xsl:choose> 303 </xsl:variable> 304 305 <xsl:variable name="id"> 306 <xsl:call-template name="object.id"/> 307 </xsl:variable> 308 309 <xsl:variable name="label"> 310 <xsl:apply-templates select="." mode="label.markup"/> 311 </xsl:variable> 312 313 <fo:block xsl:use-attribute-sets="toc.line.properties" 314 margin-left="3em" 315 text-indent="-3em" 316 end-indent="{$toc.indent.width}pt" 317 last-line-end-indent="-{$toc.indent.width}pt"> 318 <fo:inline keep-with-next.within-line="always"> 319 <fo:basic-link internal-destination="{$id}"> 320 <xsl:if test="$label != ''"> 321 <xsl:copy-of select="$label"/> 322 <xsl:if test="$deflabel = 'number' and not(label)"> 323 <xsl:value-of select="$autotoc.label.separator"/> 324 </xsl:if> 325 <xsl:text> </xsl:text> 326 </xsl:if> 327 <xsl:copy-of select="$firstchunk"/> 328 </fo:basic-link> 329 </fo:inline> 330 <fo:inline keep-together.within-line="always"> 331 <xsl:text> </xsl:text> 332 <fo:leader leader-pattern="dots" 333 leader-pattern-width="3pt" 334 leader-alignment="reference-area" 335 keep-with-next.within-line="always"/> 336 <xsl:text> </xsl:text> 337 <fo:basic-link internal-destination="{$id}"> 338 <fo:page-number-citation ref-id="{$id}"/> 339 </fo:basic-link> 340 </fo:inline> 341 </fo:block> 342 343</xsl:template> 344 345<!-- ==================================================================== --> 346 347<xsl:template match="book|setindex" mode="toc"> 348 <xsl:param name="toc-context" select="."/> 349 350 <xsl:variable name="id"> 351 <xsl:call-template name="object.id"/> 352 </xsl:variable> 353 354 <xsl:variable name="cid"> 355 <xsl:call-template name="object.id"> 356 <xsl:with-param name="object" select="$toc-context"/> 357 </xsl:call-template> 358 </xsl:variable> 359 360 <xsl:call-template name="toc.line"/> 361 362 <xsl:variable name="nodes" select="glossary|bibliography|preface|chapter 363 |reference|part|article|appendix|index"/> 364 365 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/> 366 367 <xsl:if test="$toc.section.depth > 0 368 and $toc.max.depth > $depth.from.context 369 and $nodes"> 370 <fo:block id="toc.{$cid}.{$id}"> 371 <xsl:attribute name="margin-left"> 372 <xsl:call-template name="set.toc.indent"/> 373 </xsl:attribute> 374 375 <xsl:apply-templates select="$nodes" mode="toc"> 376 <xsl:with-param name="toc-context" select="$toc-context"/> 377 </xsl:apply-templates> 378 </fo:block> 379 </xsl:if> 380</xsl:template> 381 382<xsl:template match="part" mode="toc"> 383 <xsl:param name="toc-context" select="."/> 384 385 <xsl:variable name="id"> 386 <xsl:call-template name="object.id"/> 387 </xsl:variable> 388 389 <xsl:variable name="cid"> 390 <xsl:call-template name="object.id"> 391 <xsl:with-param name="object" select="$toc-context"/> 392 </xsl:call-template> 393 </xsl:variable> 394 395 <xsl:call-template name="toc.line"/> 396 397 <xsl:variable name="nodes" select="chapter|appendix|preface|reference| 398 refentry|article|index|glossary| 399 bibliography"/> 400 401 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/> 402 403 <xsl:if test="$toc.section.depth > 0 404 and $toc.max.depth > $depth.from.context 405 and $nodes"> 406 <fo:block id="toc.{$cid}.{$id}"> 407 <xsl:attribute name="margin-left"> 408 <xsl:call-template name="set.toc.indent"/> 409 </xsl:attribute> 410 411 <xsl:apply-templates select="$nodes" mode="toc"> 412 <xsl:with-param name="toc-context" select="$toc-context"/> 413 </xsl:apply-templates> 414 </fo:block> 415 </xsl:if> 416</xsl:template> 417 418<xsl:template match="reference" mode="toc"> 419 <xsl:param name="toc-context" select="."/> 420 421 <xsl:variable name="id"> 422 <xsl:call-template name="object.id"/> 423 </xsl:variable> 424 425 <xsl:variable name="cid"> 426 <xsl:call-template name="object.id"> 427 <xsl:with-param name="object" select="$toc-context"/> 428 </xsl:call-template> 429 </xsl:variable> 430 431 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/> 432 433 <xsl:call-template name="toc.line"/> 434 435 <xsl:if test="$toc.section.depth > 0 436 and $toc.max.depth > $depth.from.context 437 and refentry"> 438 <fo:block id="toc.{$cid}.{$id}"> 439 <xsl:attribute name="margin-left"> 440 <xsl:call-template name="set.toc.indent"/> 441 </xsl:attribute> 442 443 <xsl:apply-templates select="refentry" mode="toc"> 444 <xsl:with-param name="toc-context" select="$toc-context"/> 445 </xsl:apply-templates> 446 </fo:block> 447 </xsl:if> 448</xsl:template> 449 450<xsl:template match="refentry" mode="toc"> 451 <xsl:param name="toc-context" select="."/> 452 453 <xsl:call-template name="toc.line"/> 454</xsl:template> 455 456<xsl:template match="preface|chapter|appendix|article" 457 mode="toc"> 458 <xsl:param name="toc-context" select="."/> 459 460 <xsl:variable name="id"> 461 <xsl:call-template name="object.id"/> 462 </xsl:variable> 463 464 <xsl:variable name="cid"> 465 <xsl:call-template name="object.id"> 466 <xsl:with-param name="object" select="$toc-context"/> 467 </xsl:call-template> 468 </xsl:variable> 469 470 <xsl:call-template name="toc.line"/> 471 472 <xsl:variable name="nodes" select="section|sect1 473 |simplesect[$simplesect.in.toc != 0] 474 |refentry|appendix"/> 475 476 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/> 477 478 <xsl:if test="$toc.section.depth > 0 479 and $toc.max.depth > $depth.from.context 480 and $nodes"> 481 <fo:block id="toc.{$cid}.{$id}"> 482 <xsl:attribute name="margin-left"> 483 <xsl:call-template name="set.toc.indent"/> 484 </xsl:attribute> 485 486 <xsl:apply-templates select="$nodes" mode="toc"> 487 <xsl:with-param name="toc-context" select="$toc-context"/> 488 </xsl:apply-templates> 489 </fo:block> 490 </xsl:if> 491</xsl:template> 492 493<xsl:template match="sect1" mode="toc"> 494 <xsl:param name="toc-context" select="."/> 495 496 <xsl:variable name="id"> 497 <xsl:call-template name="object.id"/> 498 </xsl:variable> 499 500 <xsl:variable name="cid"> 501 <xsl:call-template name="object.id"> 502 <xsl:with-param name="object" select="$toc-context"/> 503 </xsl:call-template> 504 </xsl:variable> 505 506 <xsl:call-template name="toc.line"/> 507 508 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/> 509 510 <xsl:if test="$toc.section.depth > 1 511 and $toc.max.depth > $depth.from.context 512 and sect2"> 513 <fo:block id="toc.{$cid}.{$id}"> 514 <xsl:attribute name="margin-left"> 515 <xsl:call-template name="set.toc.indent"/> 516 </xsl:attribute> 517 518 <xsl:apply-templates select="sect2" mode="toc"> 519 <xsl:with-param name="toc-context" select="$toc-context"/> 520 </xsl:apply-templates> 521 </fo:block> 522 </xsl:if> 523</xsl:template> 524 525<xsl:template match="sect2" mode="toc"> 526 <xsl:param name="toc-context" select="."/> 527 528 <xsl:variable name="id"> 529 <xsl:call-template name="object.id"/> 530 </xsl:variable> 531 532 <xsl:variable name="cid"> 533 <xsl:call-template name="object.id"> 534 <xsl:with-param name="object" select="$toc-context"/> 535 </xsl:call-template> 536 </xsl:variable> 537 538 <xsl:call-template name="toc.line"/> 539 540 <xsl:variable name="reldepth" 541 select="count(ancestor::*)-count($toc-context/ancestor::*)"/> 542 543 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/> 544 545 <xsl:if test="$toc.section.depth > 2 546 and $toc.max.depth > $depth.from.context 547 and sect3"> 548 <fo:block id="toc.{$cid}.{$id}"> 549 <xsl:attribute name="margin-left"> 550 <xsl:call-template name="set.toc.indent"> 551 <xsl:with-param name="reldepth" select="$reldepth"/> 552 </xsl:call-template> 553 </xsl:attribute> 554 555 <xsl:apply-templates select="sect3" mode="toc"> 556 <xsl:with-param name="toc-context" select="$toc-context"/> 557 </xsl:apply-templates> 558 </fo:block> 559 </xsl:if> 560</xsl:template> 561 562<xsl:template match="sect3" mode="toc"> 563 <xsl:param name="toc-context" select="."/> 564 565 <xsl:variable name="id"> 566 <xsl:call-template name="object.id"/> 567 </xsl:variable> 568 569 <xsl:variable name="cid"> 570 <xsl:call-template name="object.id"> 571 <xsl:with-param name="object" select="$toc-context"/> 572 </xsl:call-template> 573 </xsl:variable> 574 575 <xsl:call-template name="toc.line"/> 576 577 <xsl:variable name="reldepth" 578 select="count(ancestor::*)-count($toc-context/ancestor::*)"/> 579 580 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/> 581 582 <xsl:if test="$toc.section.depth > 3 583 and $toc.max.depth > $depth.from.context 584 and sect4"> 585 <fo:block id="toc.{$cid}.{$id}"> 586 <xsl:attribute name="margin-left"> 587 <xsl:call-template name="set.toc.indent"> 588 <xsl:with-param name="reldepth" select="$reldepth"/> 589 </xsl:call-template> 590 </xsl:attribute> 591 592 <xsl:apply-templates select="sect4" mode="toc"> 593 <xsl:with-param name="toc-context" select="$toc-context"/> 594 </xsl:apply-templates> 595 </fo:block> 596 </xsl:if> 597</xsl:template> 598 599<xsl:template match="sect4" mode="toc"> 600 <xsl:param name="toc-context" select="."/> 601 602 <xsl:variable name="id"> 603 <xsl:call-template name="object.id"/> 604 </xsl:variable> 605 606 <xsl:variable name="cid"> 607 <xsl:call-template name="object.id"> 608 <xsl:with-param name="object" select="$toc-context"/> 609 </xsl:call-template> 610 </xsl:variable> 611 612 <xsl:call-template name="toc.line"/> 613 614 <xsl:variable name="reldepth" 615 select="count(ancestor::*)-count($toc-context/ancestor::*)"/> 616 617 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/> 618 619 <xsl:if test="$toc.section.depth > 4 620 and $toc.max.depth > $depth.from.context 621 and sect5"> 622 <fo:block id="toc.{$cid}.{$id}"> 623 <xsl:attribute name="margin-left"> 624 <xsl:call-template name="set.toc.indent"> 625 <xsl:with-param name="reldepth" select="$reldepth"/> 626 </xsl:call-template> 627 </xsl:attribute> 628 629 <xsl:apply-templates select="sect5" mode="toc"> 630 <xsl:with-param name="toc-context" select="$toc-context"/> 631 </xsl:apply-templates> 632 </fo:block> 633 </xsl:if> 634</xsl:template> 635 636<xsl:template match="sect5|simplesect" mode="toc"> 637 <xsl:param name="toc-context" select="."/> 638 639 <xsl:call-template name="toc.line"/> 640</xsl:template> 641 642<xsl:template name="set.toc.indent"> 643 <xsl:param name="reldepth"/> 644 645 <xsl:variable name="depth"> 646 <xsl:choose> 647 <xsl:when test="$reldepth != ''"> 648 <xsl:value-of select="$reldepth"/> 649 </xsl:when> 650 <xsl:otherwise> 651 <xsl:value-of select="count(ancestor::*)"/> 652 </xsl:otherwise> 653 </xsl:choose> 654 </xsl:variable> 655 656 <xsl:choose> 657 <xsl:when test="$fop.extensions != 0 or $passivetex.extensions != 0"> 658 <xsl:value-of select="concat($depth*$toc.indent.width, 'pt')"/> 659 </xsl:when> 660 <xsl:otherwise> 661 <xsl:value-of select="concat($toc.indent.width, 'pt')"/> 662 </xsl:otherwise> 663 </xsl:choose> 664</xsl:template> 665 666 667<xsl:template match="section" mode="toc"> 668 <xsl:param name="toc-context" select="."/> 669 670 <xsl:variable name="id"> 671 <xsl:call-template name="object.id"/> 672 </xsl:variable> 673 674 <xsl:variable name="cid"> 675 <xsl:call-template name="object.id"> 676 <xsl:with-param name="object" select="$toc-context"/> 677 </xsl:call-template> 678 </xsl:variable> 679 680 <xsl:variable name="depth" select="count(ancestor::section) + 1"/> 681 <xsl:variable name="reldepth" 682 select="count(ancestor::*)-count($toc-context/ancestor::*)"/> 683 684 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/> 685 686 <xsl:if test="$toc.section.depth >= $depth"> 687 <xsl:call-template name="toc.line"/> 688 689 <xsl:if test="$toc.section.depth > $depth 690 and $toc.max.depth > $depth.from.context 691 and section"> 692 <fo:block id="toc.{$cid}.{$id}"> 693 <xsl:attribute name="margin-left"> 694 <xsl:call-template name="set.toc.indent"> 695 <xsl:with-param name="reldepth" select="$reldepth"/> 696 </xsl:call-template> 697 </xsl:attribute> 698 699 <xsl:apply-templates select="section" mode="toc"> 700 <xsl:with-param name="toc-context" select="$toc-context"/> 701 </xsl:apply-templates> 702 </fo:block> 703 </xsl:if> 704 </xsl:if> 705</xsl:template> 706 707<xsl:template match="bibliography|glossary" 708 mode="toc"> 709 <xsl:param name="toc-context" select="."/> 710 711 <xsl:call-template name="toc.line"/> 712</xsl:template> 713 714<xsl:template match="index" mode="toc"> 715 <xsl:param name="toc-context" select="."/> 716 717 <xsl:if test="* or $generate.index != 0"> 718 <xsl:call-template name="toc.line"/> 719 </xsl:if> 720</xsl:template> 721 722<xsl:template match="title" mode="toc"> 723 <xsl:apply-templates/> 724</xsl:template> 725 726<!-- ==================================================================== --> 727 728<xsl:template name="list.of.titles"> 729 <xsl:param name="titles" select="'table'"/> 730 <xsl:param name="nodes" select=".//table"/> 731 <xsl:param name="toc-context" select="."/> 732 733 <xsl:variable name="id"> 734 <xsl:call-template name="object.id"/> 735 </xsl:variable> 736 737 <xsl:if test="$nodes"> 738 <fo:block id="lot...{$titles}...{$id}"> 739 <xsl:choose> 740 <xsl:when test="$titles='table'"> 741 <xsl:call-template name="list.of.tables.titlepage"/> 742 </xsl:when> 743 <xsl:when test="$titles='figure'"> 744 <xsl:call-template name="list.of.figures.titlepage"/> 745 </xsl:when> 746 <xsl:when test="$titles='equation'"> 747 <xsl:call-template name="list.of.equations.titlepage"/> 748 </xsl:when> 749 <xsl:when test="$titles='example'"> 750 <xsl:call-template name="list.of.examples.titlepage"/> 751 </xsl:when> 752 <xsl:when test="$titles='procedure'"> 753 <xsl:call-template name="list.of.procedures.titlepage"/> 754 </xsl:when> 755 <xsl:otherwise> 756 <xsl:call-template name="list.of.unknowns.titlepage"/> 757 </xsl:otherwise> 758 </xsl:choose> 759 <xsl:apply-templates select="$nodes" mode="toc"> 760 <xsl:with-param name="toc-context" select="$toc-context"/> 761 </xsl:apply-templates> 762 </fo:block> 763 </xsl:if> 764</xsl:template> 765 766<xsl:template match="figure|table|example|equation|procedure" mode="toc"> 767 <xsl:call-template name="toc.line"/> 768</xsl:template> 769 770<!-- ==================================================================== --> 771 772</xsl:stylesheet> 773 774