]> granicus.if.org Git - apache/blob - docs/manual/style/xsl/common.xsl
b629ebee7df1b9badba81ba840a52f5290d8c733
[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         <!-- No link if within the block that describes the directive itself -->
905         <xsl:when test="$in-modulesynopsis and normalize-space(.) = ancestor::directivesynopsis/name">
906                 <xsl:if test="@type='section'">&lt;</xsl:if>
907                 <xsl:value-of select="."/>
908                 <xsl:if test="@type='section'">&gt;</xsl:if>
909                 <xsl:message>Removing link to '<xsl:value-of select="."/>'</xsl:message>
910         </xsl:when>
911         <xsl:when test="$in-modulesynopsis and normalize-space(@module) = /modulesynopsis/name">
912             <a href="#{$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:when>
918         <xsl:otherwise>
919             <a href="{$path}/mod/{normalize-space(@module)}.html#{$lowerdirective}">
920                 <xsl:if test="@type='section'">&lt;</xsl:if>
921                 <xsl:value-of select="."/>
922                 <xsl:if test="@type='section'">&gt;</xsl:if>
923             </a>
924         </xsl:otherwise>
925         </xsl:choose>
926     </xsl:when>
927
928     <xsl:otherwise>
929         <xsl:if test="@type='section'">&lt;</xsl:if>
930         <xsl:value-of select="."/>
931         <xsl:if test="@type='section'">&gt;</xsl:if>
932         <!-- Missing module reference -->
933         <xsl:choose>
934             <!-- within another directive synopsis -->
935             <xsl:when test="normalize-space(.) != ancestor::directivesynopsis/name">
936                 <xsl:message>link to '<xsl:value-of select="."/>' directive could be added in directive '<xsl:value-of select="ancestor::directivesynopsis/name"/>'</xsl:message>
937             </xsl:when>
938             <!-- somewhere else (try to find module name to give a hint) -->
939             <xsl:when test="not(ancestor::directivesynopsis/name)">
940                 <xsl:message>link to '<xsl:value-of select="."/>' directive could be added in MODULE '<xsl:value-of select="/modulesynopsis/name"/>'</xsl:message>
941             </xsl:when>
942         </xsl:choose>
943     </xsl:otherwise>
944     </xsl:choose>
945 </code>
946 </xsl:template>
947 <!-- /directive -->
948
949
950 <!-- ==================================================================== -->
951 <!-- <module>                                                             -->
952 <!-- Inserts a link to refereed module                                    -->
953 <!-- ==================================================================== -->
954 <xsl:template match="module" name="module">
955 <code class="module">
956     <xsl:choose>
957     <xsl:when test="@outdated = 'true'">
958         <xsl:value-of select="."/>
959     </xsl:when>
960     <xsl:otherwise>
961         <a href="{$path}/mod/{normalize-space(.)}.html">
962             <xsl:value-of select="."/>
963         </a>
964     </xsl:otherwise>
965     </xsl:choose>
966 </code>
967 </xsl:template>
968 <!-- /module -->
969
970
971 <!-- ==================================================================== -->
972 <!-- <program>                                                            -->
973 <!-- Inserts a link to referred program                                   -->
974 <!-- ==================================================================== -->
975 <xsl:template match="program">
976 <code class="program">
977     <a href="{$path}/programs/{normalize-space(.)}.html">
978         <xsl:value-of select="normalize-space(.)" />
979     </a>
980 </code>
981 </xsl:template>
982 <!-- /program -->
983
984
985 <!-- ==================================================================== -->
986 <!-- <related>                                                            -->
987 <!-- ==================================================================== -->
988 <xsl:template match="related">
989 <table class="related">
990 <tr>
991     <th>
992         <xsl:value-of select="$message[@id='relatedmodules']" />
993     </th>
994     <th>
995         <xsl:value-of select="$message[@id='relateddirectives']" />
996     </th>
997 </tr>
998 <tr>
999     <td>
1000         <xsl:if test="count(modulelist/*) &gt; 0">
1001             <ul>
1002                 <xsl:apply-templates select="modulelist" />
1003             </ul>
1004         </xsl:if>
1005     </td>
1006     <td>
1007         <xsl:if test="count(directivelist/*) &gt; 0">
1008             <ul>
1009                 <xsl:apply-templates select="directivelist"/>
1010             </ul>
1011         </xsl:if>
1012     </td>
1013 </tr>
1014 </table>
1015 </xsl:template>
1016 <!-- /related -->
1017
1018 <!-- ==================================================================== -->
1019 <!-- related/modulelist                                                   -->
1020 <!-- ==================================================================== -->
1021 <xsl:template match="related/modulelist">
1022 <xsl:for-each select="module">
1023     <li>
1024         <xsl:call-template name="module"/>
1025     </li>
1026 </xsl:for-each>
1027 </xsl:template>
1028 <!-- /related/modulelist -->
1029
1030
1031 <!-- ==================================================================== -->
1032 <!-- related/directivelist                                                -->
1033 <!-- ==================================================================== -->
1034 <xsl:template match="related/directivelist">
1035 <xsl:for-each select="directive">
1036     <li>
1037         <xsl:call-template name="directive"/>
1038     </li>
1039 </xsl:for-each>
1040 </xsl:template>
1041 <!-- /related/directivelist -->
1042
1043
1044 <!-- ==================================================================== -->
1045 <!-- <table>                                                              -->
1046 <!-- ==================================================================== -->
1047 <xsl:template match="table">
1048 <table>
1049     <!-- existing border attribute will result in <table class="bordered"> -->
1050     <xsl:if test="@border">
1051         <xsl:attribute name="class">bordered</xsl:attribute>
1052     </xsl:if>
1053
1054     <xsl:choose>
1055     <xsl:when test="@style = 'zebra'">
1056         <xsl:apply-templates select="tr" mode="zebra-table" />
1057     </xsl:when>
1058     <xsl:when test="@style = 'data'">
1059         <xsl:apply-templates select="tr" mode="data-table" />
1060     </xsl:when>
1061     <xsl:otherwise>
1062         <xsl:apply-templates />
1063     </xsl:otherwise>
1064     </xsl:choose>
1065 </table>
1066 </xsl:template>
1067 <!-- /table -->
1068
1069 <!-- data-table -->
1070 <xsl:template match="tr" mode="data-table">
1071 <!-- style="data": fixed font, padding-left and right alignment for <td>s -->
1072 <xsl:variable name="cross-table" select="boolean(
1073     preceding-sibling::tr/th[1]|following-sibling::tr/th[1])" />
1074
1075 <tr>
1076     <xsl:for-each select="node()">
1077         <xsl:choose>
1078         <xsl:when test="local-name() = 'td'">
1079             <td class="data">
1080                 <xsl:apply-templates select="*|@*|text()" />
1081             </td>
1082         </xsl:when>
1083         <xsl:when test="local-name() = 'th' and
1084                         (not($cross-table) or
1085                          count(preceding-sibling::*) &gt; 0)">
1086             <th class="data">
1087                 <xsl:apply-templates select="*|@*|text()" />
1088             </th>
1089         </xsl:when>
1090         <xsl:otherwise>
1091             <xsl:apply-templates select="self::node()" />
1092         </xsl:otherwise>
1093         </xsl:choose>
1094     </xsl:for-each>
1095 </tr>&lf;
1096 </xsl:template>
1097
1098
1099 <!-- zebra-table -->
1100 <xsl:template match="tr" mode="zebra-table">
1101 <!-- style="zebra": alternating colors per row, i.e. every second row -->
1102 <!--                gets a class="odd". Header lines (no <td>) get a  -->
1103 <!--                class="header". These lines will be excluded from -->
1104 <!--                the "odd" line count. That way header lines act   -->
1105 <!--                interjectional, which creates a better visual and -->
1106 <!--                psychological effect.                             -->
1107 <tr>
1108     <xsl:choose>
1109     <xsl:when test="count(td) = 0">
1110         <xsl:attribute name="class">header</xsl:attribute>
1111     </xsl:when>
1112
1113     <xsl:when test="position() mod 2 = (count(preceding-sibling::tr[count(td) = 0]) mod 2)">
1114         <xsl:attribute name="class">odd</xsl:attribute>
1115     </xsl:when>
1116     </xsl:choose>
1117
1118     <xsl:apply-templates />
1119 </tr>&lf;
1120 </xsl:template>
1121 <!-- /zebra-table -->
1122
1123
1124 <!-- ==================================================================== -->
1125 <!-- <ol>                                                                 -->
1126 <!-- ==================================================================== -->
1127 <xsl:template match="ol">
1128 <ol>
1129     <!-- A. B. C. D. (list-style-type="upper-alpha") -->
1130     <xsl:choose>
1131     <xsl:when test="@type = 'A'">
1132         <xsl:attribute name="class">up-A</xsl:attribute>
1133     </xsl:when>
1134     <xsl:when test="@type = 'a'">
1135         <xsl:attribute name="class">lo-A</xsl:attribute>
1136     </xsl:when>
1137     </xsl:choose>
1138
1139     <xsl:apply-templates/>
1140 </ol>
1141 </xsl:template>
1142 <!-- /ol -->
1143
1144
1145 <!-- ==================================================================== -->
1146 <!-- diverse elements                                                     -->
1147 <!-- Passes through content                                               -->
1148 <!-- ==================================================================== -->
1149 <xsl:template match="summary|description|usage|syntax|default">
1150 <xsl:apply-templates/>
1151 </xsl:template>
1152 <!-- /diverse -->
1153
1154
1155 <!-- ==================================================================== -->
1156 <!-- <a>                                                                  -->
1157 <!-- ==================================================================== -->
1158 <xsl:template match="a">
1159 <xsl:choose>
1160 <xsl:when test="not(@href)">
1161     <xsl:copy>
1162         <xsl:apply-templates select="@*|*|text()"/>
1163     </xsl:copy>
1164 </xsl:when>
1165 <xsl:otherwise>
1166     <a href="@href">
1167         <xsl:apply-templates select="@*"/>
1168         <xsl:call-template name="helper.uri.fix">
1169             <xsl:with-param name="uri" select="@href"/>
1170         </xsl:call-template>
1171
1172         <xsl:apply-templates select="*|text()"/>
1173     </a>
1174 </xsl:otherwise>
1175 </xsl:choose>
1176 </xsl:template> 
1177 <!-- /a -->
1178
1179
1180 <!-- ==================================================================== -->
1181 <!-- toplink                                                              -->
1182 <!-- ==================================================================== -->
1183 <xsl:template name="toplink">
1184 <div class="top">
1185     <a href="#page-header"><img src="{$path}/images/up.gif" alt="top" /></a>
1186 </div>
1187 </xsl:template>
1188 <!-- /toplink -->
1189
1190
1191 <!-- ==================================================================== -->
1192 <!-- <transnote>                                                          -->
1193 <!-- translator's notes are displayed in a different color                -->
1194 <!-- ==================================================================== -->
1195 <xsl:template match="transnote">
1196 <span class="transnote">
1197     <xsl:text>(</xsl:text>
1198     <em>
1199         <xsl:value-of select="$message[@id='transnote']" />
1200     </em>
1201     <xsl:text> </xsl:text>
1202     <xsl:apply-templates />
1203     <xsl:text>)</xsl:text>
1204 </span>
1205 </xsl:template>
1206 <!-- /transnote -->
1207
1208 <!-- ==================================================================== -->
1209 <!-- <phonetic>                                                           -->
1210 <!-- phonetics are enclosed in  square brackets and displayed in a        -->
1211 <!-- different color                                                      -->
1212 <!-- ==================================================================== -->
1213 <xsl:template match="phonetic">
1214 <span class="phonetic">
1215     <xsl:text>[</xsl:text>
1216     <xsl:apply-templates />
1217     <xsl:text>]</xsl:text>
1218 </span>
1219 </xsl:template>
1220 <!-- /phonetic -->
1221
1222
1223 <!-- ==================================================================== -->
1224 <!-- <glossary>                                                           -->
1225 <!-- link to a glossary anchor                                            -->
1226 <!-- ==================================================================== -->
1227 <xsl:template match="glossary">
1228   <xsl:variable name="glosslink">
1229     <xsl:choose>
1230     <xsl:when test="@ref">
1231       <xsl:value-of select="@ref"/>
1232     </xsl:when>
1233     <xsl:otherwise>
1234       <xsl:value-of select="translate(., $uppercase, $lowercase)"/>
1235     </xsl:otherwise>
1236     </xsl:choose>
1237   </xsl:variable>
1238
1239   <a href="{$path}/glossary.html#{$glosslink}" class="glossarylink">
1240      <xsl:attribute name="title">
1241         <xsl:value-of select="$message[@id='glossarylink']" />
1242      </xsl:attribute>
1243      <xsl:apply-templates />
1244   </a>
1245 </xsl:template>
1246 <!-- /glossary -->
1247
1248 <!-- ==================================================================== -->
1249 <!-- Filter &#160; in text() nodes.                                       -->
1250 <!-- In some environments this character won't be transformed correctly,  -->
1251 <!-- so we just write it explicitely as "&nbsp;" into the output.         -->
1252 <!-- ==================================================================== -->
1253 <xsl:template match="text()" name="filter.nbsp">
1254 <xsl:param name="text" select="." />
1255
1256 <xsl:choose>
1257 <xsl:when test="contains($text, '&#160;')">
1258     <xsl:value-of select="substring-before($text, '&#160;')" />
1259     &nbsp;
1260     <xsl:call-template name="filter.nbsp">
1261         <xsl:with-param name="text" select="substring-after($text, '&#160;')" />
1262     </xsl:call-template>
1263 </xsl:when>
1264 <xsl:otherwise>
1265     <xsl:value-of select="$text" />
1266 </xsl:otherwise>
1267 </xsl:choose>
1268 </xsl:template>
1269 <!-- /filter.nbsp -->
1270
1271
1272 <!-- ==================================================================== -->
1273 <!-- Process everything else by just passing it through                   -->
1274 <!-- ==================================================================== -->
1275 <xsl:template match="*">
1276 <xsl:message terminate="yes">
1277     <xsl:text>Unknown element: </xsl:text>
1278     <xsl:value-of select="local-name()" />&lf;
1279     <xsl:text>Is the document valid (try `build validate-xml`)?</xsl:text>
1280 </xsl:message>
1281 </xsl:template>
1282 <xsl:template match="@*"><xsl:copy /></xsl:template>
1283 <xsl:template match="br"><br /></xsl:template>
1284 <xsl:template match="tr"><tr><xsl:apply-templates select="*|@*|text()" /></tr></xsl:template>
1285 <xsl:template match="th"><th><xsl:apply-templates select="*|@*|text()" /></th></xsl:template>
1286 <xsl:template match="td"><td><xsl:apply-templates select="*|@*|text()" /></td></xsl:template>
1287 <xsl:template match="p"><p><xsl:apply-templates select="*|@*|text()" /></p></xsl:template>
1288 <xsl:template match="ul"><ul><xsl:apply-templates select="*|@*|text()" /></ul></xsl:template>
1289 <xsl:template match="li"><li><xsl:apply-templates select="*|@*|text()" /></li></xsl:template>
1290 <xsl:template match="dl"><dl><xsl:apply-templates select="*|@*|text()" /></dl></xsl:template>
1291 <xsl:template match="dt"><dt><xsl:apply-templates select="*|@*|text()" /></dt></xsl:template>
1292 <xsl:template match="dd"><dd><xsl:apply-templates select="*|@*|text()" /></dd></xsl:template>
1293 <xsl:template match="em"><em><xsl:apply-templates select="*|@*|text()" /></em></xsl:template>
1294 <xsl:template match="strong"><strong><xsl:apply-templates select="*|@*|text()" /></strong></xsl:template>
1295 <xsl:template match="pre"><pre><xsl:call-template name="pre" /></pre></xsl:template>
1296 <xsl:template match="code"><code><xsl:apply-templates select="*|@*|text()" /></code></xsl:template>
1297 <xsl:template match="var"><var><xsl:apply-templates select="*|@*|text()" /></var></xsl:template>
1298 <xsl:template match="dfn"><dfn><xsl:apply-templates select="*|@*|text()" /></dfn></xsl:template>
1299 <xsl:template match="blockquote"><blockquote><xsl:apply-templates select="*|@*|text()" /></blockquote></xsl:template>
1300 <xsl:template match="q"><q><xsl:apply-templates select="*|@*|text()" /></q></xsl:template>
1301 <xsl:template match="cite"><cite><xsl:apply-templates select="*|@*|text()" /></cite></xsl:template>
1302 <xsl:template match="img"><img><xsl:apply-templates select="*|@*|text()" /></img></xsl:template>
1303 <!-- /pass through -->
1304
1305
1306 <!-- ==================================================================== -->
1307 <!-- create a letter bar                                                  -->
1308 <!-- ==================================================================== -->
1309 <xsl:template name="letter-bar">
1310 <xsl:param name="letters" />
1311 <xsl:param name="first" />
1312
1313 <xsl:if test="not($first)">
1314     <xsl:text> | </xsl:text>
1315 </xsl:if>
1316
1317 <a href="#{substring($letters,1,1)}">
1318     &nbsp;
1319     <xsl:value-of select="substring($letters, 1, 1)" />
1320     &nbsp;
1321 </a>
1322
1323 <xsl:if test="string-length($letters) &gt; 1">
1324     <xsl:call-template name="letter-bar">
1325         <xsl:with-param name="letters" select="substring($letters, 2)" />
1326         <xsl:with-param name="first" select="false()" />
1327     </xsl:call-template>
1328 </xsl:if>
1329 </xsl:template>
1330 <!-- /letter-bar -->
1331
1332
1333 <!-- ==================================================================== -->
1334 <!-- template(s) for collecting all start letters of directives           -->
1335 <!-- ==================================================================== -->
1336 <xsl:template name="directive-startletters">
1337 <xsl:param name="directives" />
1338
1339 <xsl:call-template name="_squeeze-letters">
1340     <xsl:with-param name="lastletter" select="''" />
1341     <xsl:with-param name="letters">
1342         <xsl:for-each select="$directives">
1343         <xsl:sort select="name"/>
1344             <xsl:value-of
1345                 select="translate(substring(normalize-space(name), 1, 1),
1346                                   $lowercase, $uppercase)" />
1347         </xsl:for-each>
1348     </xsl:with-param>
1349 </xsl:call-template>
1350 </xsl:template>
1351 <!-- /directive-startletters -->
1352
1353
1354 <!-- ==================================================================== -->
1355 <!-- squeeze subsequent letters in a string                               -->
1356 <!-- ==================================================================== -->
1357 <xsl:template name="_squeeze-letters">
1358 <xsl:param name="letters"/>
1359 <xsl:param name="lastletter"/>
1360
1361 <xsl:variable name="current" select="substring($letters, 1, 1)" />
1362
1363 <xsl:if test="not($lastletter = $current)">
1364     <xsl:value-of select="$current" />
1365 </xsl:if>
1366
1367 <xsl:if test="string-length($letters) &gt; 1">
1368     <xsl:call-template name="_squeeze-letters">
1369         <xsl:with-param name="letters" select="substring($letters, 2)" />
1370         <xsl:with-param name="lastletter" select="$current"/>
1371     </xsl:call-template>
1372 </xsl:if>
1373 </xsl:template>
1374 <!-- /_squeeze-letters -->
1375
1376
1377 <!-- ==================================================================== -->
1378 <!-- fix href and target attribute of an element.                         -->
1379 <!-- ==================================================================== -->
1380 <xsl:template name="helper.uri.fix">
1381 <xsl:param name="uri"/>
1382
1383 <xsl:choose>
1384 <!-- lame is_absolute_uri test -->
1385 <xsl:when test="    contains($uri, ':')
1386                 and string-length(substring-before($uri, ':')) &lt; 7">
1387     <xsl:if test="$ext-target">
1388         <xsl:attribute name="target">_blank</xsl:attribute>
1389     </xsl:if>
1390 </xsl:when>
1391 <xsl:otherwise>
1392     <xsl:variable name="fragment">
1393         <xsl:if test="contains($uri, '#')">
1394             <xsl:value-of select="concat('#', substring-after($uri, '#'))"/>
1395         </xsl:if>
1396     </xsl:variable>
1397     <xsl:variable name="absuri">
1398         <xsl:choose>
1399         <xsl:when test="contains($uri, '#')">
1400             <xsl:value-of select="concat('#', substring-before($uri, '#'))"/>
1401         </xsl:when>
1402         <xsl:otherwise>
1403             <xsl:value-of select="$uri"/>
1404         </xsl:otherwise>
1405         </xsl:choose>
1406     </xsl:variable>
1407         
1408     <xsl:if test="substring($absuri, string-length($uri), 1) = '/'">
1409         <xsl:attribute name="href">
1410             <xsl:value-of select="concat($absuri, $index-file, $fragment)"/>
1411         </xsl:attribute>
1412     </xsl:if>
1413 </xsl:otherwise>
1414 </xsl:choose>
1415 </xsl:template>
1416 <!-- /helper.uri.fix -->
1417
1418
1419 <!-- ==================================================================== -->
1420 <!-- Ignore table hints used for latex                                    -->
1421 <!-- ==================================================================== -->
1422 <xsl:template match="columnspec">
1423 </xsl:template>
1424
1425 <xsl:template match="column">
1426 </xsl:template>
1427
1428 </xsl:stylesheet>