1 <?xml version="1.0" encoding="ASCII"?><!--This file was created automatically by html2xhtml--><!--from the HTML stylesheets.--><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:d="http://docbook.org/ns/docbook" xmlns="http://www.w3.org/1999/xhtml" exclude-result-prefixes="d" version="1.0">
3 <!-- ********************************************************************
5 This file is part of the XSL DocBook Stylesheet distribution.
6 See ../README or http://cdn.docbook.org/release/xsl/current/ for
7 copyright and other information.
9 ******************************************************************** -->
11 <!-- ==================================================================== -->
13 <xsl:template match="d:index">
14 <!-- some implementations use completely empty index tags to indicate -->
15 <!-- where an automatically generated index should be inserted. so -->
16 <!-- if the index is completely empty, skip it. Unless generate.index -->
17 <!-- is non-zero, in which case, this is where the automatically -->
18 <!-- generated index should go. -->
20 <xsl:call-template name="id.warning"/>
22 <xsl:if test="count(*)>0 or $generate.index != '0'">
24 <xsl:apply-templates select="." mode="common.html.attributes"/>
25 <xsl:call-template name="id.attribute">
26 <xsl:with-param name="conditional" select="0"/>
29 <xsl:call-template name="index.titlepage"/>
31 <xsl:when test="d:indexdiv">
32 <xsl:apply-templates/>
35 <xsl:apply-templates select="*[not(self::d:indexentry)]"/>
36 <!-- Because it's actually valid for Index to have neither any -->
37 <!-- Indexdivs nor any Indexentries, we need to check and make -->
38 <!-- sure that at least one Indexentry exists, and generate a -->
39 <!-- wrapper dl if there is at least one; otherwise, do nothing. -->
40 <xsl:if test="d:indexentry">
41 <!-- The indexentry template assumes a parent dl wrapper has -->
42 <!-- been generated; for Indexes that have Indexdivs, the dl -->
43 <!-- wrapper is generated by the indexdiv template; however, -->
44 <!-- for Indexes that lack Indexdivs, if we don't generate a -->
45 <!-- dl here, HTML output will not be valid. -->
47 <xsl:apply-templates select="d:indexentry"/>
53 <xsl:if test="count(d:indexentry) = 0 and count(d:indexdiv) = 0">
54 <xsl:call-template name="generate-index">
55 <xsl:with-param name="scope" select="(ancestor::d:book|/)[last()]"/>
59 <xsl:if test="not(parent::d:article)">
60 <xsl:call-template name="process.footnotes"/>
66 <xsl:template match="d:setindex">
67 <!-- some implementations use completely empty index tags to indicate -->
68 <!-- where an automatically generated index should be inserted. so -->
69 <!-- if the index is completely empty, skip it. Unless generate.index -->
70 <!-- is non-zero, in which case, this is where the automatically -->
71 <!-- generated index should go. -->
73 <xsl:call-template name="id.warning"/>
75 <xsl:if test="count(*)>0 or $generate.index != '0'">
77 <xsl:apply-templates select="." mode="common.html.attributes"/>
78 <xsl:call-template name="id.attribute">
79 <xsl:with-param name="conditional" select="0"/>
82 <xsl:call-template name="setindex.titlepage"/>
83 <xsl:apply-templates/>
85 <xsl:if test="count(d:indexentry) = 0 and count(d:indexdiv) = 0">
86 <xsl:call-template name="generate-index">
87 <xsl:with-param name="scope" select="/"/>
91 <xsl:if test="not(parent::d:article)">
92 <xsl:call-template name="process.footnotes"/>
98 <xsl:template match="d:index/d:indexinfo"/>
99 <xsl:template match="d:index/d:info"/>
100 <xsl:template match="d:index/d:title"/>
101 <xsl:template match="d:index/d:subtitle"/>
102 <xsl:template match="d:index/d:titleabbrev"/>
104 <!-- ==================================================================== -->
106 <xsl:template match="d:indexdiv">
107 <xsl:call-template name="id.warning"/>
110 <xsl:apply-templates select="." mode="common.html.attributes"/>
111 <xsl:call-template name="id.attribute"/>
112 <xsl:call-template name="anchor"/>
113 <xsl:apply-templates select="*[not(self::d:indexentry)]"/>
115 <xsl:apply-templates select="d:indexentry"/>
120 <xsl:template match="d:indexdiv/d:title">
122 <xsl:apply-templates select="." mode="common.html.attributes"/>
123 <xsl:apply-templates/>
127 <xsl:template match="d:indexdiv/d:subtitle">
129 <xsl:apply-templates select="." mode="common.html.attributes"/>
130 <xsl:apply-templates/>
134 <!-- ==================================================================== -->
136 <xsl:template match="d:indexterm">
137 <!-- this one must have a name, even if it doesn't have an ID -->
138 <xsl:variable name="id">
139 <xsl:call-template name="object.id"/>
142 <a id="{$id}" class="indexterm"/>
145 <xsl:template match="d:primary|d:secondary|d:tertiary|d:see|d:seealso">
148 <!-- ==================================================================== -->
150 <xsl:template match="d:indexentry">
151 <xsl:apply-templates select="d:primaryie"/>
154 <xsl:template match="d:primaryie">
156 <xsl:apply-templates/>
159 <xsl:apply-templates select="following-sibling::d:seeie [not(preceding-sibling::d:secondaryie)]" mode="indexentry"/>
160 <xsl:apply-templates select="following-sibling::d:seealsoie [not(preceding-sibling::d:secondaryie)]" mode="indexentry"/>
161 <xsl:apply-templates select="following-sibling::d:secondaryie" mode="indexentry"/>
165 <!-- Handled in mode to convert flat list to structured output -->
166 <xsl:template match="d:secondaryie">
168 <xsl:template match="d:tertiaryie">
170 <xsl:template match="d:seeie|d:seealsoie">
173 <xsl:template match="d:secondaryie" mode="indexentry">
176 <xsl:apply-templates/>
179 <!-- select following see* elements up to next secondaryie or tertiary or end -->
180 <xsl:variable name="after.this" select="following-sibling::*"/>
181 <xsl:variable name="next.entry" select="(following-sibling::d:secondaryie|following-sibling::d:tertiaryie)[1]"/>
182 <xsl:variable name="before.entry" select="$next.entry/preceding-sibling::*"/>
183 <xsl:variable name="see.intersection" select="$after.this[count(.|$before.entry) = count($before.entry)] [self::d:seeie or self::d:seealsoie]"/>
185 <xsl:when test="count($see.intersection) != 0">
186 <xsl:apply-templates select="$see.intersection" mode="indexentry"/>
188 <xsl:when test="count($next.entry) = 0">
189 <xsl:apply-templates select="following-sibling::d:seeie" mode="indexentry"/>
190 <xsl:apply-templates select="following-sibling::d:seealsoie" mode="indexentry"/>
194 <!-- now process any tertiaryie before the next secondaryie -->
195 <xsl:variable name="before.next.secondary" select="following-sibling::d:secondaryie[1]/preceding-sibling::*"/>
196 <xsl:variable name="tertiary.intersection" select="$after.this[count(.|$before.next.secondary) = count($before.next.secondary)] [not(self::d:seeie) and not(self::d:seealsoie)]"/>
198 <xsl:when test="count($tertiary.intersection) != 0">
199 <xsl:apply-templates select="$tertiary.intersection" mode="indexentry"/>
201 <xsl:when test="not(following-sibling::d:secondaryie)">
202 <xsl:apply-templates select="following-sibling::d:tertiaryie" mode="indexentry"/>
209 <xsl:template match="d:tertiaryie" mode="indexentry">
212 <xsl:apply-templates/>
215 <!-- select following see* elements up to next secondaryie or tertiary or end -->
216 <xsl:variable name="after.this" select="following-sibling::*"/>
217 <xsl:variable name="next.entry" select="(following-sibling::d:secondaryie|following-sibling::d:tertiaryie)[1]"/>
218 <xsl:variable name="before.entry" select="$next.entry/preceding-sibling::*"/>
219 <xsl:variable name="see.intersection" select="$after.this[count(.|$before.entry) = count($before.entry)] [self::d:seeie or self::d:seealsoie]"/>
221 <xsl:when test="count($see.intersection) != 0">
222 <xsl:apply-templates select="$see.intersection" mode="indexentry"/>
224 <xsl:when test="count($next.entry) = 0">
225 <xsl:apply-templates select="following-sibling::d:seeie" mode="indexentry"/>
226 <xsl:apply-templates select="following-sibling::d:seealsoie" mode="indexentry"/>
233 <xsl:template match="d:seeie" mode="indexentry">
235 <xsl:text>(</xsl:text>
236 <xsl:call-template name="gentext">
237 <xsl:with-param name="key" select="'see'"/>
239 <xsl:text> </xsl:text>
240 <xsl:apply-templates/>
241 <xsl:text>)</xsl:text>
245 <xsl:template match="d:seealsoie" mode="indexentry">
247 <xsl:text>(</xsl:text>
248 <xsl:call-template name="gentext">
249 <xsl:with-param name="key" select="'seealso'"/>
251 <xsl:text> </xsl:text>
252 <xsl:apply-templates/>
253 <xsl:text>)</xsl:text>