1<?xml version='1.0'?> 2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 3 version='1.0'> 4 5<!-- ******************************************************************** 6 $Id$ 7 ******************************************************************** 8 9 This file is part of the XSL DocBook Stylesheet distribution. 10 See /README or http://nwalsh.com/docbook/xsl/ for copyright 11 and other information. 12 13 ******************************************************************** --> 14 15<!-- ==================================================================== --> 16 17<xsl:template match="index|setindex"> 18 <!-- some implementations use completely empty index tags to indicate --> 19 <!-- where an automatically generated index should be inserted. so --> 20 <!-- if the index is completely empty, skip it. Unless generate.index --> 21 <!-- is non-zero, in which case, this is where the automatically --> 22 <!-- generated index should go. --> 23 24 <xsl:if test="count(*)>0 or $generate.index != '0'"> 25 <xsl:variable name="id"> 26 <xsl:call-template name="object.id"/> 27 </xsl:variable> 28 29 <div id="{$id}" class="{name(.)}"> 30 <xsl:call-template name="index.titlepage"/> 31 <xsl:apply-templates/> 32 33 <xsl:if test="count(indexentry) = 0 and count(indexdiv) = 0"> 34 <xsl:call-template name="generate-index"/> 35 </xsl:if> 36 37 <xsl:call-template name="process.footnotes"/> 38 </div> 39 </xsl:if> 40</xsl:template> 41 42<xsl:template match="index/title"></xsl:template> 43<xsl:template match="index/subtitle"></xsl:template> 44<xsl:template match="index/titleabbrev"></xsl:template> 45 46<xsl:template match="index/title" mode="component.title.mode"> 47 <xsl:variable name="id"> 48 <xsl:call-template name="object.id"> 49 <xsl:with-param name="object" select=".."/> 50 </xsl:call-template> 51 </xsl:variable> 52 <h2 class="title"> 53 <a name="{$id}"> 54 <xsl:apply-templates/> 55 </a> 56 </h2> 57</xsl:template> 58 59<xsl:template match="index/subtitle" mode="component.title.mode"> 60 <h3> 61 <i><xsl:apply-templates/></i> 62 </h3> 63</xsl:template> 64 65<!-- ==================================================================== --> 66 67<xsl:template match="indexdiv"> 68 <div class="{name(.)}"> 69 <xsl:apply-templates mode="not-indexentrys"/> 70 <dl> 71 <xsl:apply-templates select="indexentry"/> 72 </dl> 73 </div> 74</xsl:template> 75 76<xsl:template match="indexentry" mode="not-indexentrys"> 77 <!-- suppress --> 78</xsl:template> 79 80<xsl:template match="indexdiv/title"> 81 <xsl:variable name="id"> 82 <xsl:call-template name="object.id"> 83 <xsl:with-param name="object" select=".."/> 84 </xsl:call-template> 85 </xsl:variable> 86 <h3 class="{name(.)}"> 87 <a name="{$id}"> 88 <xsl:apply-templates/> 89 </a> 90 </h3> 91</xsl:template> 92 93<!-- ==================================================================== --> 94 95<xsl:template match="indexterm"> 96 <xsl:variable name="id"> 97 <xsl:call-template name="object.id"/> 98 </xsl:variable> 99 100 <a class="indexterm" name="{$id}"/> 101</xsl:template> 102 103<xsl:template match="primary|secondary|tertiary|see|seealso"> 104</xsl:template> 105 106<!-- ==================================================================== --> 107 108<xsl:template match="indexentry"> 109 <xsl:apply-templates select="primaryie"/> 110</xsl:template> 111 112<xsl:template match="primaryie"> 113 <dt> 114 <xsl:apply-templates/> 115 </dt> 116 <xsl:choose> 117 <xsl:when test="following-sibling::secondaryie"> 118 <dd> 119 <dl> 120 <xsl:apply-templates select="following-sibling::secondaryie"/> 121 </dl> 122 </dd> 123 </xsl:when> 124 <xsl:when test="following-sibling::seeie 125 |following-sibling::seealsoie"> 126 <dd> 127 <dl> 128 <xsl:apply-templates select="following-sibling::seeie 129 |following-sibling::seealsoie"/> 130 </dl> 131 </dd> 132 </xsl:when> 133 </xsl:choose> 134</xsl:template> 135 136<xsl:template match="secondaryie"> 137 <dt> 138 <xsl:apply-templates/> 139 </dt> 140 <xsl:choose> 141 <xsl:when test="following-sibling::tertiaryie"> 142 <dd> 143 <dl> 144 <xsl:apply-templates select="following-sibling::tertiaryie"/> 145 </dl> 146 </dd> 147 </xsl:when> 148 <xsl:when test="following-sibling::seeie 149 |following-sibling::seealsoie"> 150 <dd> 151 <dl> 152 <xsl:apply-templates select="following-sibling::seeie 153 |following-sibling::seealsoie"/> 154 </dl> 155 </dd> 156 </xsl:when> 157 </xsl:choose> 158</xsl:template> 159 160<xsl:template match="tertiaryie"> 161 <dt> 162 <xsl:apply-templates/> 163 </dt> 164 <xsl:if test="following-sibling::seeie 165 |following-sibling::seealsoie"> 166 <dd> 167 <dl> 168 <xsl:apply-templates select="following-sibling::seeie 169 |following-sibling::seealsoie"/> 170 </dl> 171 </dd> 172 </xsl:if> 173</xsl:template> 174 175<xsl:template match="seeie|seealsoie"> 176 <dt> 177 <xsl:apply-templates/> 178 </dt> 179</xsl:template> 180 181<xsl:template name="generate-index"> 182 <!-- nop: use autoidx.xsl to get automatic indexing --> 183</xsl:template> 184 185</xsl:stylesheet> 186