source: trunk/Distribution/XSL/html/index.xsl@ 2

Last change on this file since 2 was 2, checked in by jkacer, 18 years ago

Added all DocBook Framework stuff:

  • DocBook DTD
  • Transformation software FOP 0.20.5 and Saxon 6
  • XSL styles
  • Rexx scripts

Also added some WarpIN-related stuff for creation of WarpIN installation packages.
This state corresponds to version 1.0.0 from November 2005, just slightly modified to carry versioning information (Rexx scripts).

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