]> granicus.if.org Git - apache/blob - docs/manual/style/xsl/moduleindex.xsl
Update the last year of copyright.
[apache] / docs / manual / style / xsl / moduleindex.xsl
1 <?xml version="1.0"?>
2
3 <!--
4  Copyright 2002-2006 The Apache Software Foundation or its licensors, as
5  applicable.
6
7  Licensed under the Apache License, Version 2.0 (the "License");
8  you may not use this file except in compliance with the License.
9  You may obtain a copy of the License at
10
11      http://www.apache.org/licenses/LICENSE-2.0
12
13  Unless required by applicable law or agreed to in writing, software
14  distributed under the License is distributed on an "AS IS" BASIS,
15  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  See the License for the specific language governing permissions and
17  limitations under the License.
18 -->
19
20 <!DOCTYPE xsl:stylesheet [
21     <!ENTITY lf SYSTEM "util/lf.xml">
22 ]>
23 <xsl:stylesheet version="1.0"
24               xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
25                   xmlns="http://www.w3.org/1999/xhtml">
26
27 <!-- ==================================================================== -->
28 <!-- <moduleindex>                                                        -->
29 <!-- Builds the moduleindex page                                          -->
30 <!-- ==================================================================== -->
31 <xsl:template match="moduleindex">
32 <html xml:lang="{$doclang}" lang="{$doclang}">
33     <xsl:call-template name="head"/>&lf;
34
35     <body id="module-index">
36         <xsl:call-template name="top"/>  
37
38         <div id="page-content">
39             <div id="preamble">
40                 <h1>
41                     <xsl:value-of select="title" />
42                 </h1>&lf;
43
44                 <xsl:call-template name="langavail" />&lf;
45
46                 <xsl:apply-templates select="summary" />
47             </div>&lf; <!-- /#preamble -->
48
49             <xsl:if test="not($is-chm) or seealso">
50                 <div id="quickview">
51                     <xsl:if test="not($is-chm)">
52                         <ul id="toc">&lf;
53                         <li>
54                             <img src="{$path}/images/down.gif" alt="" />
55                             <xsl:text> </xsl:text>
56                             <a href="#core">
57                                 <xsl:value-of select="$message
58                                                       [@id='corefeatures']" />
59                             </a>
60                         </li>
61                         <li>
62                             <img src="{$path}/images/down.gif" alt="" />
63                             <xsl:text> </xsl:text>
64                             <a href="#other">
65                                 <xsl:value-of select="$message
66                                                       [@id='othermodules']" />
67                             </a>
68                         </li>
69                         </ul>
70                     </xsl:if> <!-- !$is-chm -->
71
72                     <xsl:if test="seealso">
73                         <h3>
74                             <xsl:value-of select="$message
75                                                   [@id='seealso']" />
76                         </h3>&lf;            
77
78                         <ul class="seealso">&lf;
79                         <xsl:for-each select="seealso">
80                             <li>
81                                 <xsl:apply-templates />
82                             </li>&lf;
83                         </xsl:for-each>
84                         </ul>
85                     </xsl:if> <!-- /seealso -->
86                 </div> <!-- /#quickview -->
87             </xsl:if>&lf; <!-- have sidebar -->
88
89             <xsl:call-template name="toplink" />&lf;
90
91             <div class="section">
92                 <h2>
93                     <a name="core" id="core">
94                         <xsl:value-of select="$message
95                                               [@id='corefeatures']" />
96                     </a>
97                 </h2>&lf;
98
99                 <!-- core -->
100                 <dl>&lf;
101                 <dt>
102                     <a href="{document(document($allmodules)/modulefilelist
103                               /modulefile[starts-with(., 'core.xml')])
104                               /modulesynopsis/name}.html">
105                         <xsl:value-of
106                             select="document(document($allmodules)/modulefilelist
107                                     /modulefile[starts-with(., 'core.xml')])
108                                     /modulesynopsis/name" />
109                     </a>
110                 </dt>
111                 <dd>
112                     <xsl:apply-templates
113                         select="document(document($allmodules)/modulefilelist
114                                          /modulefile[starts-with(., 'core.xml')])
115                                 /modulesynopsis/description" />
116                 </dd>&lf;
117
118                 <!-- mpm_common -->
119                 <dt>
120                     <a href="{document(document($allmodules)/modulefilelist
121                                        /modulefile[starts-with(., 'mpm_common.xml')])
122                               /modulesynopsis/name}.html">
123                         <xsl:value-of
124                             select="document(document($allmodules)/modulefilelist
125                                              /modulefile[starts-with(., 'mpm_common.xml')])
126                                     /modulesynopsis/name" />
127                     </a>
128                 </dt>
129                 <dd class="separate">
130                     <xsl:apply-templates
131                         select="document(document($allmodules)/modulefilelist
132                                          /modulefile[starts-with(., 'mpm_common.xml')])
133                                 /modulesynopsis/description" />
134                 </dd>&lf;
135
136                 <!-- and now the remaining MPMs -->
137                 <xsl:variable name="mpmmodules"
138                     select="document(document($allmodules)/modulefilelist/modulefile)
139                             /modulesynopsis
140                                 [status='MPM' and name != 'mpm_common']" />
141                 <xsl:variable name="translist">
142                     <xsl:call-template name="module-translist">
143                         <xsl:with-param name="modules" select="$mpmmodules" />
144                     </xsl:call-template>
145                 </xsl:variable>
146
147                 <xsl:for-each select="$mpmmodules">
148                 <xsl:sort select="substring-before(substring-after($translist,
149                     concat('- ', translate(normalize-space(name), $lowercase,
150                     $uppercase), ' ')), ' -')" />
151
152                     <dt>
153                         <a href="{name}.html">
154                             <xsl:value-of select="name" />
155                         </a>
156                     </dt>
157                     <dd>
158                         <xsl:apply-templates select="description" />
159                     </dd>&lf;
160                 </xsl:for-each>
161                 </dl>
162             </div>&lf; <!-- /core section -->
163
164             <xsl:call-template name="toplink" />&lf;
165
166             <div class="section">
167                 <h2>
168                     <a name="other" id="other">
169                         <xsl:value-of select="$message
170                                               [@id='othermodules']" />
171                     </a>
172                 </h2>&lf;
173             
174                 <xsl:variable name="modules"
175                     select="document(document($allmodules)/modulefilelist/modulefile)
176                             /modulesynopsis[status!='MPM' and
177                                             status!='Core']" />
178
179                 <xsl:variable name="start-letters">
180                     <xsl:call-template name="module-startletters">
181                         <xsl:with-param name="modules" select="$modules" />
182                     </xsl:call-template>
183                 </xsl:variable>
184
185                 <p class="letters">
186                     <xsl:call-template name="letter-bar">
187                         <xsl:with-param name="letters" select="$start-letters"/>
188                         <xsl:with-param name="first" select="true()"/>
189                     </xsl:call-template>
190                 </p>&lf;
191
192                 <dl>
193                 <xsl:call-template name="mindex-of-letter">
194                     <xsl:with-param name="letters-todo"
195                         select="$start-letters" />
196                     <xsl:with-param name="modules" select="$modules" />
197                 </xsl:call-template>
198                 </dl>
199             </div> <!-- /modules section -->
200         </div>&lf; <!-- /#page-content -->
201
202         <xsl:call-template name="bottom" />&lf;
203     </body>
204 </html>
205 </xsl:template> 
206 <!-- /moduleindex -->
207
208
209 <!-- ==================================================================== -->
210 <!-- the working horse. builds list items of all modules starting with    -->
211 <!-- one letter when done, it calls itself to catch the next letter       -->
212 <!-- ==================================================================== -->
213 <xsl:template name="mindex-of-letter">
214 <xsl:param name="letters-todo"/>
215 <xsl:param name="modules"/>
216
217 <xsl:variable name="letter" select="substring($letters-todo, 1, 1)" />
218 <xsl:variable name="translist">
219     <xsl:call-template name="module-translist">
220         <xsl:with-param name="modules" select="$modules" />
221     </xsl:call-template>
222 </xsl:variable>
223
224 <xsl:for-each
225     select="$modules[$letter=substring(substring-before(substring-after(
226         $translist, concat('- ', translate(normalize-space(name), $lowercase,
227         $uppercase), ' ')), ' -'), 1, 1)]">
228 <xsl:sort
229     select="substring-before(substring-after($translist, concat('- ',
230         translate(normalize-space(name),$lowercase,$uppercase), ' ')), ' -')" />
231
232     <dt>
233         <a href="{name}.html">
234             <xsl:if test="position() = 1">
235                 <xsl:attribute name="id">
236                     <xsl:value-of select="$letter" />
237                 </xsl:attribute>
238                 <xsl:attribute name="name">
239                     <xsl:value-of select="$letter" />
240                 </xsl:attribute>
241             </xsl:if>
242
243             <xsl:value-of select="name" />
244         </a>
245     </dt>
246     <dd>
247         <xsl:apply-templates select="description" />
248     </dd>&lf;
249 </xsl:for-each> <!-- /directives -->
250
251 <!-- call next letter, if there is -->
252 <xsl:if test="string-length($letters-todo) &gt; 1">
253     <xsl:call-template name="mindex-of-letter">
254         <xsl:with-param name="letters-todo"
255             select="substring($letters-todo, 2)" />
256         <xsl:with-param name="modules" select="$modules" />
257     </xsl:call-template>
258 </xsl:if>
259 </xsl:template>
260 <!-- /mindex-of-letter -->
261
262
263 <!-- ==================================================================== -->
264 <!-- collect start letters of modules                                     -->
265 <!-- ==================================================================== -->
266 <xsl:template name="module-startletters">
267 <xsl:param name="modules" />
268
269 <xsl:variable name="translist">
270     <xsl:call-template name="module-translist">
271         <xsl:with-param name="modules" select="$modules" />
272     </xsl:call-template>
273 </xsl:variable>
274
275 <xsl:call-template name="_squeeze-letters">
276     <xsl:with-param name="lastletter" select="''" />
277     <xsl:with-param name="letters">
278         <xsl:for-each select="$modules">
279         <xsl:sort
280             select="substring-before(substring-after($translist, concat('- ',
281                 translate(normalize-space(name), $lowercase, $uppercase), ' ')),
282                 ' -')" />
283             <xsl:value-of
284                 select="substring(substring-before(substring-after($translist,
285                     concat('- ', translate(normalize-space(name), $lowercase,
286                     $uppercase), ' ')), ' -'), 1, 1)" />
287         </xsl:for-each>
288     </xsl:with-param>
289 </xsl:call-template>
290 </xsl:template>
291 <!-- /module-startletters -->
292
293
294 <!-- ==================================================================== -->
295 <!-- define module name translations for sorting                          -->
296 <!--                                                                      -->
297 <!-- it's a kind of a hack...                                             -->
298 <!-- we build a string that contains the following data:                  -->
299 <!-- "- modulename sortname - modulename sortname - ..."                  -->
300 <!-- (with all data in uppercase)                                         -->
301 <!--                                                                      -->
302 <!-- So, the translation from modulename to sortname can be done with the -->
303 <!-- expression below:                                                    -->
304 <!--
305        substring-before(
306            substring-after($translist, 
307                            concat('- ', translate(modulename,
308                                                   $lowercase, $uppercase),
309                                   ' ')
310                            ),
311            ' -')
312                                                                           -->
313 <!-- ==================================================================== -->
314 <xsl:template name="module-translist">
315 <xsl:param name="modules" />
316
317 <xsl:text>-</xsl:text>
318 <xsl:for-each select="$modules">
319     <xsl:variable name="sname" select="translate(normalize-space(name),
320                                        $lowercase, $uppercase)" />
321
322     <xsl:text> </xsl:text>
323     <xsl:value-of select="$sname" />
324     <xsl:text> </xsl:text>
325     <xsl:call-template name="module-translatename">
326         <xsl:with-param name="name" select="$sname" />
327     </xsl:call-template>
328     <xsl:text> -</xsl:text>
329 </xsl:for-each>
330 </xsl:template>
331 <!-- /module-translist -->
332
333 </xsl:stylesheet>