[5d4975d] | 1 | <?xml version='1.0' encoding='ISO-8859-1'?>
|
---|
| 2 |
|
---|
| 3 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
| 4 | xmlns="http://www.w3.org/1999/xhtml"
|
---|
| 5 | version="1.0">
|
---|
[845e9193] | 6 |
|
---|
[276015d2] | 7 | <!--
|
---|
| 8 | $LastChangedBy$
|
---|
| 9 | $Date$
|
---|
| 10 | -->
|
---|
| 11 |
|
---|
[df180b43] | 12 | <!-- General settings -->
|
---|
[5d4975d] | 13 | <xsl:param name="generate.toc">
|
---|
| 14 | appendix toc
|
---|
[df180b43] | 15 | book toc,title
|
---|
[5d4975d] | 16 | chapter nop
|
---|
| 17 | part toc
|
---|
| 18 | preface nop
|
---|
| 19 | qandadiv nop
|
---|
| 20 | qandaset nop
|
---|
| 21 | reference nop
|
---|
| 22 | sect1 nop
|
---|
| 23 | sect2 nop
|
---|
| 24 | sect3 nop
|
---|
| 25 | sect4 nop
|
---|
| 26 | sect5 nop
|
---|
| 27 | section nop
|
---|
| 28 | set nop
|
---|
| 29 | </xsl:param>
|
---|
| 30 |
|
---|
| 31 | <xsl:param name="toc.section.depth">1</xsl:param>
|
---|
| 32 |
|
---|
| 33 | <xsl:param name="toc.max.depth">3</xsl:param>
|
---|
[845e9193] | 34 |
|
---|
[df180b43] | 35 | <!-- Making the TOC -->
|
---|
| 36 | <xsl:template name="make.toc">
|
---|
[5d4975d] | 37 | <xsl:param name="toc-context" select="."/>
|
---|
| 38 | <xsl:param name="nodes" select="/NOT-AN-ELEMENT"/>
|
---|
| 39 | <xsl:if test="$nodes">
|
---|
| 40 | <div class="toc">
|
---|
| 41 | <h3>
|
---|
| 42 | <xsl:call-template name="gentext">
|
---|
| 43 | <xsl:with-param name="key">TableofContents</xsl:with-param>
|
---|
| 44 | </xsl:call-template>
|
---|
| 45 | </h3>
|
---|
| 46 | <ul>
|
---|
| 47 | <xsl:apply-templates select="$nodes" mode="toc">
|
---|
| 48 | <xsl:with-param name="toc-context" select="$toc-context"/>
|
---|
| 49 | </xsl:apply-templates>
|
---|
| 50 | </ul>
|
---|
| 51 | </div>
|
---|
| 52 | </xsl:if>
|
---|
| 53 | </xsl:template>
|
---|
[845e9193] | 54 |
|
---|
[5d4975d] | 55 | <!-- Making the subtocs -->
|
---|
| 56 | <xsl:template name="subtoc">
|
---|
| 57 | <xsl:param name="toc-context" select="."/>
|
---|
| 58 | <xsl:param name="nodes" select="NOT-AN-ELEMENT"/>
|
---|
| 59 | <xsl:variable name="subtoc">
|
---|
| 60 | <ul>
|
---|
| 61 | <xsl:apply-templates mode="toc" select="$nodes">
|
---|
| 62 | <xsl:with-param name="toc-context" select="$toc-context"/>
|
---|
| 63 | </xsl:apply-templates>
|
---|
| 64 | </ul>
|
---|
| 65 | </xsl:variable>
|
---|
| 66 | <xsl:variable name="depth">
|
---|
| 67 | <xsl:choose>
|
---|
| 68 | <xsl:when test="local-name(.) = 'sect1'">1</xsl:when>
|
---|
| 69 | <xsl:otherwise>0</xsl:otherwise>
|
---|
| 70 | </xsl:choose>
|
---|
| 71 | </xsl:variable>
|
---|
| 72 | <xsl:variable name="depth.from.context"
|
---|
| 73 | select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
|
---|
| 74 | <li class="{name(.)}">
|
---|
| 75 | <xsl:call-template name="toc.line">
|
---|
| 76 | <xsl:with-param name="toc-context" select="$toc-context"/>
|
---|
| 77 | </xsl:call-template>
|
---|
[df180b43] | 78 | <xsl:if test="$toc.section.depth > $depth and count($nodes)>0
|
---|
| 79 | and $toc.max.depth > $depth.from.context">
|
---|
[5d4975d] | 80 | <xsl:copy-of select="$subtoc"/>
|
---|
| 81 | </xsl:if>
|
---|
| 82 | </li>
|
---|
| 83 | </xsl:template>
|
---|
| 84 |
|
---|
[41a6268] | 85 | <!--Adding the h* tags -->
|
---|
[5d4975d] | 86 | <xsl:template name="toc.line">
|
---|
| 87 | <xsl:param name="toc-context" select="."/>
|
---|
| 88 | <xsl:param name="depth" select="1"/>
|
---|
| 89 | <xsl:param name="depth.from.context" select="8"/>
|
---|
| 90 | <xsl:choose>
|
---|
| 91 | <xsl:when test="local-name(.) = 'sect1'">
|
---|
[d5a426b] | 92 | <xsl:choose>
|
---|
| 93 | <xsl:when test="@role='dummy'">
|
---|
| 94 | <span class="dummy">
|
---|
| 95 | <xsl:apply-templates select="." mode="titleabbrev.markup"/>
|
---|
| 96 | </span>
|
---|
| 97 | </xsl:when>
|
---|
| 98 | <xsl:otherwise>
|
---|
| 99 | <a>
|
---|
| 100 | <xsl:attribute name="href">
|
---|
| 101 | <xsl:call-template name="href.target">
|
---|
| 102 | <xsl:with-param name="context" select="$toc-context"/>
|
---|
| 103 | </xsl:call-template>
|
---|
| 104 | </xsl:attribute>
|
---|
| 105 | <xsl:apply-templates select="." mode="titleabbrev.markup"/>
|
---|
| 106 | </a>
|
---|
| 107 | </xsl:otherwise>
|
---|
| 108 | </xsl:choose>
|
---|
[5d4975d] | 109 | </xsl:when>
|
---|
| 110 | <xsl:when test="local-name(.) = 'chapter' or local-name(.) = 'preface'">
|
---|
| 111 | <h4>
|
---|
[41a6268] | 112 | <a>
|
---|
| 113 | <xsl:attribute name="href">
|
---|
| 114 | <xsl:call-template name="href.target">
|
---|
| 115 | <xsl:with-param name="context" select="$toc-context"/>
|
---|
| 116 | </xsl:call-template>
|
---|
| 117 | </xsl:attribute>
|
---|
| 118 | <xsl:variable name="label">
|
---|
| 119 | <xsl:apply-templates select="." mode="label.markup"/>
|
---|
| 120 | </xsl:variable>
|
---|
| 121 | <xsl:copy-of select="$label"/>
|
---|
| 122 | <xsl:if test="$label != ''">
|
---|
| 123 | <xsl:value-of select="$autotoc.label.separator"/>
|
---|
| 124 | </xsl:if>
|
---|
| 125 | <xsl:apply-templates select="." mode="titleabbrev.markup"/>
|
---|
| 126 | </a>
|
---|
[5d4975d] | 127 | </h4>
|
---|
| 128 | </xsl:when>
|
---|
| 129 | <xsl:when test="local-name(.) = 'part'">
|
---|
| 130 | <h3>
|
---|
[41a6268] | 131 | <a>
|
---|
| 132 | <xsl:attribute name="href">
|
---|
| 133 | <xsl:call-template name="href.target">
|
---|
| 134 | <xsl:with-param name="context" select="$toc-context"/>
|
---|
| 135 | </xsl:call-template>
|
---|
| 136 | </xsl:attribute>
|
---|
| 137 | <xsl:variable name="label">
|
---|
| 138 | <xsl:apply-templates select="." mode="label.markup"/>
|
---|
| 139 | </xsl:variable>
|
---|
| 140 | <xsl:copy-of select="$label"/>
|
---|
| 141 | <xsl:if test="$label != ''">
|
---|
| 142 | <xsl:value-of select="$autotoc.label.separator"/>
|
---|
| 143 | </xsl:if>
|
---|
| 144 | <xsl:apply-templates select="." mode="titleabbrev.markup"/>
|
---|
| 145 | </a>
|
---|
[5d4975d] | 146 | </h3>
|
---|
| 147 | </xsl:when>
|
---|
| 148 | <xsl:otherwise>
|
---|
| 149 | <h3>
|
---|
| 150 | <a>
|
---|
| 151 | <xsl:attribute name="href">
|
---|
| 152 | <xsl:call-template name="href.target">
|
---|
| 153 | <xsl:with-param name="context" select="$toc-context"/>
|
---|
| 154 | </xsl:call-template>
|
---|
| 155 | </xsl:attribute>
|
---|
| 156 | <xsl:variable name="label">
|
---|
| 157 | <xsl:apply-templates select="." mode="label.markup"/>
|
---|
| 158 | </xsl:variable>
|
---|
| 159 | <xsl:copy-of select="$label"/>
|
---|
| 160 | <xsl:if test="$label != ''">
|
---|
| 161 | <xsl:value-of select="$autotoc.label.separator"/>
|
---|
| 162 | </xsl:if>
|
---|
| 163 | <xsl:apply-templates select="." mode="titleabbrev.markup"/>
|
---|
| 164 | </a>
|
---|
| 165 | </h3>
|
---|
| 166 | </xsl:otherwise>
|
---|
| 167 | </xsl:choose>
|
---|
| 168 | </xsl:template>
|
---|
| 169 |
|
---|
| 170 | </xsl:stylesheet>
|
---|