Rocco Rutte:
[apps/madmutt.git] / doc / xslt / xhtml / index.xsl
1 <?xml version="1.0" encoding="US-ASCII"?>
2 <!--This file was created automatically by html2xhtml-->
3 <!--from the HTML stylesheets. Do not edit this file.-->
4 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" 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 match="index">
19   <!-- some implementations use completely empty index tags to indicate -->
20   <!-- where an automatically generated index should be inserted. so -->
21   <!-- if the index is completely empty, skip it. Unless generate.index -->
22   <!-- is non-zero, in which case, this is where the automatically -->
23   <!-- generated index should go. -->
24
25   <xsl:if test="count(*)&gt;0 or $generate.index != '0'">
26     <div class="{name(.)}">
27       <xsl:if test="$generate.id.attributes != 0">
28         <xsl:attribute name="id">
29           <xsl:call-template name="object.id"/>
30         </xsl:attribute>
31       </xsl:if>
32
33       <xsl:call-template name="index.titlepage"/>
34       <xsl:choose>
35         <xsl:when test="indexdiv">
36           <xsl:apply-templates/>
37         </xsl:when>
38         <xsl:otherwise>
39           <xsl:apply-templates select="*[not(self::indexentry)]"/>
40           <!-- Because it's actually valid for Index to have neither any -->
41           <!-- Indexdivs nor any Indexentries, we need to check and make -->
42           <!-- sure that at least one Indexentry exists, and generate a -->
43           <!-- wrapper dl if there is at least one; otherwise, do nothing. -->
44           <xsl:if test="indexentry">
45             <!-- The indexentry template assumes a parent dl wrapper has -->
46             <!-- been generated; for Indexes that have Indexdivs, the dl -->
47             <!-- wrapper is generated by the indexdiv template; however, -->
48             <!-- for Indexes that lack Indexdivs, if we don't generate a -->
49             <!-- dl here, HTML output will not be valid. -->
50             <dl>
51               <xsl:apply-templates select="indexentry"/>
52             </dl>
53           </xsl:if>
54         </xsl:otherwise>
55       </xsl:choose>
56
57       <xsl:if test="count(indexentry) = 0 and count(indexdiv) = 0">
58         <xsl:call-template name="generate-index">
59           <xsl:with-param name="scope" select="(ancestor::book|/)[last()]"/>
60         </xsl:call-template>
61       </xsl:if>
62
63       <xsl:if test="not(parent::article)">
64         <xsl:call-template name="process.footnotes"/>
65       </xsl:if>
66     </div>
67   </xsl:if>
68 </xsl:template>
69
70 <xsl:template match="setindex">
71   <!-- some implementations use completely empty index tags to indicate -->
72   <!-- where an automatically generated index should be inserted. so -->
73   <!-- if the index is completely empty, skip it. Unless generate.index -->
74   <!-- is non-zero, in which case, this is where the automatically -->
75   <!-- generated index should go. -->
76
77   <xsl:if test="count(*)&gt;0 or $generate.index != '0'">
78     <div class="{name(.)}">
79       <xsl:if test="$generate.id.attributes != 0">
80         <xsl:attribute name="id">
81           <xsl:call-template name="object.id"/>
82         </xsl:attribute>
83       </xsl:if>
84
85       <xsl:call-template name="setindex.titlepage"/>
86       <xsl:apply-templates/>
87
88       <xsl:if test="count(indexentry) = 0 and count(indexdiv) = 0">
89         <xsl:call-template name="generate-index">
90           <xsl:with-param name="scope" select="/"/>
91         </xsl:call-template>
92       </xsl:if>
93
94       <xsl:if test="not(parent::article)">
95         <xsl:call-template name="process.footnotes"/>
96       </xsl:if>
97     </div>
98   </xsl:if>
99 </xsl:template>
100
101 <xsl:template match="index/title"/>
102 <xsl:template match="index/subtitle"/>
103 <xsl:template match="index/titleabbrev"/>
104
105 <!-- ==================================================================== -->
106
107 <xsl:template match="indexdiv">
108   <div class="{name(.)}">
109     <xsl:if test="$generate.id.attributes != 0">
110       <xsl:attribute name="id">
111         <xsl:call-template name="object.id"/>
112       </xsl:attribute>
113     </xsl:if>
114
115     <xsl:call-template name="anchor"/>
116     <xsl:apply-templates select="*[not(self::indexentry)]"/>
117     <dl>
118       <xsl:apply-templates select="indexentry"/>
119     </dl>
120   </div>
121 </xsl:template>
122
123 <xsl:template match="indexdiv/title">
124   <h3 class="{name(.)}">
125     <xsl:apply-templates/>
126   </h3>
127 </xsl:template>
128
129 <!-- ==================================================================== -->
130
131 <xsl:template match="indexterm">
132   <!-- this one must have a name, even if it doesn't have an ID -->
133   <xsl:variable name="id">
134     <xsl:call-template name="object.id"/>
135   </xsl:variable>
136
137   <a id="{$id}" class="indexterm"/>
138 </xsl:template>
139
140 <xsl:template match="primary|secondary|tertiary|see|seealso">
141 </xsl:template>
142
143 <!-- ==================================================================== -->
144
145 <xsl:template match="indexentry">
146   <xsl:apply-templates select="primaryie"/>
147 </xsl:template>
148
149 <xsl:template match="primaryie">
150   <dt>
151     <xsl:apply-templates/>
152   </dt>
153   <xsl:choose>
154     <xsl:when test="following-sibling::secondaryie">
155       <dd>
156         <dl>
157           <xsl:apply-templates select="following-sibling::secondaryie"/>
158         </dl>
159       </dd>
160     </xsl:when>
161     <xsl:when test="following-sibling::seeie                     |following-sibling::seealsoie">
162       <dd>
163         <dl>
164           <xsl:apply-templates select="following-sibling::seeie                                        |following-sibling::seealsoie"/>
165         </dl>
166       </dd>
167     </xsl:when>
168   </xsl:choose>
169 </xsl:template>
170
171 <xsl:template match="secondaryie">
172   <dt>
173     <xsl:apply-templates/>
174   </dt>
175   <xsl:choose>
176     <xsl:when test="following-sibling::tertiaryie">
177       <dd>
178         <dl>
179           <xsl:apply-templates select="following-sibling::tertiaryie"/>
180         </dl>
181       </dd>
182     </xsl:when>
183     <xsl:when test="following-sibling::seeie                     |following-sibling::seealsoie">
184       <dd>
185         <dl>
186           <xsl:apply-templates select="following-sibling::seeie                                        |following-sibling::seealsoie"/>
187         </dl>
188       </dd>
189     </xsl:when>
190   </xsl:choose>
191 </xsl:template>
192
193 <xsl:template match="tertiaryie">
194   <dt>
195     <xsl:apply-templates/>
196   </dt>
197   <xsl:if test="following-sibling::seeie                 |following-sibling::seealsoie">
198     <dd>
199       <dl>
200         <xsl:apply-templates select="following-sibling::seeie                                      |following-sibling::seealsoie"/>
201       </dl>
202     </dd>
203   </xsl:if>
204 </xsl:template>
205
206 <xsl:template match="seeie|seealsoie">
207   <dt>
208     <xsl:apply-templates/>
209   </dt>
210 </xsl:template>
211
212 </xsl:stylesheet>