]> git.evergreen-ils.org Git - working/Evergreen.git/blob - stylesheets/evergreen_docbook_files/docbook-xsl-1.75.2/xhtml-1_1/index.xsl
Add stylesheets for our evergreen docbook site.
[working/Evergreen.git] / stylesheets / evergreen_docbook_files / docbook-xsl-1.75.2 / xhtml-1_1 / index.xsl
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: index.xsl 8421 2009-05-04 07:49:49Z bobstayton $
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(*)&gt;0 or $generate.index != '0'">
28     <div>
29       <xsl:apply-templates select="." mode="common.html.attributes"/>
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(*)&gt;0 or $generate.index != '0'">
83     <div>
84       <xsl:apply-templates select="." mode="common.html.attributes"/>
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="common.html.attributes"/>
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="common.html.attributes"/>
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   <dd>
166     <xsl:apply-templates select="following-sibling::seeie                                    [not(preceding-sibling::secondaryie)]" mode="indexentry"/>
167     <xsl:apply-templates select="following-sibling::seealsoie                                    [not(preceding-sibling::secondaryie)]" mode="indexentry"/>
168     <xsl:apply-templates select="following-sibling::secondaryie" mode="indexentry"/>
169   </dd>
170 </xsl:template>
171
172 <!-- Handled in mode to convert flat list to structured output -->
173 <xsl:template match="secondaryie">
174 </xsl:template>
175 <xsl:template match="tertiaryie">
176 </xsl:template>
177 <xsl:template match="seeie|seealsoie">
178 </xsl:template>
179
180 <xsl:template match="secondaryie" mode="indexentry">
181   <dl>
182     <dt>
183       <xsl:apply-templates/>
184     </dt>
185     <dd>
186       <!-- select following see* elements up to next secondaryie or tertiary or end -->
187       <xsl:variable name="after.this" select="following-sibling::*"/>
188       <xsl:variable name="next.entry" select="(following-sibling::secondaryie|following-sibling::tertiaryie)[1]"/>
189       <xsl:variable name="before.entry" select="$next.entry/preceding-sibling::*"/>
190       <xsl:variable name="see.intersection" select="$after.this[count(.|$before.entry) = count($before.entry)]                                 [self::seeie or self::seealsoie]"/>
191       <xsl:choose>
192         <xsl:when test="count($see.intersection) != 0">
193           <xsl:apply-templates select="$see.intersection" mode="indexentry"/>
194         </xsl:when>
195         <xsl:when test="count($next.entry) = 0">
196           <xsl:apply-templates select="following-sibling::seeie" mode="indexentry"/>
197           <xsl:apply-templates select="following-sibling::seealsoie" mode="indexentry"/>
198         </xsl:when>
199       </xsl:choose>
200
201       <!-- now process any tertiaryie before the next secondaryie -->
202       <xsl:variable name="before.next.secondary" select="following-sibling::secondaryie[1]/preceding-sibling::*"/>
203       <xsl:variable name="tertiary.intersection" select="$after.this[count(.|$before.next.secondary) =                                   count($before.next.secondary)]                                 [not(self::seeie) and not(self::seealsoie)]"/>
204       <xsl:choose>
205         <xsl:when test="count($tertiary.intersection) != 0">
206           <xsl:apply-templates select="$tertiary.intersection" mode="indexentry"/>
207         </xsl:when>
208         <xsl:when test="not(following-sibling::secondaryie)">
209           <xsl:apply-templates select="following-sibling::tertiaryie" mode="indexentry"/>
210         </xsl:when>
211       </xsl:choose>
212     </dd>
213   </dl>
214 </xsl:template>
215
216 <xsl:template match="tertiaryie" mode="indexentry">
217   <dl>
218     <dt>
219       <xsl:apply-templates/>
220     </dt>
221     <dd>
222       <!-- select following see* elements up to next secondaryie or tertiary or end -->
223       <xsl:variable name="after.this" select="following-sibling::*"/>
224       <xsl:variable name="next.entry" select="(following-sibling::secondaryie|following-sibling::tertiaryie)[1]"/>
225       <xsl:variable name="before.entry" select="$next.entry/preceding-sibling::*"/>
226       <xsl:variable name="see.intersection" select="$after.this[count(.|$before.entry) = count($before.entry)]                                 [self::seeie or self::seealsoie]"/>
227       <xsl:choose>
228         <xsl:when test="count($see.intersection) != 0">
229           <xsl:apply-templates select="$see.intersection" mode="indexentry"/>
230         </xsl:when>
231         <xsl:when test="count($next.entry) = 0">
232           <xsl:apply-templates select="following-sibling::seeie" mode="indexentry"/>
233           <xsl:apply-templates select="following-sibling::seealsoie" mode="indexentry"/>
234         </xsl:when>
235       </xsl:choose>
236     </dd>
237   </dl>
238 </xsl:template>
239
240 <xsl:template match="seeie" mode="indexentry">
241   <dt>
242     <xsl:text>(</xsl:text>
243     <xsl:call-template name="gentext">
244       <xsl:with-param name="key" select="'see'"/>
245     </xsl:call-template>
246     <xsl:text> </xsl:text>
247     <xsl:apply-templates/>
248     <xsl:text>)</xsl:text>
249   </dt>
250 </xsl:template>
251
252 <xsl:template match="seealsoie" mode="indexentry">
253   <div>
254     <xsl:text>(</xsl:text>
255     <xsl:call-template name="gentext">
256       <xsl:with-param name="key" select="'seealso'"/>
257     </xsl:call-template>
258     <xsl:text> </xsl:text>
259     <xsl:apply-templates/>
260     <xsl:text>)</xsl:text>
261   </div>
262 </xsl:template>
263
264 </xsl:stylesheet>