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