]> granicus.if.org Git - apache/blob - docs/manual/style/xsl/common.xsl
d2fb28e588e52e759a4d168e529e2c04c4038676
[apache] / docs / manual / style / xsl / common.xsl
1 <?xml version="1.0"?>
2
3 <!--
4  Licensed to the Apache Software Foundation (ASF) under one or more
5  contributor license agreements.  See the NOTICE file distributed with
6  this work for additional information regarding copyright ownership.
7  The ASF licenses this file to You under the Apache License, Version 2.0
8  (the "License"); you may not use this file except in compliance with
9  the License.  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     <!ENTITY nbsp SYSTEM "util/nbsp.xml">
23     <!ENTITY para SYSTEM "util/para.xml">
24     <!ENTITY % HTTPD-VERSION SYSTEM "../version.ent">
25     %HTTPD-VERSION;
26 ]>
27 <xsl:stylesheet version="1.0"
28               xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
29                   xmlns="http://www.w3.org/1999/xhtml">
30
31 <!--                                                                      -->
32 <!-- Please, don't hard-code output strings! Use the language             -->
33 <!-- files and the translation "stuff"...                                 -->
34 <!--                                                                      -->
35
36 <!-- Injected variables:                                                  -->
37 <!--   $is-retired      - (boolean) Is this httpd version retired?        -->
38 <!--   $is-chm          - (boolean) target is for CHM generation or not   -->
39 <!--   $is-zip          - (boolean) target is for ZIP generation or not   -->
40 <!--   $message         - (node-set) localized common text snippets       -->
41 <!--   $doclang         - (string) document language                      -->
42 <!--   $output-encoding - (string) MIME charset name of the output        -->
43 <!--                      encoding                                        -->
44
45 <!-- Constants used for case translation -->
46 <xsl:variable name="lowercase" select="'abcdefghijklmnopqrstuvwxyz'" />
47 <xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
48
49 <!-- space separated list of blockelements defined in common.dtd -->
50 <!--    used for inline content catching in <example>s           -->
51 <xsl:variable name="blockelements">
52     p  example  note  table  ul  ol  dl  pre  highlight img  blockquote
53 </xsl:variable>
54
55 <!-- relative path to /manual/ -->
56 <xsl:variable name="metafile" select="document(/*/@metafile)/metafile" />
57 <xsl:variable name="path"     select="$metafile/relpath" />
58
59 <!-- load outsourced page types -->
60 <xsl:include href="moduleindex.xsl" />
61 <xsl:include href="directiveindex.xsl" />
62 <xsl:include href="manualpage.xsl" />
63 <xsl:include href="synopsis.xsl" />
64 <xsl:include href="sitemap.xsl" />
65 <xsl:include href="indexpage.xsl" />
66 <xsl:include href="quickreference.xsl" />
67 <xsl:include href="faq.xsl" />
68 <xsl:include href="overrideindex.xsl" />
69
70 <!-- load utility snippets -->
71 <xsl:include href="util/modtrans.xsl" />
72 <xsl:include href="util/pretrim.xsl" />
73
74 <!-- make sure, we set relative anchors only, if we're actually -->
75 <!-- transforming a modulefile (see <directive> template)       -->
76 <xsl:variable name="in-modulesynopsis" select="boolean(/modulesynopsis)" />
77 <xsl:variable name="upgrade" select="boolean(/*/@upgrade)" />
78
79 <!-- when referencing to a directory, we may need to complete the path -->
80 <!-- with the index file (for offline applications like *.chm files)   -->
81 <xsl:variable name="index-file">
82     <xsl:if test="$is-chm or $is-zip">index.html</xsl:if>
83 </xsl:variable>
84
85 <!-- it may be desired to open external targets in a new window -->
86 <xsl:variable name="ext-target" select="boolean($is-chm)" />
87
88 <xsl:template match="/">
89     <xsl:if test="not($metafile/@reference)">
90         <xsl:message terminate="yes">
91             Invalid metafile. Probably your build system is not up-to-date.
92             Get a current version and try again.
93         </xsl:message>
94     </xsl:if>
95     <xsl:apply-templates />
96 </xsl:template>
97
98
99 <!-- #################################################################### -->
100 <!-- Utility templates for constructing pages                             -->
101 <!-- #################################################################### -->
102
103 <!-- ==================================================================== -->
104 <!-- HTML head                                                            -->
105 <!-- ==================================================================== -->
106 <xsl:template name="head">
107 <head>
108     &lf;
109     <meta http-equiv="Content-Type"
110           content="text/html; charset={$output-encoding}" />&lf;
111     <xsl:if test="not($is-chm or $is-zip)">
112         <xsl:comment>
113             &lf;
114             <xsl:text>        </xsl:text>
115             <xsl:text>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</xsl:text>
116             <xsl:text>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</xsl:text>
117             &lf;
118             <xsl:text>              </xsl:text>
119             <xsl:text>This file is generated from xml source: </xsl:text>
120             <xsl:text>DO NOT EDIT</xsl:text>
121             &lf;
122             <xsl:text>        </xsl:text>
123             <xsl:text>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</xsl:text>
124             <xsl:text>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</xsl:text>
125             &lf;
126             <xsl:text>      </xsl:text>
127         </xsl:comment>&lf;
128     </xsl:if>
129
130     <title>
131         <xsl:choose>
132         <xsl:when test="name">
133             <xsl:value-of select="name"/>
134         </xsl:when>
135
136         <xsl:otherwise>
137             <xsl:value-of select="title"/>
138         </xsl:otherwise>
139         </xsl:choose>
140
141         <xsl:text> </xsl:text>
142         <xsl:value-of select="normalize-space($message[@id='apachetitle'])"/>
143         <xsl:text> </xsl:text>
144         <xsl:value-of select="normalize-space($message[@id='version'])"/> 
145     </title>&lf;
146
147     <!-- chm files get a slightly different stylesheet -->
148     <xsl:choose>
149     <xsl:when test="$is-chm">
150         <link type="text/css" rel="stylesheet" media="all"
151               href="{$path}/style/css/manual-chm.css" />
152     </xsl:when>
153     <!-- zip packages do also -->
154     <xsl:when test="$is-zip">
155         <link title="Main stylesheet"  type="text/css" media="all"
156                 rel="stylesheet"
157                href="{$path}/style/css/manual-zip.css" />&lf;
158         <link title="No Sidebar - Default font size" type="text/css" media="all"
159                rel="alternate stylesheet"
160                href="{$path}/style/css/manual-zip-100pc.css"/>
161     </xsl:when>
162     <xsl:otherwise>
163         <link title="Main stylesheet"  type="text/css" media="all"
164                 rel="stylesheet"
165                href="{$path}/style/css/manual.css" />&lf;
166         <link title="No Sidebar - Default font size" type="text/css" media="all"
167                rel="alternate stylesheet"
168                href="{$path}/style/css/manual-loose-100pc.css"/>
169         
170     </xsl:otherwise>
171     </xsl:choose>&lf;
172
173     <link type="text/css" media="print"
174            rel="stylesheet"
175            href="{$path}/style/css/manual-print.css"/>
176     <link href="{$path}/style/css/prettify.css" type="text/css" rel="stylesheet" />&lf;
177     <script type="text/javascript" src="{$path}/style/scripts/prettify.min.js">&lf;</script>&lf;
178     <!-- chm files do not need a favicon -->
179     <xsl:if test="not($is-chm or $is-zip)">&lf;
180         <link rel="shortcut icon" href="{$path}/images/favicon.ico" />
181         <xsl:if test="$is-retired">
182             <xsl:choose>
183             <xsl:when test="$upgrade">
184                 <xsl:if test="not(/*/@upgrade = '')">
185                     <link rel="canonical" href="http://httpd.apache.org/docs/current{concat($metafile/path, /*/@upgrade, '.html')}"/>
186                 </xsl:if>
187             </xsl:when>
188             <xsl:otherwise>
189                 <link rel="canonical" href="http://httpd.apache.org/docs/current{concat($metafile/path, $metafile/basename, '.html')}"/>
190             </xsl:otherwise>
191             </xsl:choose>
192         </xsl:if>
193     </xsl:if>
194 </head>
195 </xsl:template>
196 <!-- /head -->
197
198
199 <!-- ==================================================================== -->
200 <!-- page top                                                             -->
201 <!-- ==================================================================== -->
202 <xsl:template name="top">
203 <div id="page-header">&lf;
204     <xsl:call-template name="super-menu" />&lf;
205
206     <p class="apache">
207         <xsl:value-of select="normalize-space($message
208                                               [@id='apachehttpserver'])"/>
209     </p>&lf;
210
211     <img src="{$path}/images/feather.png" alt="" />
212 </div>&lf; <!-- /page-header -->
213
214 <div class="up">
215     <a href="./{$index-file}">
216         <xsl:if test="parentdocument">
217             <xsl:attribute name="href">
218                 <xsl:value-of select="parentdocument/@href"/>
219             </xsl:attribute>
220
221             <xsl:call-template name="helper.uri.fix">
222                 <xsl:with-param name="uri" select="parentdocument/@href" />
223             </xsl:call-template>
224       </xsl:if>
225
226       <img src="{$path}/images/left.gif" alt="&lt;-" title="&lt;-" />
227     </a>
228 </div>&lf;
229
230 <div id="path">&lf;
231     <a href="http://www.apache.org/">
232         <xsl:if test="$ext-target">
233             <xsl:attribute name="target">_blank</xsl:attribute>
234         </xsl:if>
235         <xsl:value-of select="$message[@id='apache']" />
236     </a>
237
238     <xsl:text> &gt; </xsl:text>
239
240     <a href="http://httpd.apache.org/">
241         <xsl:if test="$ext-target">
242             <xsl:attribute name="target">_blank</xsl:attribute>
243         </xsl:if>
244         <xsl:value-of select="$message[@id='http-server']" />
245     </a>
246
247     <xsl:text> &gt; </xsl:text>
248
249     <a href="http://httpd.apache.org/docs/">
250         <xsl:if test="$ext-target">
251             <xsl:attribute name="target">_blank</xsl:attribute>
252         </xsl:if>
253         <xsl:value-of select="$message[@id='documentation']" />
254     </a>
255
256     <xsl:if test="not(../indexpage)">
257     <xsl:text> &gt; </xsl:text>
258
259     <a href="{$path}/{$index-file}">
260         <xsl:value-of select="$message[@id='version']"/>
261     </a>
262     </xsl:if>
263
264     <xsl:if test="../modulesynopsis or ../directiveindex or ../quickreference">
265     <xsl:text> &gt; </xsl:text>
266
267     <a href="./{$index-file}">
268         <xsl:value-of select="$message[@id='modules']"/>
269     </a>
270     </xsl:if>
271
272     <xsl:if test="parentdocument/text()">
273     <xsl:text> &gt; </xsl:text>
274
275     <a href="{parentdocument/@href}">
276         <xsl:call-template name="helper.uri.fix">
277             <xsl:with-param name="uri" select="parentdocument/@href"/>
278         </xsl:call-template>
279         <xsl:value-of select="parentdocument"/>
280     </a>
281     </xsl:if>
282 </div> <!-- /path -->
283 </xsl:template>
284 <!-- /top -->
285
286
287 <!-- ==================================================================== -->
288 <!-- retired                                                              -->
289 <!-- ==================================================================== -->
290 <xsl:template name="retired">
291 <xsl:if test="$is-retired">
292     <xsl:variable name="base">
293         <xsl:choose>
294         <xsl:when test="$upgrade">
295             <xsl:if test="not(/*/@upgrade = '')">
296                 <xsl:value-of select="/*/@upgrade" />
297             </xsl:if>
298         </xsl:when>
299         <xsl:otherwise>
300             <xsl:value-of
301                 select="$metafile/basename" />
302         </xsl:otherwise>
303         </xsl:choose>
304     </xsl:variable>
305     <xsl:variable name="future">
306         <xsl:choose>
307         <xsl:when test="$base = 'index'">
308             <xsl:value-of select="$metafile/path" />
309         </xsl:when>
310         <xsl:when test="$base = ''">
311             <!-- nothing -->
312         </xsl:when>
313         <xsl:otherwise>
314             <xsl:value-of select="concat($metafile/path, $base, '.html')" />
315         </xsl:otherwise>
316         </xsl:choose>
317     </xsl:variable>
318
319     <div class="retired">
320         <h4><xsl:value-of select="$message[@id='retired.headline']" /></h4>
321         <xsl:apply-templates select="$message[@id='retired.description']" />
322         <ul>
323             <li><a href="http://httpd.apache.org/docs/current/">
324                 <xsl:value-of select="$message[@id='retired.current']" /></a>
325             </li>
326         </ul>
327         <xsl:if test="not($future = '')">
328             <p><xsl:apply-templates select="$message[@id='retired.document']" mode="retired" /></p>
329         </xsl:if>
330     </div>
331 </xsl:if>
332 </xsl:template>
333 <!-- /retired -->
334
335 <xsl:template match="message">
336     <xsl:apply-templates />
337 </xsl:template>
338
339 <xsl:template match="link" mode="retired">
340 <xsl:variable name="base">
341     <xsl:choose>
342     <xsl:when test="$upgrade">
343         <xsl:if test="not(/*/@upgrade = '')">
344             <xsl:value-of select="/*/@upgrade" />
345         </xsl:if>
346     </xsl:when>
347     <xsl:otherwise>
348         <xsl:value-of
349             select="$metafile/basename" />
350     </xsl:otherwise>
351     </xsl:choose>
352 </xsl:variable>
353 <xsl:variable name="future">
354     <xsl:choose>
355     <xsl:when test="$base = 'index'">
356         <xsl:value-of select="$metafile/path" />
357     </xsl:when>
358     <xsl:when test="$base = ''">
359         <!-- nothing -->
360     </xsl:when>
361     <xsl:otherwise>
362         <xsl:value-of select="concat($metafile/path, $base, '.html')" />
363     </xsl:otherwise>
364     </xsl:choose>
365 </xsl:variable>
366
367 <a href="http://httpd.apache.org/docs/current{$future}">
368     <xsl:apply-templates />
369 </a>
370 </xsl:template>
371
372
373 <!-- ==================================================================== -->
374 <!-- out of date                                                          -->
375 <!-- ==================================================================== -->
376 <xsl:template name="outofdate">
377 <xsl:if test="$metafile/variants/variant[.=$doclang]/@outdated = 'yes'">
378     &lf;
379     <div class="outofdate">
380         <xsl:value-of select="$message[@id='outofdate']"/>
381     </div>
382 </xsl:if>
383 </xsl:template>
384
385
386 <!-- ==================================================================== -->
387 <!-- page bottom                                                          -->
388 <!-- ==================================================================== -->
389 <xsl:template name="bottom">
390 <xsl:call-template name="langavail">
391     <xsl:with-param name="position" select="'bottom'" />
392 </xsl:call-template>
393 <xsl:choose>
394 <xsl:when test="not($is-chm or $is-zip or $metafile/basename = 'index')">
395 <div class="top"><a href="#page-header"><img alt="top" src="{$path}/images/up.gif" /></a></div>
396 <div class="section">
397 <h2><a name="comments_section" id="comments_section"><xsl:value-of select="$message[@id='comments']" /></a></h2>
398 <div class="warning"><strong>Notice:</strong><br/>This is not a Q&amp;A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div>&lf;
399 <script type="text/javascript">
400 <xsl:text disable-output-escaping="yes"><![CDATA[<!--//--><![CDATA[//><!--
401 var comments_shortname = 'httpd';
402 var comments_identifier = 'http://httpd.apache.org/docs/]]></xsl:text>&httpd.comments;<xsl:value-of select="concat($metafile/path, $metafile/basename, '.html')" disable-output-escaping="yes" /><xsl:text disable-output-escaping="yes"><![CDATA[';
403 (function(w, d) {
404     if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
405         d.write('<div id="comments_thread"><\/div>');
406         var s = d.createElement('script');
407         s.type = 'text/javascript';
408         s.async = true;
409         s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
410         (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
411     }
412     else {
413         d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
414     }
415 })(window, document);
416 //--><!]]]]>></xsl:text></script>
417 </div>
418 </xsl:when>
419 </xsl:choose>
420 <div id="footer">&lf;
421     <p class="apache">
422         <xsl:text>Copyright 2019 The Apache Software Foundation.</xsl:text><br />
423         <xsl:if test="normalize-space($message[@id='before-license'])">
424             <xsl:value-of select="$message[@id='before-license']"/>
425             <xsl:text> </xsl:text>
426         </xsl:if>
427
428         <a href="http://www.apache.org/licenses/LICENSE-2.0">
429             <xsl:if test="$ext-target">
430                 <xsl:attribute name="target">_blank</xsl:attribute>
431             </xsl:if>
432             <xsl:text>Apache License, Version 2.0</xsl:text>
433         </a>
434         <xsl:if test="normalize-space($message[@id='after-license'])">
435             <xsl:text> </xsl:text>
436             <xsl:value-of select="$message[@id='after-license']"/>
437         </xsl:if>
438
439         <xsl:text>.</xsl:text>
440     </p>&lf;
441     <xsl:call-template name="super-menu"/>
442
443 </div> <!-- /footer -->
444
445 <script type="text/javascript">
446 <xsl:text disable-output-escaping="yes"><![CDATA[<!--//--><![CDATA[//><!--
447 if (typeof(prettyPrint) !== 'undefined') {
448     prettyPrint();
449 }
450 //--><!]]]]>></xsl:text></script>
451 </xsl:template>
452 <!-- /bottom -->
453
454
455 <!-- ==================================================================== -->
456 <!-- build an "available languages" section                               -->
457 <!-- ==================================================================== -->
458 <xsl:template name="langavail">
459 <xsl:param name="position" select="'top'" />
460
461 <xsl:if test="not($is-chm or $is-zip)">
462 <div class="{$position}lang">&lf;
463     <p>
464         <span>
465             <xsl:value-of select="$message[@id='langavail']" />
466             <xsl:text>: </xsl:text>
467         </span>
468
469         <xsl:for-each select="$metafile/variants/variant">
470         <xsl:sort select="." />
471
472             <a href="{$path}/{.}{$metafile/path}{$metafile/basename}.html">
473                 <xsl:if test="$metafile/basename = 'index'">
474                     <xsl:attribute name="href">
475                         <xsl:value-of
476                             select="concat($path, '/', ., $metafile/path)" />
477                     </xsl:attribute>
478                 </xsl:if>
479                 <xsl:if test="$doclang != .">
480                     <xsl:attribute name="hreflang">
481                         <xsl:value-of select="." />
482                     </xsl:attribute>
483                     <xsl:attribute name="rel">alternate</xsl:attribute>
484                 </xsl:if>
485                 <xsl:attribute name="title">
486                     <xsl:value-of select="document(concat('../lang/', .,
487                                                    '.xml'))
488                                           /language/messages/message
489                                           [@id='nativename']" />
490                 </xsl:attribute>
491
492                 &nbsp;
493                 <xsl:value-of select="." />
494                 &nbsp;
495             </a>
496             <xsl:if test="position() != last()">
497                 <xsl:text> |&#xA;</xsl:text>
498             </xsl:if>
499         </xsl:for-each>
500     </p>&lf;
501 </div> <!-- /.{$position}lang -->
502 </xsl:if>
503
504 <xsl:if test="$position = 'top'">
505     <xsl:call-template name="outofdate" />
506 </xsl:if>
507
508 </xsl:template>
509 <!-- /langavail -->
510
511
512 <!-- ==================================================================== -->
513 <!-- Process a documentation section                                      -->
514 <!-- ==================================================================== -->
515 <xsl:template match="section">
516 <xsl:call-template name="toplink" />&lf;
517 <div class="section">&lf;
518
519     <!-- Section heading -->
520     <h2>
521         <xsl:choose>
522         <xsl:when test="@id">
523           <a id="{@id}" name="{@id}">
524               <xsl:apply-templates select="title" mode="print" />
525           </a>
526           <xsl:text> </xsl:text>
527           <a class="permalink" href="#{@id}" title="{$message[@id='permalink']}">&para;</a>
528         </xsl:when>
529
530         <xsl:otherwise>
531             <xsl:apply-templates select="title" mode="print" />
532         </xsl:otherwise>
533         </xsl:choose>
534     </h2>
535
536     <!-- Section body -->
537     <xsl:apply-templates />
538 </div> <!-- /.section -->
539 </xsl:template>
540 <!-- /section -->
541
542
543 <!-- ==================================================================== -->
544 <!-- handle subsections (lower level headings)                            -->
545 <!-- ==================================================================== -->
546 <xsl:template match="section/section" priority="3">
547 <!-- Section heading -->
548 <h3>
549     <xsl:choose>
550     <xsl:when test="@id">
551         <a id="{@id}" name="{@id}">
552             <xsl:apply-templates select="title" mode="print" />
553         </a>
554     </xsl:when>
555
556     <xsl:otherwise>
557         <xsl:apply-templates select="title" mode="print" />
558     </xsl:otherwise>
559     </xsl:choose>
560 </h3>
561
562 <!-- Section body -->
563 <xsl:apply-templates />
564 </xsl:template>
565 <!-- /section/section -->
566
567
568 <!-- ==================================================================== -->
569 <!-- handle subsubsections (h4)                                           -->
570 <!-- ==================================================================== -->
571 <xsl:template match="section/section/section" priority="4">
572 <!-- Section heading -->
573 <h4>
574     <xsl:choose>
575     <xsl:when test="@id">
576         <a id="{@id}" name="{@id}">
577             <xsl:apply-templates select="title" mode="print" />
578         </a>
579     </xsl:when>
580
581     <xsl:otherwise>
582         <xsl:apply-templates select="title" mode="print" />
583     </xsl:otherwise>
584     </xsl:choose>
585 </h4>
586
587 <!-- Section body -->
588 <xsl:apply-templates/>
589
590 </xsl:template>
591 <!-- /section/section/section -->
592
593
594 <!-- ==================================================================== -->
595 <!-- section nesting > h4 is not supported for now                        -->
596 <!-- ==================================================================== -->
597 <xsl:template match="section/section/section/section">
598 <xsl:message terminate="yes">
599     <xsl:text>FATAL: exceeding maximum section nesting level.</xsl:text>
600     &lf;&lf;
601     <xsl:text>Perhaps you should consider to split your document into</xsl:text>
602     &lf;
603     <xsl:text>several ones...</xsl:text>
604     &lf;
605 </xsl:message>
606 </xsl:template>
607 <!-- /section/section/section/section -->
608
609
610
611 <!-- ==================================================================== -->
612 <!-- Render trimmed pre/highlight-text                                    -->
613 <!-- ==================================================================== -->
614 <xsl:template name="pre">
615 <xsl:choose>
616 <!-- Simple case: only one text node -->
617 <xsl:when test="node()[position() = 1 and self::text()] and count(node()) = 1">
618     <xsl:call-template name="pre-ltrim-one">
619         <xsl:with-param name="string">
620             <xsl:call-template name="pre-rtrim">
621                 <xsl:with-param name="string">
622                     <xsl:call-template name="pre-ltrim">
623                         <xsl:with-param name="string"
624                             select="node()[position() = 1 and self::text()]" />
625                     </xsl:call-template>
626                 </xsl:with-param>
627             </xsl:call-template>
628         </xsl:with-param>
629     </xsl:call-template>
630 </xsl:when>
631
632 <!-- multiple nodes -->
633 <xsl:otherwise>
634     <xsl:variable name="from">
635         <xsl:choose>
636         <xsl:when test="node()[position() = 1 and self::text()]">
637             <xsl:value-of select="2" />
638         </xsl:when>
639         <xsl:otherwise>
640             <xsl:value-of select="1" />
641         </xsl:otherwise>
642         </xsl:choose>
643     </xsl:variable>
644     <xsl:variable name="to">
645         <xsl:choose>
646         <xsl:when test="node()[position() = last() and self::text()]">
647             <xsl:value-of select="count(node()) - 1" />
648         </xsl:when>
649         <xsl:otherwise>
650             <xsl:value-of select="count(node())" />
651         </xsl:otherwise>
652         </xsl:choose>
653     </xsl:variable>
654
655     <xsl:if test="$from = 2">
656         <xsl:choose>
657         <xsl:when test="text()[contains(., '&#x0a;')]">
658             <xsl:call-template name="pre-ltrim">
659                 <xsl:with-param name="string"
660                     select="node()[position() = 1 and self::text()]" />
661             </xsl:call-template>
662         </xsl:when>
663         <xsl:otherwise>
664             <xsl:variable name="tmp" select="node()[position() = 1 and self::text()]" />
665             <xsl:value-of select="substring($tmp, string-length(substring-before($tmp, substring(normalize-space($tmp), 1, 1))) + 1, string-length($tmp))" />
666         </xsl:otherwise>
667         </xsl:choose>
668     </xsl:if>
669
670     <xsl:apply-templates select="node()[position() &gt;= $from and position() &lt;= $to]" />
671
672     <xsl:if test="$to &lt; count(node())">
673         <xsl:call-template name="pre-rtrim">
674             <xsl:with-param name="string"
675                 select="node()[position() = last() and self::text()]" />
676         </xsl:call-template>
677     </xsl:if>
678 </xsl:otherwise>
679 </xsl:choose>
680 </xsl:template>
681
682
683 <!-- ==================================================================== -->
684 <!-- Process source code highlighting                                     -->
685 <!-- ==================================================================== -->
686 <xsl:template match="highlight">
687 <pre class="prettyprint lang-{@language}">
688     <xsl:call-template name="pre" />
689 </pre>&lf; <!-- /.highlight -->
690 </xsl:template>
691 <!-- /higlight -->
692
693
694 <!-- ==================================================================== -->
695 <!-- (sub)section titles                                                  -->
696 <!-- ==================================================================== -->
697 <xsl:template match="section/title" mode="print">
698 <xsl:apply-templates/>
699 </xsl:template>
700 <xsl:template match="section/title" />
701 <!-- /section/title -->
702
703
704 <!-- ==================================================================== -->
705 <!-- generate section index                                               -->
706 <!-- ==================================================================== -->
707 <xsl:template match="section" mode="index">
708 <li>
709     <img src="{$path}/images/down.gif" alt="" />
710     <xsl:text> </xsl:text>
711     <xsl:choose>
712     <xsl:when test="@id">
713         <a href="#{@id}">
714             <xsl:apply-templates select="title" mode="print" />
715         </a>
716     </xsl:when>
717     <xsl:otherwise>
718         <xsl:apply-templates select="title" mode="print" />
719     </xsl:otherwise>
720     </xsl:choose>
721 </li>&lf;
722 </xsl:template>
723 <!-- /section index -->
724
725
726 <!-- ==================================================================== -->
727 <!-- docs super menu                                                      -->
728 <!-- ==================================================================== -->
729 <xsl:template name="super-menu">
730 <p class="menu">
731     <a href="{$path}/mod/{$index-file}">
732         <xsl:value-of select="$message[@id='modules']" />
733     </a>
734
735     <xsl:text> | </xsl:text>
736
737     <a href="{$path}/mod/quickreference.html">
738         <xsl:value-of select="$message[@id='directives']" />
739     </a>
740
741     <xsl:text> | </xsl:text>
742
743     <a href="http://wiki.apache.org/httpd/FAQ">
744         <xsl:value-of select="$message[@id='faq']" />
745     </a>
746
747     <xsl:text> | </xsl:text>
748
749     <a href="{$path}/glossary.html">
750         <xsl:value-of select="$message[@id='glossary']" />
751     </a>
752
753     <xsl:text> | </xsl:text>
754
755     <a href="{$path}/sitemap.html">
756         <xsl:value-of select="$message[@id='sitemap']" />
757     </a>
758 </p>
759 </xsl:template>
760 <!-- /super-menu -->
761
762
763 <!-- ==================================================================== -->
764 <!-- <example>                                                            -->
765 <!-- iterate over *all* nodes; bare text and other inline stuff is        -->
766 <!-- wrapped into <p><code>, block level elements (defined in             -->
767 <!-- $blockelements) are applied "as is"                                  -->
768 <!-- ==================================================================== -->
769 <xsl:variable name="blocks"
770             select="concat(' ', normalize-space($blockelements), ' ')" />
771
772 <xsl:template match="example">
773 <div class="example">
774     <xsl:apply-templates select="title" mode="print" />
775
776     <xsl:for-each select="./node()">
777         <xsl:variable name="is-block-node"
778                     select="boolean(contains($blocks,
779                                              concat(' ', local-name(), ' ')))"/>
780         <!-- bb = (number of) blocks nodes before (the current) -->
781         <xsl:variable name="bb"
782                     select="count(preceding-sibling::*[
783                                 contains($blocks,
784                                          concat(' ', local-name(), ' '))])" />
785
786         <xsl:if test="$is-block-node or position()=last()">
787             <xsl:variable name="content">
788                 <!-- phew. short explanation, what happens here:      -->
789                 <!-- We want to get the inline stuff between the last -->
790                 <!-- block node and the current node.                 -->
791                 <!-- So filter all previous nodes for the condition   -->
792                 <!-- that the number of block nodes of all of *their* -->
793                 <!-- previous nodes is >= $bb. Hope that helps ;-)    -->
794                 <xsl:apply-templates
795                     select="preceding-sibling::node()[
796                                 count(preceding-sibling::*[
797                                     contains($blocks,
798                                              concat(' ', local-name(), ' '))])
799                                 &gt;= $bb]" />
800
801                 <xsl:apply-templates
802                     select="self::node()[not($is-block-node)]" />
803             </xsl:variable>
804
805             <!-- apply bare text only, if it's not only \s or empty -->
806             <xsl:if test="not(normalize-space($content) = '')">
807                 <p><code>
808                     <!-- same as $content above. xsl:copy-of seems to make -->
809                     <!-- thread problems with xalan-j ... -->
810                     <xsl:apply-templates
811                         select="preceding-sibling::node()[
812                                     count(preceding-sibling::*[
813                                         contains($blocks,
814                                                  concat(' ', local-name(),
815                                                         ' '))])
816                                     &gt;= $bb]" />
817
818                     <xsl:apply-templates
819                         select="self::node()[not($is-block-node)]" />
820                 </code></p>
821             </xsl:if>
822
823             <xsl:apply-templates select="self::node()[$is-block-node]" />
824         </xsl:if>
825     </xsl:for-each>
826     <!-- /node() -->
827 </div> <!-- /.example -->
828 </xsl:template>
829 <!-- /example -->
830
831
832 <!-- ==================================================================== -->
833 <!-- example/title                                                        -->
834 <!-- ==================================================================== -->
835 <xsl:template match="example/title" mode="print">
836 <h3>
837     <xsl:apply-templates/>
838 </h3>
839 </xsl:template>
840 <xsl:template match="example/title" />
841 <!-- /example/title -->
842
843
844 <!-- ==================================================================== -->
845 <!-- indentations                                                         -->
846 <!-- ==================================================================== -->
847 <xsl:template match="indent">
848 <span class="indent">
849     <xsl:apply-templates/>
850 </span>
851 </xsl:template>
852 <!-- /indent -->
853
854
855 <!-- ==================================================================== -->
856 <!-- <note>                                                               -->
857 <!-- ==================================================================== -->
858 <xsl:template match="note">
859 <div class="note">
860     <xsl:if test="@type='warning'">
861         <xsl:attribute name="class">warning</xsl:attribute>
862     </xsl:if>
863
864     <xsl:apply-templates/>
865 </div>
866 </xsl:template>
867 <!-- /note -->
868
869
870 <!-- ==================================================================== -->
871 <!-- <note><title>                                                        -->
872 <!-- ==================================================================== -->
873 <xsl:template match="note/title">
874 <h3>
875     <xsl:apply-templates/>
876 </h3>
877 </xsl:template>
878 <!-- /note/title -->
879
880
881 <!-- ==================================================================== -->
882 <!-- <directive>                                                          -->
883 <!-- Inserts link to another directive, which might be in another module. -->
884 <!-- References are converted into lower case.                            -->
885 <!-- ==================================================================== -->
886 <xsl:template match="directive" name="directive">
887 <code class="directive">
888     <xsl:choose>
889     <xsl:when test="@module">
890         <xsl:variable name="lowerdirective">
891             <xsl:choose>
892             <xsl:when test="@name">
893                 <xsl:value-of select="normalize-space(concat(translate(@name,
894                                         $uppercase, $lowercase),@idtype))" />
895             </xsl:when>
896             <xsl:otherwise>
897                 <xsl:value-of select="normalize-space(concat(translate(.,
898                                         $uppercase, $lowercase),@idtype))" />
899             </xsl:otherwise>
900             </xsl:choose>
901         </xsl:variable>
902
903         <xsl:choose>
904         <xsl:when test="$in-modulesynopsis and normalize-space(@module) = /modulesynopsis/name">
905             <a href="#{$lowerdirective}">
906                 <xsl:if test="@type='section'">&lt;</xsl:if>
907                 <xsl:value-of select="."/>
908                 <xsl:if test="@type='section'">&gt;</xsl:if>
909             </a>
910         </xsl:when>
911         <xsl:otherwise>
912             <a href="{$path}/mod/{normalize-space(@module)}.html#{$lowerdirective}">
913                 <xsl:if test="@type='section'">&lt;</xsl:if>
914                 <xsl:value-of select="."/>
915                 <xsl:if test="@type='section'">&gt;</xsl:if>
916             </a>
917         </xsl:otherwise>
918         </xsl:choose>
919     </xsl:when>
920
921     <xsl:otherwise>
922         <xsl:if test="@type='section'">&lt;</xsl:if>
923         <xsl:value-of select="."/>
924         <xsl:if test="@type='section'">&gt;</xsl:if>
925     </xsl:otherwise>
926     </xsl:choose>
927 </code>
928 </xsl:template>
929 <!-- /directive -->
930
931
932 <!-- ==================================================================== -->
933 <!-- <module>                                                             -->
934 <!-- Inserts a link to refereed module                                    -->
935 <!-- ==================================================================== -->
936 <xsl:template match="module" name="module">
937 <code class="module">
938     <xsl:choose>
939     <xsl:when test="@outdated = 'true'">
940         <xsl:value-of select="."/>
941     </xsl:when>
942     <xsl:otherwise>
943         <a href="{$path}/mod/{normalize-space(.)}.html">
944             <xsl:value-of select="."/>
945         </a>
946     </xsl:otherwise>
947     </xsl:choose>
948 </code>
949 </xsl:template>
950 <!-- /module -->
951
952
953 <!-- ==================================================================== -->
954 <!-- <program>                                                            -->
955 <!-- Inserts a link to referred program                                   -->
956 <!-- ==================================================================== -->
957 <xsl:template match="program">
958 <code class="program">
959     <a href="{$path}/programs/{normalize-space(.)}.html">
960         <xsl:value-of select="normalize-space(.)" />
961     </a>
962 </code>
963 </xsl:template>
964 <!-- /program -->
965
966
967 <!-- ==================================================================== -->
968 <!-- <related>                                                            -->
969 <!-- ==================================================================== -->
970 <xsl:template match="related">
971 <table class="related">
972 <tr>
973     <th>
974         <xsl:value-of select="$message[@id='relatedmodules']" />
975     </th>
976     <th>
977         <xsl:value-of select="$message[@id='relateddirectives']" />
978     </th>
979 </tr>
980 <tr>
981     <td>
982         <xsl:if test="count(modulelist/*) &gt; 0">
983             <ul>
984                 <xsl:apply-templates select="modulelist" />
985             </ul>
986         </xsl:if>
987     </td>
988     <td>
989         <xsl:if test="count(directivelist/*) &gt; 0">
990             <ul>
991                 <xsl:apply-templates select="directivelist"/>
992             </ul>
993         </xsl:if>
994     </td>
995 </tr>
996 </table>
997 </xsl:template>
998 <!-- /related -->
999
1000 <!-- ==================================================================== -->
1001 <!-- related/modulelist                                                   -->
1002 <!-- ==================================================================== -->
1003 <xsl:template match="related/modulelist">
1004 <xsl:for-each select="module">
1005     <li>
1006         <xsl:call-template name="module"/>
1007     </li>
1008 </xsl:for-each>
1009 </xsl:template>
1010 <!-- /related/modulelist -->
1011
1012
1013 <!-- ==================================================================== -->
1014 <!-- related/directivelist                                                -->
1015 <!-- ==================================================================== -->
1016 <xsl:template match="related/directivelist">
1017 <xsl:for-each select="directive">
1018     <li>
1019         <xsl:call-template name="directive"/>
1020     </li>
1021 </xsl:for-each>
1022 </xsl:template>
1023 <!-- /related/directivelist -->
1024
1025
1026 <!-- ==================================================================== -->
1027 <!-- <table>                                                              -->
1028 <!-- ==================================================================== -->
1029 <xsl:template match="table">
1030 <table>
1031     <!-- existing border attribute will result in <table class="bordered"> -->
1032     <xsl:if test="@border">
1033         <xsl:attribute name="class">bordered</xsl:attribute>
1034     </xsl:if>
1035
1036     <xsl:choose>
1037     <xsl:when test="@style = 'zebra'">
1038         <xsl:apply-templates select="tr" mode="zebra-table" />
1039     </xsl:when>
1040     <xsl:when test="@style = 'data'">
1041         <xsl:apply-templates select="tr" mode="data-table" />
1042     </xsl:when>
1043     <xsl:otherwise>
1044         <xsl:apply-templates />
1045     </xsl:otherwise>
1046     </xsl:choose>
1047 </table>
1048 </xsl:template>
1049 <!-- /table -->
1050
1051 <!-- data-table -->
1052 <xsl:template match="tr" mode="data-table">
1053 <!-- style="data": fixed font, padding-left and right alignment for <td>s -->
1054 <xsl:variable name="cross-table" select="boolean(
1055     preceding-sibling::tr/th[1]|following-sibling::tr/th[1])" />
1056
1057 <tr>
1058     <xsl:for-each select="node()">
1059         <xsl:choose>
1060         <xsl:when test="local-name() = 'td'">
1061             <td class="data">
1062                 <xsl:apply-templates select="*|@*|text()" />
1063             </td>
1064         </xsl:when>
1065         <xsl:when test="local-name() = 'th' and
1066                         (not($cross-table) or
1067                          count(preceding-sibling::*) &gt; 0)">
1068             <th class="data">
1069                 <xsl:apply-templates select="*|@*|text()" />
1070             </th>
1071         </xsl:when>
1072         <xsl:otherwise>
1073             <xsl:apply-templates select="self::node()" />
1074         </xsl:otherwise>
1075         </xsl:choose>
1076     </xsl:for-each>
1077 </tr>&lf;
1078 </xsl:template>
1079
1080
1081 <!-- zebra-table -->
1082 <xsl:template match="tr" mode="zebra-table">
1083 <!-- style="zebra": alternating colors per row, i.e. every second row -->
1084 <!--                gets a class="odd". Header lines (no <td>) get a  -->
1085 <!--                class="header". These lines will be excluded from -->
1086 <!--                the "odd" line count. That way header lines act   -->
1087 <!--                interjectional, which creates a better visual and -->
1088 <!--                psychological effect.                             -->
1089 <tr>
1090     <xsl:choose>
1091     <xsl:when test="count(td) = 0">
1092         <xsl:attribute name="class">header</xsl:attribute>
1093     </xsl:when>
1094
1095     <xsl:when test="position() mod 2 = (count(preceding-sibling::tr[count(td) = 0]) mod 2)">
1096         <xsl:attribute name="class">odd</xsl:attribute>
1097     </xsl:when>
1098     </xsl:choose>
1099
1100     <xsl:apply-templates />
1101 </tr>&lf;
1102 </xsl:template>
1103 <!-- /zebra-table -->
1104
1105
1106 <!-- ==================================================================== -->
1107 <!-- <ol>                                                                 -->
1108 <!-- ==================================================================== -->
1109 <xsl:template match="ol">
1110 <ol>
1111     <!-- A. B. C. D. (list-style-type="upper-alpha") -->
1112     <xsl:choose>
1113     <xsl:when test="@type = 'A'">
1114         <xsl:attribute name="class">up-A</xsl:attribute>
1115     </xsl:when>
1116     <xsl:when test="@type = 'a'">
1117         <xsl:attribute name="class">lo-A</xsl:attribute>
1118     </xsl:when>
1119     </xsl:choose>
1120
1121     <xsl:apply-templates/>
1122 </ol>
1123 </xsl:template>
1124 <!-- /ol -->
1125
1126
1127 <!-- ==================================================================== -->
1128 <!-- diverse elements                                                     -->
1129 <!-- Passes through content                                               -->
1130 <!-- ==================================================================== -->
1131 <xsl:template match="summary|description|usage|syntax|default">
1132 <xsl:apply-templates/>
1133 </xsl:template>
1134 <!-- /diverse -->
1135
1136
1137 <!-- ==================================================================== -->
1138 <!-- <a>                                                                  -->
1139 <!-- ==================================================================== -->
1140 <xsl:template match="a">
1141 <xsl:choose>
1142 <xsl:when test="not(@href)">
1143     <xsl:copy>
1144         <xsl:apply-templates select="@*|*|text()"/>
1145     </xsl:copy>
1146 </xsl:when>
1147 <xsl:otherwise>
1148     <a href="@href">
1149         <xsl:apply-templates select="@*"/>
1150         <xsl:call-template name="helper.uri.fix">
1151             <xsl:with-param name="uri" select="@href"/>
1152         </xsl:call-template>
1153
1154         <xsl:apply-templates select="*|text()"/>
1155     </a>
1156 </xsl:otherwise>
1157 </xsl:choose>
1158 </xsl:template> 
1159 <!-- /a -->
1160
1161
1162 <!-- ==================================================================== -->
1163 <!-- toplink                                                              -->
1164 <!-- ==================================================================== -->
1165 <xsl:template name="toplink">
1166 <div class="top">
1167     <a href="#page-header"><img src="{$path}/images/up.gif" alt="top" /></a>
1168 </div>
1169 </xsl:template>
1170 <!-- /toplink -->
1171
1172
1173 <!-- ==================================================================== -->
1174 <!-- <transnote>                                                          -->
1175 <!-- translator's notes are displayed in a different color                -->
1176 <!-- ==================================================================== -->
1177 <xsl:template match="transnote">
1178 <span class="transnote">
1179     <xsl:text>(</xsl:text>
1180     <em>
1181         <xsl:value-of select="$message[@id='transnote']" />
1182     </em>
1183     <xsl:text> </xsl:text>
1184     <xsl:apply-templates />
1185     <xsl:text>)</xsl:text>
1186 </span>
1187 </xsl:template>
1188 <!-- /transnote -->
1189
1190 <!-- ==================================================================== -->
1191 <!-- <phonetic>                                                           -->
1192 <!-- phonetics are enclosed in  square brackets and displayed in a        -->
1193 <!-- different color                                                      -->
1194 <!-- ==================================================================== -->
1195 <xsl:template match="phonetic">
1196 <span class="phonetic">
1197     <xsl:text>[</xsl:text>
1198     <xsl:apply-templates />
1199     <xsl:text>]</xsl:text>
1200 </span>
1201 </xsl:template>
1202 <!-- /phonetic -->
1203
1204
1205 <!-- ==================================================================== -->
1206 <!-- <glossary>                                                           -->
1207 <!-- link to a glossary anchor                                            -->
1208 <!-- ==================================================================== -->
1209 <xsl:template match="glossary">
1210   <xsl:variable name="glosslink">
1211     <xsl:choose>
1212     <xsl:when test="@ref">
1213       <xsl:value-of select="@ref"/>
1214     </xsl:when>
1215     <xsl:otherwise>
1216       <xsl:value-of select="translate(., $uppercase, $lowercase)"/>
1217     </xsl:otherwise>
1218     </xsl:choose>
1219   </xsl:variable>
1220
1221   <a href="{$path}/glossary.html#{$glosslink}" class="glossarylink">
1222      <xsl:attribute name="title">
1223         <xsl:value-of select="$message[@id='glossarylink']" />
1224      </xsl:attribute>
1225      <xsl:apply-templates />
1226   </a>
1227 </xsl:template>
1228 <!-- /glossary -->
1229
1230 <!-- ==================================================================== -->
1231 <!-- Filter &#160; in text() nodes.                                       -->
1232 <!-- In some environments this character won't be transformed correctly,  -->
1233 <!-- so we just write it explicitely as "&nbsp;" into the output.         -->
1234 <!-- ==================================================================== -->
1235 <xsl:template match="text()" name="filter.nbsp">
1236 <xsl:param name="text" select="." />
1237
1238 <xsl:choose>
1239 <xsl:when test="contains($text, '&#160;')">
1240     <xsl:value-of select="substring-before($text, '&#160;')" />
1241     &nbsp;
1242     <xsl:call-template name="filter.nbsp">
1243         <xsl:with-param name="text" select="substring-after($text, '&#160;')" />
1244     </xsl:call-template>
1245 </xsl:when>
1246 <xsl:otherwise>
1247     <xsl:value-of select="$text" />
1248 </xsl:otherwise>
1249 </xsl:choose>
1250 </xsl:template>
1251 <!-- /filter.nbsp -->
1252
1253
1254 <!-- ==================================================================== -->
1255 <!-- Process everything else by just passing it through                   -->
1256 <!-- ==================================================================== -->
1257 <xsl:template match="*">
1258 <xsl:message terminate="yes">
1259     <xsl:text>Unknown element: </xsl:text>
1260     <xsl:value-of select="local-name()" />&lf;
1261     <xsl:text>Is the document valid (try `build validate-xml`)?</xsl:text>
1262 </xsl:message>
1263 </xsl:template>
1264 <xsl:template match="@*"><xsl:copy /></xsl:template>
1265 <xsl:template match="br"><br /></xsl:template>
1266 <xsl:template match="tr"><tr><xsl:apply-templates select="*|@*|text()" /></tr></xsl:template>
1267 <xsl:template match="th"><th><xsl:apply-templates select="*|@*|text()" /></th></xsl:template>
1268 <xsl:template match="td"><td><xsl:apply-templates select="*|@*|text()" /></td></xsl:template>
1269 <xsl:template match="p"><p><xsl:apply-templates select="*|@*|text()" /></p></xsl:template>
1270 <xsl:template match="ul"><ul><xsl:apply-templates select="*|@*|text()" /></ul></xsl:template>
1271 <xsl:template match="li"><li><xsl:apply-templates select="*|@*|text()" /></li></xsl:template>
1272 <xsl:template match="dl"><dl><xsl:apply-templates select="*|@*|text()" /></dl></xsl:template>
1273 <xsl:template match="dt"><dt><xsl:apply-templates select="*|@*|text()" /></dt></xsl:template>
1274 <xsl:template match="dd"><dd><xsl:apply-templates select="*|@*|text()" /></dd></xsl:template>
1275 <xsl:template match="em"><em><xsl:apply-templates select="*|@*|text()" /></em></xsl:template>
1276 <xsl:template match="strong"><strong><xsl:apply-templates select="*|@*|text()" /></strong></xsl:template>
1277 <xsl:template match="pre"><pre><xsl:call-template name="pre" /></pre></xsl:template>
1278 <xsl:template match="code"><code><xsl:apply-templates select="*|@*|text()" /></code></xsl:template>
1279 <xsl:template match="var"><var><xsl:apply-templates select="*|@*|text()" /></var></xsl:template>
1280 <xsl:template match="dfn"><dfn><xsl:apply-templates select="*|@*|text()" /></dfn></xsl:template>
1281 <xsl:template match="blockquote"><blockquote><xsl:apply-templates select="*|@*|text()" /></blockquote></xsl:template>
1282 <xsl:template match="q"><q><xsl:apply-templates select="*|@*|text()" /></q></xsl:template>
1283 <xsl:template match="cite"><cite><xsl:apply-templates select="*|@*|text()" /></cite></xsl:template>
1284 <xsl:template match="img"><img><xsl:apply-templates select="*|@*|text()" /></img></xsl:template>
1285 <!-- /pass through -->
1286
1287
1288 <!-- ==================================================================== -->
1289 <!-- create a letter bar                                                  -->
1290 <!-- ==================================================================== -->
1291 <xsl:template name="letter-bar">
1292 <xsl:param name="letters" />
1293 <xsl:param name="first" />
1294
1295 <xsl:if test="not($first)">
1296     <xsl:text> | </xsl:text>
1297 </xsl:if>
1298
1299 <a href="#{substring($letters,1,1)}">
1300     &nbsp;
1301     <xsl:value-of select="substring($letters, 1, 1)" />
1302     &nbsp;
1303 </a>
1304
1305 <xsl:if test="string-length($letters) &gt; 1">
1306     <xsl:call-template name="letter-bar">
1307         <xsl:with-param name="letters" select="substring($letters, 2)" />
1308         <xsl:with-param name="first" select="false()" />
1309     </xsl:call-template>
1310 </xsl:if>
1311 </xsl:template>
1312 <!-- /letter-bar -->
1313
1314
1315 <!-- ==================================================================== -->
1316 <!-- template(s) for collecting all start letters of directives           -->
1317 <!-- ==================================================================== -->
1318 <xsl:template name="directive-startletters">
1319 <xsl:param name="directives" />
1320
1321 <xsl:call-template name="_squeeze-letters">
1322     <xsl:with-param name="lastletter" select="''" />
1323     <xsl:with-param name="letters">
1324         <xsl:for-each select="$directives">
1325         <xsl:sort select="name"/>
1326             <xsl:value-of
1327                 select="translate(substring(normalize-space(name), 1, 1),
1328                                   $lowercase, $uppercase)" />
1329         </xsl:for-each>
1330     </xsl:with-param>
1331 </xsl:call-template>
1332 </xsl:template>
1333 <!-- /directive-startletters -->
1334
1335
1336 <!-- ==================================================================== -->
1337 <!-- squeeze subsequent letters in a string                               -->
1338 <!-- ==================================================================== -->
1339 <xsl:template name="_squeeze-letters">
1340 <xsl:param name="letters"/>
1341 <xsl:param name="lastletter"/>
1342
1343 <xsl:variable name="current" select="substring($letters, 1, 1)" />
1344
1345 <xsl:if test="not($lastletter = $current)">
1346     <xsl:value-of select="$current" />
1347 </xsl:if>
1348
1349 <xsl:if test="string-length($letters) &gt; 1">
1350     <xsl:call-template name="_squeeze-letters">
1351         <xsl:with-param name="letters" select="substring($letters, 2)" />
1352         <xsl:with-param name="lastletter" select="$current"/>
1353     </xsl:call-template>
1354 </xsl:if>
1355 </xsl:template>
1356 <!-- /_squeeze-letters -->
1357
1358
1359 <!-- ==================================================================== -->
1360 <!-- fix href and target attribute of an element.                         -->
1361 <!-- ==================================================================== -->
1362 <xsl:template name="helper.uri.fix">
1363 <xsl:param name="uri"/>
1364
1365 <xsl:choose>
1366 <!-- lame is_absolute_uri test -->
1367 <xsl:when test="    contains($uri, ':')
1368                 and string-length(substring-before($uri, ':')) &lt; 7">
1369     <xsl:if test="$ext-target">
1370         <xsl:attribute name="target">_blank</xsl:attribute>
1371     </xsl:if>
1372 </xsl:when>
1373 <xsl:otherwise>
1374     <xsl:variable name="fragment">
1375         <xsl:if test="contains($uri, '#')">
1376             <xsl:value-of select="concat('#', substring-after($uri, '#'))"/>
1377         </xsl:if>
1378     </xsl:variable>
1379     <xsl:variable name="absuri">
1380         <xsl:choose>
1381         <xsl:when test="contains($uri, '#')">
1382             <xsl:value-of select="concat('#', substring-before($uri, '#'))"/>
1383         </xsl:when>
1384         <xsl:otherwise>
1385             <xsl:value-of select="$uri"/>
1386         </xsl:otherwise>
1387         </xsl:choose>
1388     </xsl:variable>
1389         
1390     <xsl:if test="substring($absuri, string-length($uri), 1) = '/'">
1391         <xsl:attribute name="href">
1392             <xsl:value-of select="concat($absuri, $index-file, $fragment)"/>
1393         </xsl:attribute>
1394     </xsl:if>
1395 </xsl:otherwise>
1396 </xsl:choose>
1397 </xsl:template>
1398 <!-- /helper.uri.fix -->
1399
1400
1401 <!-- ==================================================================== -->
1402 <!-- Ignore table hints used for latex                                    -->
1403 <!-- ==================================================================== -->
1404 <xsl:template match="columnspec">
1405 </xsl:template>
1406
1407 <xsl:template match="column">
1408 </xsl:template>
1409
1410 </xsl:stylesheet>