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 version='1.0'> 5 6<!-- ******************************************************************** 7 $Id$ 8 ******************************************************************** 9 10 This file is part of the XSL DocBook Stylesheet distribution. 11 See /README or http://nwalsh.com/docbook/xsl/ for copyright 12 and other information. 13 14 ******************************************************************** --> 15 16<!-- ==================================================================== --> 17 18<xsl:template name="division.toc"> 19 <xsl:variable name="nodes" 20 select="part|reference|preface 21 |chapter|appendix 22 |article 23 |bibliography|glossary|index"/> 24 <xsl:if test="$nodes"> 25 <fo:block xsl:use-attribute-sets="toc.margin.properties"> 26 <xsl:call-template name="table.of.contents.titlepage"/> 27 <xsl:apply-templates select="$nodes" mode="toc"/> 28 </fo:block> 29 </xsl:if> 30</xsl:template> 31 32<xsl:template name="component.toc"> 33 <xsl:variable name="nodes" select="section|sect1|refentry 34 |article|bibliography|glossary 35 |appendix"/> 36 <xsl:if test="$nodes"> 37 <fo:block xsl:use-attribute-sets="toc.margin.properties"> 38 <fo:block> 39 <fo:inline font-weight="bold"> 40 <xsl:call-template name="gentext"> 41 <xsl:with-param name="key">TableofContents</xsl:with-param> 42 </xsl:call-template> 43 </fo:inline> 44 </fo:block> 45 <xsl:apply-templates select="$nodes" mode="toc"/> 46 </fo:block> 47 </xsl:if> 48</xsl:template> 49 50<!-- ==================================================================== --> 51 52<xsl:template name="toc.line"> 53 <xsl:variable name="id"> 54 <xsl:call-template name="object.id"/> 55 </xsl:variable> 56 57 <fo:block text-align-last="justify" 58 end-indent="2pc" 59 last-line-end-indent="-2pc"> 60 <fo:inline keep-with-next.within-line="always"> 61 <xsl:apply-templates select="." mode="label.markup"/> 62 <xsl:text> </xsl:text> 63 <xsl:apply-templates select="." mode="title.markup"/> 64 </fo:inline> 65 <fo:inline keep-together.within-line="always"> 66 <xsl:text> </xsl:text> 67 <fo:leader leader-pattern="dots" 68 keep-with-next.within-line="always"/> 69 <xsl:text> </xsl:text> 70 <fo:basic-link internal-destination="{$id}"> 71<!-- xsl:use-attribute-sets="xref.properties">--> 72 <fo:page-number-citation ref-id="{$id}"/> 73 </fo:basic-link> 74 </fo:inline> 75 </fo:block> 76</xsl:template> 77 78<!-- ==================================================================== --> 79 80<xsl:template match="part" mode="toc"> 81 <xsl:call-template name="toc.line"/> 82 83 <xsl:if test="chapter|appendix|preface|reference"> 84 <fo:block start-indent="{count(ancestor::*)*2}pc"> 85 <xsl:apply-templates select="chapter|appendix|preface|reference" 86 mode="toc"/> 87 </fo:block> 88 </xsl:if> 89</xsl:template> 90 91<xsl:template match="reference" mode="toc"> 92 <xsl:call-template name="toc.line"/> 93 94 <xsl:if test="refentry"> 95 <fo:block start-indent="{count(ancestor::*)*2}pc"> 96 <xsl:apply-templates select="refentry" mode="toc"/> 97 </fo:block> 98 </xsl:if> 99</xsl:template> 100 101<xsl:template match="refentry" mode="toc"> 102 <xsl:call-template name="toc.line"/> 103</xsl:template> 104 105<xsl:template match="preface|chapter|appendix|article" 106 mode="toc"> 107 <xsl:call-template name="toc.line"/> 108 109 <xsl:if test="section|sect1"> 110 <fo:block start-indent="{count(ancestor::*)*2}pc"> 111 <xsl:apply-templates select="section|sect1" 112 mode="toc"/> 113 </fo:block> 114 </xsl:if> 115</xsl:template> 116 117<xsl:template match="section|sect1|sect2|sect3|sect4|sect5" 118 mode="toc"> 119 <xsl:call-template name="toc.line"/> 120 121 <xsl:if test="section|sect2|sect3|sect4|sect5"> 122 <fo:block start-indent="{count(ancestor::*)*2}pc"> 123 <xsl:apply-templates select="section|sect2|sect3|sect4|sect5" 124 mode="toc"/> 125 </fo:block> 126 </xsl:if> 127</xsl:template> 128 129<xsl:template match="bibliography|glossary" 130 mode="toc"> 131 <xsl:call-template name="toc.line"/> 132</xsl:template> 133 134<xsl:template match="index" 135 mode="toc"> 136 <xsl:if test="* or $generate.index"> 137 <xsl:call-template name="toc.line"/> 138 </xsl:if> 139</xsl:template> 140 141<xsl:template match="title" mode="toc"> 142 <xsl:apply-templates/> 143</xsl:template> 144 145<!-- ==================================================================== --> 146 147<xsl:template name="list.of.titles"> 148 <xsl:param name="titles" select="'table'"/> 149 <xsl:param name="nodes" select=".//table"/> 150 151 <xsl:if test="$nodes"> 152 <fo:block> 153 <xsl:choose> 154 <xsl:when test="$titles='table'"> 155 <xsl:call-template name="list.of.tables.titlepage"/> 156 </xsl:when> 157 <xsl:when test="$titles='figure'"> 158 <xsl:call-template name="list.of.figures.titlepage"/> 159 </xsl:when> 160 <xsl:when test="$titles='equation'"> 161 <xsl:call-template name="list.of.equations.titlepage"/> 162 </xsl:when> 163 <xsl:when test="$titles='example'"> 164 <xsl:call-template name="list.of.examples.titlepage"/> 165 </xsl:when> 166 <xsl:otherwise> 167 <xsl:call-template name="list.of.unknowns.titlepage"/> 168 </xsl:otherwise> 169 </xsl:choose> 170 <xsl:apply-templates select="$nodes" mode="toc"/> 171 </fo:block> 172 </xsl:if> 173</xsl:template> 174 175<xsl:template match="figure|table|example|equation" mode="toc"> 176 <xsl:call-template name="toc.line"/> 177</xsl:template> 178 179<!-- ==================================================================== --> 180 181</xsl:stylesheet> 182 183