[15c7d39] | 1 | <?xml version="1.0" encoding="ASCII"?><!--This file was created automatically by html2xhtml--><!--from the HTML stylesheets.--><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="1.0">
|
---|
[c873d807] | 2 |
|
---|
| 3 | <!-- ********************************************************************
|
---|
[15c7d39] | 4 | $Id: autotoc.xsl 9692 2012-12-16 02:31:34Z dcramer $
|
---|
[c873d807] | 5 | ********************************************************************
|
---|
| 6 |
|
---|
| 7 | This file is part of the XSL DocBook Stylesheet distribution.
|
---|
| 8 | See ../README or http://docbook.sf.net/release/xsl/current/ for
|
---|
| 9 | copyright and other information.
|
---|
| 10 |
|
---|
| 11 | ******************************************************************** -->
|
---|
| 12 |
|
---|
| 13 | <xsl:variable name="toc.listitem.type">
|
---|
| 14 | <xsl:choose>
|
---|
| 15 | <xsl:when test="$toc.list.type = 'dl'">dt</xsl:when>
|
---|
| 16 | <xsl:otherwise>li</xsl:otherwise>
|
---|
| 17 | </xsl:choose>
|
---|
| 18 | </xsl:variable>
|
---|
| 19 |
|
---|
| 20 | <!-- this is just hack because dl and ul aren't completely isomorphic -->
|
---|
| 21 | <xsl:variable name="toc.dd.type">
|
---|
| 22 | <xsl:choose>
|
---|
| 23 | <xsl:when test="$toc.list.type = 'dl'">dd</xsl:when>
|
---|
| 24 | <xsl:otherwise/>
|
---|
| 25 | </xsl:choose>
|
---|
| 26 | </xsl:variable>
|
---|
| 27 |
|
---|
| 28 | <xsl:template name="make.toc">
|
---|
| 29 | <xsl:param name="toc-context" select="."/>
|
---|
| 30 | <xsl:param name="toc.title.p" select="true()"/>
|
---|
| 31 | <xsl:param name="nodes" select="/NOT-AN-ELEMENT"/>
|
---|
| 32 |
|
---|
| 33 | <xsl:variable name="nodes.plus" select="$nodes | qandaset"/>
|
---|
| 34 |
|
---|
| 35 | <xsl:variable name="toc.title">
|
---|
| 36 | <xsl:if test="$toc.title.p">
|
---|
[15c7d39] | 37 | <xsl:choose>
|
---|
| 38 | <xsl:when test="$make.clean.html != 0">
|
---|
| 39 | <div class="toc-title">
|
---|
| 40 | <xsl:call-template name="gentext">
|
---|
| 41 | <xsl:with-param name="key">TableofContents</xsl:with-param>
|
---|
| 42 | </xsl:call-template>
|
---|
| 43 | </div>
|
---|
| 44 | </xsl:when>
|
---|
| 45 | <xsl:otherwise>
|
---|
| 46 | <p>
|
---|
| 47 | <strong>
|
---|
| 48 | <xsl:call-template name="gentext">
|
---|
| 49 | <xsl:with-param name="key">TableofContents</xsl:with-param>
|
---|
| 50 | </xsl:call-template>
|
---|
| 51 | </strong>
|
---|
| 52 | </p>
|
---|
| 53 | </xsl:otherwise>
|
---|
| 54 | </xsl:choose>
|
---|
[c873d807] | 55 | </xsl:if>
|
---|
| 56 | </xsl:variable>
|
---|
| 57 |
|
---|
| 58 | <xsl:choose>
|
---|
| 59 | <xsl:when test="$manual.toc != ''">
|
---|
| 60 | <xsl:variable name="id">
|
---|
| 61 | <xsl:call-template name="object.id"/>
|
---|
| 62 | </xsl:variable>
|
---|
| 63 | <xsl:variable name="toc" select="document($manual.toc, .)"/>
|
---|
| 64 | <xsl:variable name="tocentry" select="$toc//tocentry[@linkend=$id]"/>
|
---|
| 65 | <xsl:if test="$tocentry and $tocentry/*">
|
---|
| 66 | <div class="toc">
|
---|
| 67 | <xsl:copy-of select="$toc.title"/>
|
---|
| 68 | <xsl:element name="{$toc.list.type}" namespace="http://www.w3.org/1999/xhtml">
|
---|
[15c7d39] | 69 | <xsl:call-template name="toc.list.attributes">
|
---|
| 70 | <xsl:with-param name="toc-context" select="$toc-context"/>
|
---|
| 71 | <xsl:with-param name="toc.title.p" select="$toc.title.p"/>
|
---|
| 72 | <xsl:with-param name="nodes" select="$nodes"/>
|
---|
| 73 | </xsl:call-template>
|
---|
[c873d807] | 74 | <xsl:call-template name="manual-toc">
|
---|
| 75 | <xsl:with-param name="tocentry" select="$tocentry/*[1]"/>
|
---|
| 76 | </xsl:call-template>
|
---|
| 77 | </xsl:element>
|
---|
| 78 | </div>
|
---|
| 79 | </xsl:if>
|
---|
| 80 | </xsl:when>
|
---|
| 81 | <xsl:otherwise>
|
---|
| 82 | <xsl:choose>
|
---|
| 83 | <xsl:when test="$qanda.in.toc != 0">
|
---|
| 84 | <xsl:if test="$nodes.plus">
|
---|
| 85 | <div class="toc">
|
---|
| 86 | <xsl:copy-of select="$toc.title"/>
|
---|
| 87 | <xsl:element name="{$toc.list.type}" namespace="http://www.w3.org/1999/xhtml">
|
---|
[15c7d39] | 88 | <xsl:call-template name="toc.list.attributes">
|
---|
| 89 | <xsl:with-param name="toc-context" select="$toc-context"/>
|
---|
| 90 | <xsl:with-param name="toc.title.p" select="$toc.title.p"/>
|
---|
| 91 | <xsl:with-param name="nodes" select="$nodes"/>
|
---|
| 92 | </xsl:call-template>
|
---|
[c873d807] | 93 | <xsl:apply-templates select="$nodes.plus" mode="toc">
|
---|
| 94 | <xsl:with-param name="toc-context" select="$toc-context"/>
|
---|
| 95 | </xsl:apply-templates>
|
---|
| 96 | </xsl:element>
|
---|
| 97 | </div>
|
---|
| 98 | </xsl:if>
|
---|
| 99 | </xsl:when>
|
---|
| 100 | <xsl:otherwise>
|
---|
| 101 | <xsl:if test="$nodes">
|
---|
| 102 | <div class="toc">
|
---|
| 103 | <xsl:copy-of select="$toc.title"/>
|
---|
| 104 | <xsl:element name="{$toc.list.type}" namespace="http://www.w3.org/1999/xhtml">
|
---|
[15c7d39] | 105 | <xsl:call-template name="toc.list.attributes">
|
---|
| 106 | <xsl:with-param name="toc-context" select="$toc-context"/>
|
---|
| 107 | <xsl:with-param name="toc.title.p" select="$toc.title.p"/>
|
---|
| 108 | <xsl:with-param name="nodes" select="$nodes"/>
|
---|
| 109 | </xsl:call-template>
|
---|
[c873d807] | 110 | <xsl:apply-templates select="$nodes" mode="toc">
|
---|
| 111 | <xsl:with-param name="toc-context" select="$toc-context"/>
|
---|
| 112 | </xsl:apply-templates>
|
---|
| 113 | </xsl:element>
|
---|
| 114 | </div>
|
---|
| 115 | </xsl:if>
|
---|
| 116 | </xsl:otherwise>
|
---|
| 117 | </xsl:choose>
|
---|
| 118 |
|
---|
| 119 | </xsl:otherwise>
|
---|
| 120 | </xsl:choose>
|
---|
| 121 | </xsl:template>
|
---|
| 122 |
|
---|
[15c7d39] | 123 | <xsl:template name="toc.list.attributes">
|
---|
| 124 | <xsl:param name="toc-context" select="."/>
|
---|
| 125 | <xsl:param name="toc.title.p" select="true()"/>
|
---|
| 126 | <xsl:param name="nodes" select="/NOT-AN-ELEMENT"/>
|
---|
| 127 |
|
---|
| 128 | <xsl:attribute name="class">toc</xsl:attribute>
|
---|
| 129 | </xsl:template>
|
---|
| 130 |
|
---|
[c873d807] | 131 | <xsl:template name="make.lots">
|
---|
| 132 | <xsl:param name="toc.params" select="''"/>
|
---|
| 133 | <xsl:param name="toc"/>
|
---|
| 134 |
|
---|
| 135 | <xsl:if test="contains($toc.params, 'toc')">
|
---|
| 136 | <xsl:copy-of select="$toc"/>
|
---|
| 137 | </xsl:if>
|
---|
| 138 |
|
---|
| 139 | <xsl:if test="contains($toc.params, 'figure')">
|
---|
| 140 | <xsl:call-template name="list.of.titles">
|
---|
| 141 | <xsl:with-param name="titles" select="'figure'"/>
|
---|
| 142 | <xsl:with-param name="nodes" select=".//figure"/>
|
---|
| 143 | </xsl:call-template>
|
---|
| 144 | </xsl:if>
|
---|
| 145 |
|
---|
| 146 | <xsl:if test="contains($toc.params, 'table')">
|
---|
| 147 | <xsl:call-template name="list.of.titles">
|
---|
| 148 | <xsl:with-param name="titles" select="'table'"/>
|
---|
[15c7d39] | 149 | <xsl:with-param name="nodes" select=".//table[not(@tocentry = 0)]"/>
|
---|
[c873d807] | 150 | </xsl:call-template>
|
---|
| 151 | </xsl:if>
|
---|
| 152 |
|
---|
| 153 | <xsl:if test="contains($toc.params, 'example')">
|
---|
| 154 | <xsl:call-template name="list.of.titles">
|
---|
| 155 | <xsl:with-param name="titles" select="'example'"/>
|
---|
| 156 | <xsl:with-param name="nodes" select=".//example"/>
|
---|
| 157 | </xsl:call-template>
|
---|
| 158 | </xsl:if>
|
---|
| 159 |
|
---|
| 160 | <xsl:if test="contains($toc.params, 'equation')">
|
---|
| 161 | <xsl:call-template name="list.of.titles">
|
---|
| 162 | <xsl:with-param name="titles" select="'equation'"/>
|
---|
| 163 | <xsl:with-param name="nodes" select=".//equation[title or info/title]"/>
|
---|
| 164 | </xsl:call-template>
|
---|
| 165 | </xsl:if>
|
---|
| 166 |
|
---|
| 167 | <xsl:if test="contains($toc.params, 'procedure')">
|
---|
| 168 | <xsl:call-template name="list.of.titles">
|
---|
| 169 | <xsl:with-param name="titles" select="'procedure'"/>
|
---|
| 170 | <xsl:with-param name="nodes" select=".//procedure[title]"/>
|
---|
| 171 | </xsl:call-template>
|
---|
| 172 | </xsl:if>
|
---|
| 173 | </xsl:template>
|
---|
| 174 |
|
---|
| 175 | <!-- ====================================================================== -->
|
---|
| 176 |
|
---|
| 177 | <xsl:template name="set.toc">
|
---|
| 178 | <xsl:param name="toc-context" select="."/>
|
---|
| 179 | <xsl:param name="toc.title.p" select="true()"/>
|
---|
| 180 |
|
---|
| 181 | <xsl:call-template name="make.toc">
|
---|
| 182 | <xsl:with-param name="toc-context" select="$toc-context"/>
|
---|
| 183 | <xsl:with-param name="toc.title.p" select="$toc.title.p"/>
|
---|
[15c7d39] | 184 | <xsl:with-param name="nodes" select="book|setindex|set"/>
|
---|
[c873d807] | 185 | </xsl:call-template>
|
---|
| 186 | </xsl:template>
|
---|
| 187 |
|
---|
| 188 | <xsl:template name="division.toc">
|
---|
| 189 | <xsl:param name="toc-context" select="."/>
|
---|
| 190 | <xsl:param name="toc.title.p" select="true()"/>
|
---|
| 191 |
|
---|
| 192 | <xsl:call-template name="make.toc">
|
---|
| 193 | <xsl:with-param name="toc-context" select="$toc-context"/>
|
---|
| 194 | <xsl:with-param name="toc.title.p" select="$toc.title.p"/>
|
---|
[15c7d39] | 195 | <xsl:with-param name="nodes" select="part|reference |preface|chapter|appendix |article |topic |bibliography|glossary|index |refentry |bridgehead[$bridgehead.in.toc != 0]"/>
|
---|
[c873d807] | 196 |
|
---|
| 197 | </xsl:call-template>
|
---|
| 198 | </xsl:template>
|
---|
| 199 |
|
---|
| 200 | <xsl:template name="component.toc">
|
---|
| 201 | <xsl:param name="toc-context" select="."/>
|
---|
| 202 | <xsl:param name="toc.title.p" select="true()"/>
|
---|
| 203 |
|
---|
| 204 | <xsl:call-template name="make.toc">
|
---|
| 205 | <xsl:with-param name="toc-context" select="$toc-context"/>
|
---|
| 206 | <xsl:with-param name="toc.title.p" select="$toc.title.p"/>
|
---|
[15c7d39] | 207 | <xsl:with-param name="nodes" select="section|sect1 |simplesect[$simplesect.in.toc != 0] |topic |refentry |article|bibliography|glossary |appendix|index |bridgehead[not(@renderas) and $bridgehead.in.toc != 0] |.//bridgehead[@renderas='sect1' and $bridgehead.in.toc != 0]"/>
|
---|
[c873d807] | 208 | </xsl:call-template>
|
---|
| 209 | </xsl:template>
|
---|
| 210 |
|
---|
| 211 | <xsl:template name="component.toc.separator">
|
---|
| 212 | <!-- Customize to output something between
|
---|
| 213 | component.toc and first output -->
|
---|
| 214 | </xsl:template>
|
---|
| 215 |
|
---|
| 216 | <xsl:template name="section.toc">
|
---|
| 217 | <xsl:param name="toc-context" select="."/>
|
---|
| 218 | <xsl:param name="toc.title.p" select="true()"/>
|
---|
| 219 |
|
---|
| 220 | <xsl:call-template name="make.toc">
|
---|
| 221 | <xsl:with-param name="toc-context" select="$toc-context"/>
|
---|
| 222 | <xsl:with-param name="toc.title.p" select="$toc.title.p"/>
|
---|
| 223 | <xsl:with-param name="nodes" select="section|sect1|sect2|sect3|sect4|sect5|refentry |bridgehead[$bridgehead.in.toc != 0]"/>
|
---|
| 224 |
|
---|
| 225 | </xsl:call-template>
|
---|
| 226 | </xsl:template>
|
---|
| 227 |
|
---|
| 228 | <xsl:template name="section.toc.separator">
|
---|
| 229 | <!-- Customize to output something between
|
---|
| 230 | section.toc and first output -->
|
---|
| 231 | </xsl:template>
|
---|
| 232 | <!-- ==================================================================== -->
|
---|
| 233 |
|
---|
| 234 | <xsl:template name="subtoc">
|
---|
| 235 | <xsl:param name="toc-context" select="."/>
|
---|
| 236 | <xsl:param name="nodes" select="NOT-AN-ELEMENT"/>
|
---|
| 237 |
|
---|
| 238 | <xsl:variable name="nodes.plus" select="$nodes | qandaset"/>
|
---|
| 239 |
|
---|
| 240 | <xsl:variable name="subtoc">
|
---|
| 241 | <xsl:element name="{$toc.list.type}" namespace="http://www.w3.org/1999/xhtml">
|
---|
| 242 | <xsl:choose>
|
---|
| 243 | <xsl:when test="$qanda.in.toc != 0">
|
---|
| 244 | <xsl:apply-templates mode="toc" select="$nodes.plus">
|
---|
| 245 | <xsl:with-param name="toc-context" select="$toc-context"/>
|
---|
| 246 | </xsl:apply-templates>
|
---|
| 247 | </xsl:when>
|
---|
| 248 | <xsl:otherwise>
|
---|
| 249 | <xsl:apply-templates mode="toc" select="$nodes">
|
---|
| 250 | <xsl:with-param name="toc-context" select="$toc-context"/>
|
---|
| 251 | </xsl:apply-templates>
|
---|
| 252 | </xsl:otherwise>
|
---|
| 253 | </xsl:choose>
|
---|
| 254 | </xsl:element>
|
---|
| 255 | </xsl:variable>
|
---|
| 256 |
|
---|
| 257 | <xsl:variable name="depth">
|
---|
| 258 | <xsl:choose>
|
---|
| 259 | <xsl:when test="local-name(.) = 'section'">
|
---|
| 260 | <xsl:value-of select="count(ancestor::section) + 1"/>
|
---|
| 261 | </xsl:when>
|
---|
| 262 | <xsl:when test="local-name(.) = 'sect1'">1</xsl:when>
|
---|
| 263 | <xsl:when test="local-name(.) = 'sect2'">2</xsl:when>
|
---|
| 264 | <xsl:when test="local-name(.) = 'sect3'">3</xsl:when>
|
---|
| 265 | <xsl:when test="local-name(.) = 'sect4'">4</xsl:when>
|
---|
| 266 | <xsl:when test="local-name(.) = 'sect5'">5</xsl:when>
|
---|
| 267 | <xsl:when test="local-name(.) = 'refsect1'">1</xsl:when>
|
---|
| 268 | <xsl:when test="local-name(.) = 'refsect2'">2</xsl:when>
|
---|
| 269 | <xsl:when test="local-name(.) = 'refsect3'">3</xsl:when>
|
---|
[15c7d39] | 270 | <xsl:when test="local-name(.) = 'topic'">1</xsl:when>
|
---|
[c873d807] | 271 | <xsl:when test="local-name(.) = 'simplesect'">
|
---|
| 272 | <!-- sigh... -->
|
---|
| 273 | <xsl:choose>
|
---|
| 274 | <xsl:when test="local-name(..) = 'section'">
|
---|
| 275 | <xsl:value-of select="count(ancestor::section)"/>
|
---|
| 276 | </xsl:when>
|
---|
| 277 | <xsl:when test="local-name(..) = 'sect1'">2</xsl:when>
|
---|
| 278 | <xsl:when test="local-name(..) = 'sect2'">3</xsl:when>
|
---|
| 279 | <xsl:when test="local-name(..) = 'sect3'">4</xsl:when>
|
---|
| 280 | <xsl:when test="local-name(..) = 'sect4'">5</xsl:when>
|
---|
| 281 | <xsl:when test="local-name(..) = 'sect5'">6</xsl:when>
|
---|
[15c7d39] | 282 | <xsl:when test="local-name(..) = 'topic'">2</xsl:when>
|
---|
[c873d807] | 283 | <xsl:when test="local-name(..) = 'refsect1'">2</xsl:when>
|
---|
| 284 | <xsl:when test="local-name(..) = 'refsect2'">3</xsl:when>
|
---|
| 285 | <xsl:when test="local-name(..) = 'refsect3'">4</xsl:when>
|
---|
| 286 | <xsl:otherwise>1</xsl:otherwise>
|
---|
| 287 | </xsl:choose>
|
---|
| 288 | </xsl:when>
|
---|
| 289 | <xsl:otherwise>0</xsl:otherwise>
|
---|
| 290 | </xsl:choose>
|
---|
| 291 | </xsl:variable>
|
---|
| 292 |
|
---|
| 293 | <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
|
---|
| 294 |
|
---|
| 295 | <xsl:variable name="subtoc.list">
|
---|
| 296 | <xsl:choose>
|
---|
| 297 | <xsl:when test="$toc.dd.type = ''">
|
---|
| 298 | <xsl:copy-of select="$subtoc"/>
|
---|
| 299 | </xsl:when>
|
---|
| 300 | <xsl:otherwise>
|
---|
| 301 | <xsl:element name="{$toc.dd.type}" namespace="http://www.w3.org/1999/xhtml">
|
---|
| 302 | <xsl:copy-of select="$subtoc"/>
|
---|
| 303 | </xsl:element>
|
---|
| 304 | </xsl:otherwise>
|
---|
| 305 | </xsl:choose>
|
---|
| 306 | </xsl:variable>
|
---|
| 307 |
|
---|
| 308 | <xsl:element name="{$toc.listitem.type}" namespace="http://www.w3.org/1999/xhtml">
|
---|
| 309 | <xsl:call-template name="toc.line">
|
---|
| 310 | <xsl:with-param name="toc-context" select="$toc-context"/>
|
---|
| 311 | </xsl:call-template>
|
---|
[15c7d39] | 312 | <xsl:if test="$toc.listitem.type = 'li' and ( (self::set or self::book or self::part) or $toc.section.depth > $depth) and ( ($qanda.in.toc = 0 and count($nodes)>0) or ($qanda.in.toc != 0 and count($nodes.plus)>0) ) and $toc.max.depth > $depth.from.context">
|
---|
[c873d807] | 313 | <xsl:copy-of select="$subtoc.list"/>
|
---|
| 314 | </xsl:if>
|
---|
| 315 | </xsl:element>
|
---|
[15c7d39] | 316 | <xsl:if test="$toc.listitem.type != 'li' and ( (self::set or self::book or self::part) or $toc.section.depth > $depth) and ( ($qanda.in.toc = 0 and count($nodes)>0) or ($qanda.in.toc != 0 and count($nodes.plus)>0) ) and $toc.max.depth > $depth.from.context">
|
---|
[c873d807] | 317 | <xsl:copy-of select="$subtoc.list"/>
|
---|
| 318 | </xsl:if>
|
---|
| 319 | </xsl:template>
|
---|
| 320 |
|
---|
| 321 | <xsl:template name="toc.line">
|
---|
| 322 | <xsl:param name="toc-context" select="."/>
|
---|
| 323 | <xsl:param name="depth" select="1"/>
|
---|
| 324 | <xsl:param name="depth.from.context" select="8"/>
|
---|
| 325 |
|
---|
| 326 | <span>
|
---|
| 327 | <xsl:attribute name="class"><xsl:value-of select="local-name(.)"/></xsl:attribute>
|
---|
| 328 |
|
---|
| 329 | <!-- * if $autotoc.label.in.hyperlink is zero, then output the label -->
|
---|
| 330 | <!-- * before the hyperlinked title (as the DSSSL stylesheet does) -->
|
---|
| 331 | <xsl:if test="$autotoc.label.in.hyperlink = 0">
|
---|
| 332 | <xsl:variable name="label">
|
---|
| 333 | <xsl:apply-templates select="." mode="label.markup"/>
|
---|
| 334 | </xsl:variable>
|
---|
| 335 | <xsl:copy-of select="$label"/>
|
---|
| 336 | <xsl:if test="$label != ''">
|
---|
| 337 | <xsl:value-of select="$autotoc.label.separator"/>
|
---|
| 338 | </xsl:if>
|
---|
| 339 | </xsl:if>
|
---|
| 340 |
|
---|
| 341 | <a>
|
---|
| 342 | <xsl:attribute name="href">
|
---|
| 343 | <xsl:call-template name="href.target">
|
---|
| 344 | <xsl:with-param name="context" select="$toc-context"/>
|
---|
[60a5a938] | 345 | <xsl:with-param name="toc-context" select="$toc-context"/>
|
---|
[c873d807] | 346 | </xsl:call-template>
|
---|
| 347 | </xsl:attribute>
|
---|
| 348 |
|
---|
| 349 | <!-- * if $autotoc.label.in.hyperlink is non-zero, then output the label -->
|
---|
| 350 | <!-- * as part of the hyperlinked title -->
|
---|
| 351 | <xsl:if test="not($autotoc.label.in.hyperlink = 0)">
|
---|
| 352 | <xsl:variable name="label">
|
---|
| 353 | <xsl:apply-templates select="." mode="label.markup"/>
|
---|
| 354 | </xsl:variable>
|
---|
| 355 | <xsl:copy-of select="$label"/>
|
---|
| 356 | <xsl:if test="$label != ''">
|
---|
| 357 | <xsl:value-of select="$autotoc.label.separator"/>
|
---|
| 358 | </xsl:if>
|
---|
| 359 | </xsl:if>
|
---|
| 360 |
|
---|
| 361 | <xsl:apply-templates select="." mode="titleabbrev.markup"/>
|
---|
| 362 | </a>
|
---|
| 363 | </span>
|
---|
| 364 | </xsl:template>
|
---|
| 365 |
|
---|
| 366 | <xsl:template match="book" mode="toc">
|
---|
| 367 | <xsl:param name="toc-context" select="."/>
|
---|
| 368 |
|
---|
| 369 | <xsl:call-template name="subtoc">
|
---|
| 370 | <xsl:with-param name="toc-context" select="$toc-context"/>
|
---|
[15c7d39] | 371 | <xsl:with-param name="nodes" select="part|reference |preface|chapter|appendix |article |topic |bibliography|glossary|index |refentry |bridgehead[$bridgehead.in.toc != 0]"/>
|
---|
[c873d807] | 372 | </xsl:call-template>
|
---|
| 373 | </xsl:template>
|
---|
| 374 |
|
---|
| 375 | <xsl:template match="setindex" mode="toc">
|
---|
| 376 | <xsl:param name="toc-context" select="."/>
|
---|
| 377 |
|
---|
| 378 | <!-- If the setindex tag is not empty, it should be it in the TOC -->
|
---|
| 379 | <xsl:if test="* or $generate.index != 0">
|
---|
| 380 | <xsl:call-template name="subtoc">
|
---|
| 381 | <xsl:with-param name="toc-context" select="$toc-context"/>
|
---|
| 382 | </xsl:call-template>
|
---|
| 383 | </xsl:if>
|
---|
| 384 | </xsl:template>
|
---|
| 385 |
|
---|
| 386 | <xsl:template match="part|reference" mode="toc">
|
---|
| 387 | <xsl:param name="toc-context" select="."/>
|
---|
| 388 |
|
---|
| 389 | <xsl:call-template name="subtoc">
|
---|
| 390 | <xsl:with-param name="toc-context" select="$toc-context"/>
|
---|
[15c7d39] | 391 | <xsl:with-param name="nodes" select="appendix|chapter|article|topic |index|glossary|bibliography |preface|reference|refentry |bridgehead[$bridgehead.in.toc != 0]"/>
|
---|
[c873d807] | 392 | </xsl:call-template>
|
---|
| 393 | </xsl:template>
|
---|
| 394 |
|
---|
[15c7d39] | 395 | <xsl:template match="preface|chapter|appendix|article|topic" mode="toc">
|
---|
[c873d807] | 396 | <xsl:param name="toc-context" select="."/>
|
---|
| 397 |
|
---|
| 398 | <xsl:call-template name="subtoc">
|
---|
| 399 | <xsl:with-param name="toc-context" select="$toc-context"/>
|
---|
[15c7d39] | 400 | <xsl:with-param name="nodes" select="section|sect1 |simplesect[$simplesect.in.toc != 0] |topic |refentry |glossary|bibliography|index |bridgehead[$bridgehead.in.toc != 0]"/>
|
---|
[c873d807] | 401 | </xsl:call-template>
|
---|
| 402 | </xsl:template>
|
---|
| 403 |
|
---|
| 404 | <xsl:template match="sect1" mode="toc">
|
---|
| 405 | <xsl:param name="toc-context" select="."/>
|
---|
| 406 | <xsl:call-template name="subtoc">
|
---|
| 407 | <xsl:with-param name="toc-context" select="$toc-context"/>
|
---|
| 408 | <xsl:with-param name="nodes" select="sect2 |bridgehead[$bridgehead.in.toc != 0]"/>
|
---|
| 409 | </xsl:call-template>
|
---|
| 410 | </xsl:template>
|
---|
| 411 |
|
---|
| 412 | <xsl:template match="sect2" mode="toc">
|
---|
| 413 | <xsl:param name="toc-context" select="."/>
|
---|
| 414 |
|
---|
| 415 | <xsl:call-template name="subtoc">
|
---|
| 416 | <xsl:with-param name="toc-context" select="$toc-context"/>
|
---|
| 417 | <xsl:with-param name="nodes" select="sect3 |bridgehead[$bridgehead.in.toc != 0]"/>
|
---|
| 418 | </xsl:call-template>
|
---|
| 419 | </xsl:template>
|
---|
| 420 |
|
---|
| 421 | <xsl:template match="sect3" mode="toc">
|
---|
| 422 | <xsl:param name="toc-context" select="."/>
|
---|
| 423 |
|
---|
| 424 | <xsl:call-template name="subtoc">
|
---|
| 425 | <xsl:with-param name="toc-context" select="$toc-context"/>
|
---|
| 426 | <xsl:with-param name="nodes" select="sect4 |bridgehead[$bridgehead.in.toc != 0]"/>
|
---|
| 427 | </xsl:call-template>
|
---|
| 428 | </xsl:template>
|
---|
| 429 |
|
---|
| 430 | <xsl:template match="sect4" mode="toc">
|
---|
| 431 | <xsl:param name="toc-context" select="."/>
|
---|
| 432 |
|
---|
| 433 | <xsl:call-template name="subtoc">
|
---|
| 434 | <xsl:with-param name="toc-context" select="$toc-context"/>
|
---|
| 435 | <xsl:with-param name="nodes" select="sect5 |bridgehead[$bridgehead.in.toc != 0]"/>
|
---|
| 436 | </xsl:call-template>
|
---|
| 437 | </xsl:template>
|
---|
| 438 |
|
---|
| 439 | <xsl:template match="sect5" mode="toc">
|
---|
| 440 | <xsl:param name="toc-context" select="."/>
|
---|
| 441 |
|
---|
| 442 | <xsl:call-template name="subtoc">
|
---|
| 443 | <xsl:with-param name="toc-context" select="$toc-context"/>
|
---|
| 444 | </xsl:call-template>
|
---|
| 445 | </xsl:template>
|
---|
| 446 |
|
---|
| 447 | <xsl:template match="simplesect" mode="toc">
|
---|
| 448 | <xsl:param name="toc-context" select="."/>
|
---|
| 449 |
|
---|
| 450 | <xsl:call-template name="subtoc">
|
---|
| 451 | <xsl:with-param name="toc-context" select="$toc-context"/>
|
---|
| 452 | </xsl:call-template>
|
---|
| 453 | </xsl:template>
|
---|
| 454 |
|
---|
| 455 | <xsl:template match="section" mode="toc">
|
---|
| 456 | <xsl:param name="toc-context" select="."/>
|
---|
| 457 |
|
---|
| 458 | <xsl:call-template name="subtoc">
|
---|
| 459 | <xsl:with-param name="toc-context" select="$toc-context"/>
|
---|
[15c7d39] | 460 | <xsl:with-param name="nodes" select="section|refentry |simplesect[$simplesect.in.toc != 0] |bridgehead[$bridgehead.in.toc != 0]"/>
|
---|
| 461 | </xsl:call-template>
|
---|
| 462 | </xsl:template>
|
---|
| 463 |
|
---|
| 464 | <xsl:template match="topic" mode="toc">
|
---|
| 465 | <xsl:param name="toc-context" select="."/>
|
---|
| 466 |
|
---|
| 467 | <xsl:call-template name="subtoc">
|
---|
| 468 | <xsl:with-param name="toc-context" select="$toc-context"/>
|
---|
| 469 | <xsl:with-param name="nodes" select="section|refentry |simplesect[$simplesect.in.toc != 0] |bridgehead[$bridgehead.in.toc != 0]"/>
|
---|
[c873d807] | 470 | </xsl:call-template>
|
---|
| 471 | </xsl:template>
|
---|
| 472 |
|
---|
| 473 | <xsl:template match="bridgehead" mode="toc">
|
---|
| 474 | <xsl:param name="toc-context" select="."/>
|
---|
| 475 |
|
---|
| 476 | <xsl:if test="$bridgehead.in.toc != 0">
|
---|
| 477 | <xsl:call-template name="subtoc">
|
---|
| 478 | <xsl:with-param name="toc-context" select="$toc-context"/>
|
---|
| 479 | </xsl:call-template>
|
---|
| 480 | </xsl:if>
|
---|
| 481 | </xsl:template>
|
---|
| 482 |
|
---|
| 483 | <xsl:template match="bibliography|glossary" mode="toc">
|
---|
| 484 | <xsl:param name="toc-context" select="."/>
|
---|
| 485 |
|
---|
| 486 | <xsl:call-template name="subtoc">
|
---|
| 487 | <xsl:with-param name="toc-context" select="$toc-context"/>
|
---|
| 488 | </xsl:call-template>
|
---|
| 489 | </xsl:template>
|
---|
| 490 |
|
---|
| 491 | <xsl:template match="index" mode="toc">
|
---|
| 492 | <xsl:param name="toc-context" select="."/>
|
---|
| 493 |
|
---|
| 494 | <!-- If the index tag is not empty, it should be it in the TOC -->
|
---|
| 495 | <xsl:if test="* or $generate.index != 0">
|
---|
| 496 | <xsl:call-template name="subtoc">
|
---|
| 497 | <xsl:with-param name="toc-context" select="$toc-context"/>
|
---|
| 498 | </xsl:call-template>
|
---|
| 499 | </xsl:if>
|
---|
| 500 | </xsl:template>
|
---|
| 501 |
|
---|
| 502 | <xsl:template match="refentry" mode="toc">
|
---|
| 503 | <xsl:param name="toc-context" select="."/>
|
---|
| 504 |
|
---|
| 505 | <xsl:variable name="refmeta" select=".//refmeta"/>
|
---|
| 506 | <xsl:variable name="refentrytitle" select="$refmeta//refentrytitle"/>
|
---|
| 507 | <xsl:variable name="refnamediv" select=".//refnamediv"/>
|
---|
| 508 | <xsl:variable name="refname" select="$refnamediv//refname"/>
|
---|
| 509 | <xsl:variable name="refdesc" select="$refnamediv//refdescriptor"/>
|
---|
| 510 | <xsl:variable name="title">
|
---|
| 511 | <xsl:choose>
|
---|
| 512 | <xsl:when test="$refentrytitle">
|
---|
| 513 | <xsl:apply-templates select="$refentrytitle[1]" mode="titleabbrev.markup"/>
|
---|
| 514 | </xsl:when>
|
---|
| 515 | <xsl:when test="$refdesc">
|
---|
| 516 | <xsl:apply-templates select="$refdesc" mode="titleabbrev.markup"/>
|
---|
| 517 | </xsl:when>
|
---|
| 518 | <xsl:when test="$refname">
|
---|
| 519 | <xsl:apply-templates select="$refname[1]" mode="titleabbrev.markup"/>
|
---|
| 520 | </xsl:when>
|
---|
| 521 | </xsl:choose>
|
---|
| 522 | </xsl:variable>
|
---|
| 523 |
|
---|
| 524 | <xsl:element name="{$toc.listitem.type}" namespace="http://www.w3.org/1999/xhtml">
|
---|
| 525 | <span class="refentrytitle">
|
---|
| 526 | <a>
|
---|
| 527 | <xsl:attribute name="href">
|
---|
[60a5a938] | 528 | <xsl:call-template name="href.target">
|
---|
| 529 | <xsl:with-param name="toc-context" select="$toc-context"/>
|
---|
| 530 | </xsl:call-template>
|
---|
[c873d807] | 531 | </xsl:attribute>
|
---|
| 532 | <xsl:copy-of select="$title"/>
|
---|
| 533 | </a>
|
---|
| 534 | </span>
|
---|
| 535 | <span class="refpurpose">
|
---|
| 536 | <xsl:if test="$annotate.toc != 0">
|
---|
| 537 | <!-- * DocBook 5 says inlinemediaobject (among other things) -->
|
---|
| 538 | <!-- * is allowed in refpurpose; so we need to run -->
|
---|
| 539 | <!-- * apply-templates on refpurpose here, instead of value-of -->
|
---|
[15c7d39] | 540 | <xsl:apply-templates select="refnamediv/refpurpose" mode="no.anchor.mode"/>
|
---|
[c873d807] | 541 | </xsl:if>
|
---|
| 542 | </span>
|
---|
| 543 | </xsl:element>
|
---|
| 544 | </xsl:template>
|
---|
| 545 |
|
---|
| 546 | <xsl:template match="title" mode="toc">
|
---|
| 547 | <xsl:param name="toc-context" select="."/>
|
---|
| 548 |
|
---|
| 549 | <a>
|
---|
| 550 | <xsl:attribute name="href">
|
---|
| 551 | <xsl:call-template name="href.target">
|
---|
| 552 | <xsl:with-param name="object" select=".."/>
|
---|
[60a5a938] | 553 | <xsl:with-param name="toc-context" select="$toc-context"/>
|
---|
[c873d807] | 554 | </xsl:call-template>
|
---|
| 555 | </xsl:attribute>
|
---|
| 556 | <xsl:apply-templates/>
|
---|
| 557 | </a>
|
---|
| 558 | </xsl:template>
|
---|
| 559 |
|
---|
| 560 | <xsl:template name="manual-toc">
|
---|
| 561 | <xsl:param name="toc-context" select="."/>
|
---|
| 562 | <xsl:param name="tocentry"/>
|
---|
[15c7d39] | 563 | <xsl:param name="toc.title.p" select="true()"/>
|
---|
| 564 | <xsl:param name="nodes" select="/NOT-AN-ELEMENT"/>
|
---|
[c873d807] | 565 |
|
---|
| 566 | <!-- be careful, we don't want to change the current document to the other tree! -->
|
---|
| 567 |
|
---|
| 568 | <xsl:if test="$tocentry">
|
---|
| 569 | <xsl:variable name="node" select="key('id', $tocentry/@linkend)"/>
|
---|
| 570 |
|
---|
| 571 | <xsl:element name="{$toc.listitem.type}" namespace="http://www.w3.org/1999/xhtml">
|
---|
| 572 | <xsl:variable name="label">
|
---|
| 573 | <xsl:apply-templates select="$node" mode="label.markup"/>
|
---|
| 574 | </xsl:variable>
|
---|
| 575 | <xsl:copy-of select="$label"/>
|
---|
| 576 | <xsl:if test="$label != ''">
|
---|
| 577 | <xsl:value-of select="$autotoc.label.separator"/>
|
---|
| 578 | </xsl:if>
|
---|
| 579 | <a>
|
---|
| 580 | <xsl:attribute name="href">
|
---|
| 581 | <xsl:call-template name="href.target">
|
---|
| 582 | <xsl:with-param name="object" select="$node"/>
|
---|
[60a5a938] | 583 | <xsl:with-param name="toc-context" select="$toc-context"/>
|
---|
[c873d807] | 584 | </xsl:call-template>
|
---|
| 585 | </xsl:attribute>
|
---|
| 586 | <xsl:apply-templates select="$node" mode="titleabbrev.markup"/>
|
---|
| 587 | </a>
|
---|
| 588 | </xsl:element>
|
---|
| 589 |
|
---|
| 590 | <xsl:if test="$tocentry/*">
|
---|
| 591 | <xsl:element name="{$toc.list.type}" namespace="http://www.w3.org/1999/xhtml">
|
---|
[15c7d39] | 592 | <xsl:call-template name="toc.list.attributes">
|
---|
| 593 | <xsl:with-param name="toc-context" select="$toc-context"/>
|
---|
| 594 | <xsl:with-param name="toc.title.p" select="$toc.title.p"/>
|
---|
| 595 | <xsl:with-param name="nodes" select="$nodes"/>
|
---|
| 596 | </xsl:call-template>
|
---|
[c873d807] | 597 | <xsl:call-template name="manual-toc">
|
---|
| 598 | <xsl:with-param name="tocentry" select="$tocentry/*[1]"/>
|
---|
| 599 | </xsl:call-template>
|
---|
| 600 | </xsl:element>
|
---|
| 601 | </xsl:if>
|
---|
| 602 |
|
---|
| 603 | <xsl:if test="$tocentry/following-sibling::*">
|
---|
| 604 | <xsl:call-template name="manual-toc">
|
---|
| 605 | <xsl:with-param name="tocentry" select="$tocentry/following-sibling::*[1]"/>
|
---|
| 606 | </xsl:call-template>
|
---|
| 607 | </xsl:if>
|
---|
| 608 | </xsl:if>
|
---|
| 609 | </xsl:template>
|
---|
| 610 |
|
---|
| 611 | <!-- ==================================================================== -->
|
---|
| 612 |
|
---|
| 613 | <xsl:template name="list.of.titles">
|
---|
| 614 | <xsl:param name="toc-context" select="."/>
|
---|
| 615 | <xsl:param name="titles" select="'table'"/>
|
---|
| 616 | <xsl:param name="nodes" select=".//table"/>
|
---|
| 617 |
|
---|
| 618 | <xsl:if test="$nodes">
|
---|
| 619 | <div class="list-of-{$titles}s">
|
---|
[15c7d39] | 620 | <xsl:choose>
|
---|
| 621 | <xsl:when test="$make.clean.html != 0">
|
---|
| 622 | <div class="toc-title">
|
---|
| 623 | <xsl:call-template name="gentext">
|
---|
| 624 | <xsl:with-param name="key">
|
---|
| 625 | <xsl:choose>
|
---|
| 626 | <xsl:when test="$titles='table'">ListofTables</xsl:when>
|
---|
| 627 | <xsl:when test="$titles='figure'">ListofFigures</xsl:when>
|
---|
| 628 | <xsl:when test="$titles='equation'">ListofEquations</xsl:when>
|
---|
| 629 | <xsl:when test="$titles='example'">ListofExamples</xsl:when>
|
---|
| 630 | <xsl:when test="$titles='procedure'">ListofProcedures</xsl:when>
|
---|
| 631 | <xsl:otherwise>ListofUnknown</xsl:otherwise>
|
---|
| 632 | </xsl:choose>
|
---|
| 633 | </xsl:with-param>
|
---|
| 634 | </xsl:call-template>
|
---|
| 635 | </div>
|
---|
| 636 | </xsl:when>
|
---|
| 637 | <xsl:otherwise>
|
---|
| 638 | <p>
|
---|
| 639 | <strong>
|
---|
| 640 | <xsl:call-template name="gentext">
|
---|
| 641 | <xsl:with-param name="key">
|
---|
| 642 | <xsl:choose>
|
---|
| 643 | <xsl:when test="$titles='table'">ListofTables</xsl:when>
|
---|
| 644 | <xsl:when test="$titles='figure'">ListofFigures</xsl:when>
|
---|
| 645 | <xsl:when test="$titles='equation'">ListofEquations</xsl:when>
|
---|
| 646 | <xsl:when test="$titles='example'">ListofExamples</xsl:when>
|
---|
| 647 | <xsl:when test="$titles='procedure'">ListofProcedures</xsl:when>
|
---|
| 648 | <xsl:otherwise>ListofUnknown</xsl:otherwise>
|
---|
| 649 | </xsl:choose>
|
---|
| 650 | </xsl:with-param>
|
---|
| 651 | </xsl:call-template>
|
---|
| 652 | </strong>
|
---|
| 653 | </p>
|
---|
| 654 | </xsl:otherwise>
|
---|
| 655 | </xsl:choose>
|
---|
[c873d807] | 656 |
|
---|
| 657 | <xsl:element name="{$toc.list.type}" namespace="http://www.w3.org/1999/xhtml">
|
---|
| 658 | <xsl:apply-templates select="$nodes" mode="toc">
|
---|
| 659 | <xsl:with-param name="toc-context" select="$toc-context"/>
|
---|
| 660 | </xsl:apply-templates>
|
---|
| 661 | </xsl:element>
|
---|
| 662 | </div>
|
---|
| 663 | </xsl:if>
|
---|
| 664 | </xsl:template>
|
---|
| 665 |
|
---|
| 666 | <xsl:template match="figure|table|example|equation|procedure" mode="toc">
|
---|
| 667 | <xsl:param name="toc-context" select="."/>
|
---|
| 668 |
|
---|
| 669 | <xsl:element name="{$toc.listitem.type}" namespace="http://www.w3.org/1999/xhtml">
|
---|
| 670 | <xsl:variable name="label">
|
---|
| 671 | <xsl:apply-templates select="." mode="label.markup"/>
|
---|
| 672 | </xsl:variable>
|
---|
| 673 | <xsl:copy-of select="$label"/>
|
---|
| 674 | <xsl:if test="$label != ''">
|
---|
| 675 | <xsl:value-of select="$autotoc.label.separator"/>
|
---|
| 676 | </xsl:if>
|
---|
| 677 | <a>
|
---|
| 678 | <xsl:attribute name="href">
|
---|
[60a5a938] | 679 | <xsl:call-template name="href.target">
|
---|
| 680 | <xsl:with-param name="toc-context" select="$toc-context"/>
|
---|
| 681 | </xsl:call-template>
|
---|
[c873d807] | 682 | </xsl:attribute>
|
---|
| 683 | <xsl:apply-templates select="." mode="titleabbrev.markup"/>
|
---|
| 684 | </a>
|
---|
| 685 | </xsl:element>
|
---|
| 686 | </xsl:template>
|
---|
| 687 |
|
---|
| 688 | <!-- Used only if qanda.in.toc parameter is non-zero -->
|
---|
| 689 | <xsl:template match="qandaset" mode="toc">
|
---|
| 690 | <xsl:param name="toc-context" select="."/>
|
---|
| 691 | <xsl:call-template name="subtoc">
|
---|
| 692 | <xsl:with-param name="toc-context" select="$toc-context"/>
|
---|
| 693 | <xsl:with-param name="nodes" select="qandadiv | qandaentry"/>
|
---|
| 694 | </xsl:call-template>
|
---|
| 695 | </xsl:template>
|
---|
| 696 |
|
---|
| 697 | <xsl:template match="qandadiv|qandaentry" mode="toc">
|
---|
| 698 | <xsl:apply-templates select="." mode="qandatoc.mode"/>
|
---|
| 699 | </xsl:template>
|
---|
| 700 |
|
---|
[15c7d39] | 701 | </xsl:stylesheet> |
---|