cvsimport
[fvwm.git] / doc / docbook-xsl / html / index.xsl
blob35d1ef49f1a8363e15f9d459a02d4659e59873b6
1 <?xml version='1.0'?>
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 version='1.0'>
5 <!-- ********************************************************************
6 $Id: index.xsl,v 1.1 2007/03/10 05:15:13 scott Exp $
7 ********************************************************************
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.
13 ******************************************************************** -->
15 <!-- ==================================================================== -->
17 <xsl:template match="index">
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. -->
24 <xsl:call-template name="id.warning"/>
26 <xsl:if test="count(*)>0 or $generate.index != '0'">
27 <div>
28 <xsl:apply-templates select="." mode="class.attribute"/>
29 <xsl:if test="$generate.id.attributes != 0">
30 <xsl:attribute name="id">
31 <xsl:call-template name="object.id"/>
32 </xsl:attribute>
33 </xsl:if>
35 <xsl:call-template name="index.titlepage"/>
36 <xsl:choose>
37 <xsl:when test="indexdiv">
38 <xsl:apply-templates/>
39 </xsl:when>
40 <xsl:otherwise>
41 <xsl:apply-templates select="*[not(self::indexentry)]"/>
42 <!-- Because it's actually valid for Index to have neither any -->
43 <!-- Indexdivs nor any Indexentries, we need to check and make -->
44 <!-- sure that at least one Indexentry exists, and generate a -->
45 <!-- wrapper dl if there is at least one; otherwise, do nothing. -->
46 <xsl:if test="indexentry">
47 <!-- The indexentry template assumes a parent dl wrapper has -->
48 <!-- been generated; for Indexes that have Indexdivs, the dl -->
49 <!-- wrapper is generated by the indexdiv template; however, -->
50 <!-- for Indexes that lack Indexdivs, if we don't generate a -->
51 <!-- dl here, HTML output will not be valid. -->
52 <dl>
53 <xsl:apply-templates select="indexentry"/>
54 </dl>
55 </xsl:if>
56 </xsl:otherwise>
57 </xsl:choose>
59 <xsl:if test="count(indexentry) = 0 and count(indexdiv) = 0">
60 <xsl:call-template name="generate-index">
61 <xsl:with-param name="scope" select="(ancestor::book|/)[last()]"/>
62 </xsl:call-template>
63 </xsl:if>
65 <xsl:if test="not(parent::article)">
66 <xsl:call-template name="process.footnotes"/>
67 </xsl:if>
68 </div>
69 </xsl:if>
70 </xsl:template>
72 <xsl:template match="setindex">
73 <!-- some implementations use completely empty index tags to indicate -->
74 <!-- where an automatically generated index should be inserted. so -->
75 <!-- if the index is completely empty, skip it. Unless generate.index -->
76 <!-- is non-zero, in which case, this is where the automatically -->
77 <!-- generated index should go. -->
79 <xsl:call-template name="id.warning"/>
81 <xsl:if test="count(*)>0 or $generate.index != '0'">
82 <div>
83 <xsl:apply-templates select="." mode="class.attribute"/>
84 <xsl:if test="$generate.id.attributes != 0">
85 <xsl:attribute name="id">
86 <xsl:call-template name="object.id"/>
87 </xsl:attribute>
88 </xsl:if>
90 <xsl:call-template name="setindex.titlepage"/>
91 <xsl:apply-templates/>
93 <xsl:if test="count(indexentry) = 0 and count(indexdiv) = 0">
94 <xsl:call-template name="generate-index">
95 <xsl:with-param name="scope" select="/"/>
96 </xsl:call-template>
97 </xsl:if>
99 <xsl:if test="not(parent::article)">
100 <xsl:call-template name="process.footnotes"/>
101 </xsl:if>
102 </div>
103 </xsl:if>
104 </xsl:template>
106 <xsl:template match="index/indexinfo"></xsl:template>
107 <xsl:template match="index/info"></xsl:template>
108 <xsl:template match="index/title"></xsl:template>
109 <xsl:template match="index/subtitle"></xsl:template>
110 <xsl:template match="index/titleabbrev"></xsl:template>
112 <!-- ==================================================================== -->
114 <xsl:template match="indexdiv">
115 <xsl:call-template name="id.warning"/>
117 <div>
118 <xsl:apply-templates select="." mode="class.attribute"/>
119 <xsl:if test="$generate.id.attributes != 0">
120 <xsl:attribute name="id">
121 <xsl:call-template name="object.id"/>
122 </xsl:attribute>
123 </xsl:if>
125 <xsl:call-template name="anchor"/>
126 <xsl:apply-templates select="*[not(self::indexentry)]"/>
127 <dl>
128 <xsl:apply-templates select="indexentry"/>
129 </dl>
130 </div>
131 </xsl:template>
133 <xsl:template match="indexdiv/title">
134 <h3>
135 <xsl:apply-templates select="." mode="class.attribute"/>
136 <xsl:apply-templates/>
137 </h3>
138 </xsl:template>
140 <!-- ==================================================================== -->
142 <xsl:template match="indexterm">
143 <!-- this one must have a name, even if it doesn't have an ID -->
144 <xsl:variable name="id">
145 <xsl:call-template name="object.id"/>
146 </xsl:variable>
148 <a class="indexterm" name="{$id}"/>
149 </xsl:template>
151 <xsl:template match="primary|secondary|tertiary|see|seealso">
152 </xsl:template>
154 <!-- ==================================================================== -->
156 <xsl:template match="indexentry">
157 <xsl:apply-templates select="primaryie"/>
158 </xsl:template>
160 <xsl:template match="primaryie">
161 <dt>
162 <xsl:apply-templates/>
163 </dt>
164 <xsl:choose>
165 <xsl:when test="following-sibling::secondaryie">
166 <dd>
167 <dl>
168 <xsl:apply-templates select="following-sibling::secondaryie"/>
169 </dl>
170 </dd>
171 </xsl:when>
172 <xsl:when test="following-sibling::seeie
173 |following-sibling::seealsoie">
174 <dd>
175 <dl>
176 <xsl:apply-templates select="following-sibling::seeie
177 |following-sibling::seealsoie"/>
178 </dl>
179 </dd>
180 </xsl:when>
181 </xsl:choose>
182 </xsl:template>
184 <xsl:template match="secondaryie">
185 <dt>
186 <xsl:apply-templates/>
187 </dt>
188 <xsl:choose>
189 <xsl:when test="following-sibling::tertiaryie">
190 <dd>
191 <dl>
192 <xsl:apply-templates select="following-sibling::tertiaryie"/>
193 </dl>
194 </dd>
195 </xsl:when>
196 <xsl:when test="following-sibling::seeie
197 |following-sibling::seealsoie">
198 <dd>
199 <dl>
200 <xsl:apply-templates select="following-sibling::seeie
201 |following-sibling::seealsoie"/>
202 </dl>
203 </dd>
204 </xsl:when>
205 </xsl:choose>
206 </xsl:template>
208 <xsl:template match="tertiaryie">
209 <dt>
210 <xsl:apply-templates/>
211 </dt>
212 <xsl:if test="following-sibling::seeie
213 |following-sibling::seealsoie">
214 <dd>
215 <dl>
216 <xsl:apply-templates select="following-sibling::seeie
217 |following-sibling::seealsoie"/>
218 </dl>
219 </dd>
220 </xsl:if>
221 </xsl:template>
223 <xsl:template match="seeie|seealsoie">
224 <dt>
225 <xsl:apply-templates/>
226 </dt>
227 </xsl:template>
229 </xsl:stylesheet>