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
11 http://www.apache.org/licenses/LICENSE-2.0
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.
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">
27 <xsl:stylesheet version="1.0"
28 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
29 xmlns="http://www.w3.org/1999/xhtml">
32 <!-- Please, don't hard-code output strings! Use the language -->
33 <!-- files and the translation "stuff"... -->
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 -->
45 <!-- Constants used for case translation -->
46 <xsl:variable name="lowercase" select="'abcdefghijklmnopqrstuvwxyz'" />
47 <xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
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
55 <!-- relative path to /manual/ -->
56 <xsl:variable name="metafile" select="document(/*/@metafile)/metafile" />
57 <xsl:variable name="path" select="$metafile/relpath" />
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" />
70 <!-- load utility snippets -->
71 <xsl:include href="util/modtrans.xsl" />
72 <xsl:include href="util/pretrim.xsl" />
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)" />
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>
85 <!-- it may be desired to open external targets in a new window -->
86 <xsl:variable name="ext-target" select="boolean($is-chm)" />
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.
95 <xsl:apply-templates />
99 <!-- #################################################################### -->
100 <!-- Utility templates for constructing pages -->
101 <!-- #################################################################### -->
103 <!-- ==================================================================== -->
105 <!-- ==================================================================== -->
106 <xsl:template name="head">
109 <meta http-equiv="Content-Type"
110 content="text/html; charset={$output-encoding}" />&lf;
111 <xsl:if test="not($is-chm or $is-zip)">
114 <xsl:text> </xsl:text>
115 <xsl:text>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</xsl:text>
116 <xsl:text>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</xsl:text>
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>
122 <xsl:text> </xsl:text>
123 <xsl:text>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</xsl:text>
124 <xsl:text>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</xsl:text>
126 <xsl:text> </xsl:text>
132 <xsl:when test="name">
133 <xsl:value-of select="name"/>
137 <xsl:value-of select="title"/>
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'])"/>
147 <!-- chm files get a slightly different stylesheet -->
149 <xsl:when test="$is-chm">
150 <link type="text/css" rel="stylesheet" media="all"
151 href="{$path}/style/css/manual-chm.css" />
153 <!-- zip packages do also -->
154 <xsl:when test="$is-zip">
155 <link title="Main stylesheet" type="text/css" media="all"
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"/>
163 <link title="Main stylesheet" type="text/css" media="all"
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"/>
173 <link type="text/css" media="print"
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">
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')}"/>
189 <link rel="canonical" href="http://httpd.apache.org/docs/current{concat($metafile/path, $metafile/basename, '.html')}"/>
199 <!-- ==================================================================== -->
201 <!-- ==================================================================== -->
202 <xsl:template name="top">
203 <div id="page-header">&lf;
204 <xsl:call-template name="super-menu" />&lf;
207 <xsl:value-of select="normalize-space($message
208 [@id='apachehttpserver'])"/>
211 <img src="{$path}/images/feather.png" alt="" />
212 </div>&lf; <!-- /page-header -->
215 <a href="./{$index-file}">
216 <xsl:if test="parentdocument">
217 <xsl:attribute name="href">
218 <xsl:value-of select="parentdocument/@href"/>
221 <xsl:call-template name="helper.uri.fix">
222 <xsl:with-param name="uri" select="parentdocument/@href" />
226 <img src="{$path}/images/left.gif" alt="<-" title="<-" />
231 <a href="http://www.apache.org/">
232 <xsl:if test="$ext-target">
233 <xsl:attribute name="target">_blank</xsl:attribute>
235 <xsl:value-of select="$message[@id='apache']" />
238 <xsl:text> > </xsl:text>
240 <a href="http://httpd.apache.org/">
241 <xsl:if test="$ext-target">
242 <xsl:attribute name="target">_blank</xsl:attribute>
244 <xsl:value-of select="$message[@id='http-server']" />
247 <xsl:text> > </xsl:text>
249 <a href="http://httpd.apache.org/docs/">
250 <xsl:if test="$ext-target">
251 <xsl:attribute name="target">_blank</xsl:attribute>
253 <xsl:value-of select="$message[@id='documentation']" />
256 <xsl:if test="not(../indexpage)">
257 <xsl:text> > </xsl:text>
259 <a href="{$path}/{$index-file}">
260 <xsl:value-of select="$message[@id='version']"/>
264 <xsl:if test="../modulesynopsis or ../directiveindex or ../quickreference">
265 <xsl:text> > </xsl:text>
267 <a href="./{$index-file}">
268 <xsl:value-of select="$message[@id='modules']"/>
272 <xsl:if test="parentdocument/text()">
273 <xsl:text> > </xsl:text>
275 <a href="{parentdocument/@href}">
276 <xsl:call-template name="helper.uri.fix">
277 <xsl:with-param name="uri" select="parentdocument/@href"/>
279 <xsl:value-of select="parentdocument"/>
282 </div> <!-- /path -->
287 <!-- ==================================================================== -->
289 <!-- ==================================================================== -->
290 <xsl:template name="retired">
291 <xsl:if test="$is-retired">
292 <xsl:variable name="base">
294 <xsl:when test="$upgrade">
295 <xsl:if test="not(/*/@upgrade = '')">
296 <xsl:value-of select="/*/@upgrade" />
301 select="$metafile/basename" />
305 <xsl:variable name="future">
307 <xsl:when test="$base = 'index'">
308 <xsl:value-of select="$metafile/path" />
310 <xsl:when test="$base = ''">
314 <xsl:value-of select="concat($metafile/path, $base, '.html')" />
319 <div class="retired">
320 <h4><xsl:value-of select="$message[@id='retired.headline']" /></h4>
321 <xsl:apply-templates select="$message[@id='retired.description']" />
323 <li><a href="http://httpd.apache.org/docs/current/">
324 <xsl:value-of select="$message[@id='retired.current']" /></a>
327 <xsl:if test="not($future = '')">
328 <p><xsl:apply-templates select="$message[@id='retired.document']" mode="retired" /></p>
335 <xsl:template match="message">
336 <xsl:apply-templates />
339 <xsl:template match="link" mode="retired">
340 <xsl:variable name="base">
342 <xsl:when test="$upgrade">
343 <xsl:if test="not(/*/@upgrade = '')">
344 <xsl:value-of select="/*/@upgrade" />
349 select="$metafile/basename" />
353 <xsl:variable name="future">
355 <xsl:when test="$base = 'index'">
356 <xsl:value-of select="$metafile/path" />
358 <xsl:when test="$base = ''">
362 <xsl:value-of select="concat($metafile/path, $base, '.html')" />
367 <a href="http://httpd.apache.org/docs/current{$future}">
368 <xsl:apply-templates />
373 <!-- ==================================================================== -->
375 <!-- ==================================================================== -->
376 <xsl:template name="outofdate">
377 <xsl:if test="$metafile/variants/variant[.=$doclang]/@outdated = 'yes'">
379 <div class="outofdate">
380 <xsl:value-of select="$message[@id='outofdate']"/>
386 <!-- ==================================================================== -->
388 <!-- ==================================================================== -->
389 <xsl:template name="bottom">
390 <xsl:call-template name="langavail">
391 <xsl:with-param name="position" select="'bottom'" />
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&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[';
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';
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);
413 d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
415 })(window, document);
416 //--><!]]]]>></xsl:text></script>
420 <div id="footer">&lf;
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>
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>
432 <xsl:text>Apache License, Version 2.0</xsl:text>
434 <xsl:if test="normalize-space($message[@id='after-license'])">
435 <xsl:text> </xsl:text>
436 <xsl:value-of select="$message[@id='after-license']"/>
439 <xsl:text>.</xsl:text>
441 <xsl:call-template name="super-menu"/>
443 </div> <!-- /footer -->
445 <script type="text/javascript">
446 <xsl:text disable-output-escaping="yes"><![CDATA[<!--//--><![CDATA[//><!--
447 if (typeof(prettyPrint) !== 'undefined') {
450 //--><!]]]]>></xsl:text></script>
455 <!-- ==================================================================== -->
456 <!-- build an "available languages" section -->
457 <!-- ==================================================================== -->
458 <xsl:template name="langavail">
459 <xsl:param name="position" select="'top'" />
461 <xsl:if test="not($is-chm or $is-zip)">
462 <div class="{$position}lang">&lf;
465 <xsl:value-of select="$message[@id='langavail']" />
466 <xsl:text>: </xsl:text>
469 <xsl:for-each select="$metafile/variants/variant">
470 <xsl:sort select="." />
472 <a href="{$path}/{.}{$metafile/path}{$metafile/basename}.html">
473 <xsl:if test="$metafile/basename = 'index'">
474 <xsl:attribute name="href">
476 select="concat($path, '/', ., $metafile/path)" />
479 <xsl:if test="$doclang != .">
480 <xsl:attribute name="hreflang">
481 <xsl:value-of select="." />
483 <xsl:attribute name="rel">alternate</xsl:attribute>
485 <xsl:attribute name="title">
486 <xsl:value-of select="document(concat('../lang/', .,
488 /language/messages/message
489 [@id='nativename']" />
493 <xsl:value-of select="." />
496 <xsl:if test="position() != last()">
497 <xsl:text> |
</xsl:text>
501 </div> <!-- /.{$position}lang -->
504 <xsl:if test="$position = 'top'">
505 <xsl:call-template name="outofdate" />
512 <!-- ==================================================================== -->
513 <!-- Process a documentation section -->
514 <!-- ==================================================================== -->
515 <xsl:template match="section">
516 <xsl:call-template name="toplink" />&lf;
517 <div class="section">&lf;
519 <!-- Section heading -->
522 <xsl:when test="@id">
523 <a id="{@id}" name="{@id}">
524 <xsl:apply-templates select="title" mode="print" />
526 <xsl:text> </xsl:text>
527 <a class="permalink" href="#{@id}" title="{$message[@id='permalink']}">¶</a>
531 <xsl:apply-templates select="title" mode="print" />
536 <!-- Section body -->
537 <xsl:apply-templates />
538 </div> <!-- /.section -->
543 <!-- ==================================================================== -->
544 <!-- handle subsections (lower level headings) -->
545 <!-- ==================================================================== -->
546 <xsl:template match="section/section" priority="3">
547 <!-- Section heading -->
550 <xsl:when test="@id">
551 <a id="{@id}" name="{@id}">
552 <xsl:apply-templates select="title" mode="print" />
557 <xsl:apply-templates select="title" mode="print" />
562 <!-- Section body -->
563 <xsl:apply-templates />
565 <!-- /section/section -->
568 <!-- ==================================================================== -->
569 <!-- handle subsubsections (h4) -->
570 <!-- ==================================================================== -->
571 <xsl:template match="section/section/section" priority="4">
572 <!-- Section heading -->
575 <xsl:when test="@id">
576 <a id="{@id}" name="{@id}">
577 <xsl:apply-templates select="title" mode="print" />
582 <xsl:apply-templates select="title" mode="print" />
587 <!-- Section body -->
588 <xsl:apply-templates/>
591 <!-- /section/section/section -->
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>
601 <xsl:text>Perhaps you should consider to split your document into</xsl:text>
603 <xsl:text>several ones...</xsl:text>
607 <!-- /section/section/section/section -->
611 <!-- ==================================================================== -->
612 <!-- Render trimmed pre/highlight-text -->
613 <!-- ==================================================================== -->
614 <xsl:template name="pre">
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()]" />
632 <!-- multiple nodes -->
634 <xsl:variable name="from">
636 <xsl:when test="node()[position() = 1 and self::text()]">
637 <xsl:value-of select="2" />
640 <xsl:value-of select="1" />
644 <xsl:variable name="to">
646 <xsl:when test="node()[position() = last() and self::text()]">
647 <xsl:value-of select="count(node()) - 1" />
650 <xsl:value-of select="count(node())" />
655 <xsl:if test="$from = 2">
657 <xsl:when test="text()[contains(., '
')]">
658 <xsl:call-template name="pre-ltrim">
659 <xsl:with-param name="string"
660 select="node()[position() = 1 and self::text()]" />
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))" />
670 <xsl:apply-templates select="node()[position() >= $from and position() <= $to]" />
672 <xsl:if test="$to < count(node())">
673 <xsl:call-template name="pre-rtrim">
674 <xsl:with-param name="string"
675 select="node()[position() = last() and self::text()]" />
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 -->
694 <!-- ==================================================================== -->
695 <!-- (sub)section titles -->
696 <!-- ==================================================================== -->
697 <xsl:template match="section/title" mode="print">
698 <xsl:apply-templates/>
700 <xsl:template match="section/title" />
701 <!-- /section/title -->
704 <!-- ==================================================================== -->
705 <!-- generate section index -->
706 <!-- ==================================================================== -->
707 <xsl:template match="section" mode="index">
709 <img src="{$path}/images/down.gif" alt="" />
710 <xsl:text> </xsl:text>
712 <xsl:when test="@id">
714 <xsl:apply-templates select="title" mode="print" />
718 <xsl:apply-templates select="title" mode="print" />
723 <!-- /section index -->
726 <!-- ==================================================================== -->
727 <!-- docs super menu -->
728 <!-- ==================================================================== -->
729 <xsl:template name="super-menu">
731 <a href="{$path}/mod/{$index-file}">
732 <xsl:value-of select="$message[@id='modules']" />
735 <xsl:text> | </xsl:text>
737 <a href="{$path}/mod/quickreference.html">
738 <xsl:value-of select="$message[@id='directives']" />
741 <xsl:text> | </xsl:text>
743 <a href="http://wiki.apache.org/httpd/FAQ">
744 <xsl:value-of select="$message[@id='faq']" />
747 <xsl:text> | </xsl:text>
749 <a href="{$path}/glossary.html">
750 <xsl:value-of select="$message[@id='glossary']" />
753 <xsl:text> | </xsl:text>
755 <a href="{$path}/sitemap.html">
756 <xsl:value-of select="$message[@id='sitemap']" />
763 <!-- ==================================================================== -->
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), ' ')" />
772 <xsl:template match="example">
773 <div class="example">
774 <xsl:apply-templates select="title" mode="print" />
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::*[
784 concat(' ', local-name(), ' '))])" />
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 ;-) -->
795 select="preceding-sibling::node()[
796 count(preceding-sibling::*[
798 concat(' ', local-name(), ' '))])
802 select="self::node()[not($is-block-node)]" />
805 <!-- apply bare text only, if it's not only \s or empty -->
806 <xsl:if test="not(normalize-space($content) = '')">
808 <!-- same as $content above. xsl:copy-of seems to make -->
809 <!-- thread problems with xalan-j ... -->
811 select="preceding-sibling::node()[
812 count(preceding-sibling::*[
814 concat(' ', local-name(),
819 select="self::node()[not($is-block-node)]" />
823 <xsl:apply-templates select="self::node()[$is-block-node]" />
827 </div> <!-- /.example -->
832 <!-- ==================================================================== -->
833 <!-- example/title -->
834 <!-- ==================================================================== -->
835 <xsl:template match="example/title" mode="print">
837 <xsl:apply-templates/>
840 <xsl:template match="example/title" />
841 <!-- /example/title -->
844 <!-- ==================================================================== -->
845 <!-- indentations -->
846 <!-- ==================================================================== -->
847 <xsl:template match="indent">
848 <span class="indent">
849 <xsl:apply-templates/>
855 <!-- ==================================================================== -->
857 <!-- ==================================================================== -->
858 <xsl:template match="note">
860 <xsl:if test="@type='warning'">
861 <xsl:attribute name="class">warning</xsl:attribute>
864 <xsl:apply-templates/>
870 <!-- ==================================================================== -->
871 <!-- <note><title> -->
872 <!-- ==================================================================== -->
873 <xsl:template match="note/title">
875 <xsl:apply-templates/>
881 <!-- ==================================================================== -->
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">
889 <xsl:when test="@module">
890 <xsl:variable name="lowerdirective">
892 <xsl:when test="@name">
893 <xsl:value-of select="normalize-space(concat(translate(@name,
894 $uppercase, $lowercase),@idtype))" />
897 <xsl:value-of select="normalize-space(concat(translate(.,
898 $uppercase, $lowercase),@idtype))" />
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'"><</xsl:if>
907 <xsl:value-of select="."/>
908 <xsl:if test="@type='section'">></xsl:if>
909 <xsl:message>Removing link to '<xsl:value-of select="."/>'</xsl:message>
911 <xsl:when test="$in-modulesynopsis and normalize-space(@module) = /modulesynopsis/name">
912 <a href="#{$lowerdirective}">
913 <xsl:if test="@type='section'"><</xsl:if>
914 <xsl:value-of select="."/>
915 <xsl:if test="@type='section'">></xsl:if>
919 <a href="{$path}/mod/{normalize-space(@module)}.html#{$lowerdirective}">
920 <xsl:if test="@type='section'"><</xsl:if>
921 <xsl:value-of select="."/>
922 <xsl:if test="@type='section'">></xsl:if>
929 <xsl:if test="@type='section'"><</xsl:if>
930 <xsl:value-of select="."/>
931 <xsl:if test="@type='section'">></xsl:if>
932 <!-- Missing module reference -->
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>
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>
950 <!-- ==================================================================== -->
952 <!-- Inserts a link to refereed module -->
953 <!-- ==================================================================== -->
954 <xsl:template match="module" name="module">
955 <code class="module">
957 <xsl:when test="@outdated = 'true'">
958 <xsl:value-of select="."/>
961 <a href="{$path}/mod/{normalize-space(.)}.html">
962 <xsl:value-of select="."/>
971 <!-- ==================================================================== -->
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(.)" />
985 <!-- ==================================================================== -->
987 <!-- ==================================================================== -->
988 <xsl:template match="related">
989 <table class="related">
992 <xsl:value-of select="$message[@id='relatedmodules']" />
995 <xsl:value-of select="$message[@id='relateddirectives']" />
1000 <xsl:if test="count(modulelist/*) > 0">
1002 <xsl:apply-templates select="modulelist" />
1007 <xsl:if test="count(directivelist/*) > 0">
1009 <xsl:apply-templates select="directivelist"/>
1018 <!-- ==================================================================== -->
1019 <!-- related/modulelist -->
1020 <!-- ==================================================================== -->
1021 <xsl:template match="related/modulelist">
1022 <xsl:for-each select="module">
1024 <xsl:call-template name="module"/>
1028 <!-- /related/modulelist -->
1031 <!-- ==================================================================== -->
1032 <!-- related/directivelist -->
1033 <!-- ==================================================================== -->
1034 <xsl:template match="related/directivelist">
1035 <xsl:for-each select="directive">
1037 <xsl:call-template name="directive"/>
1041 <!-- /related/directivelist -->
1044 <!-- ==================================================================== -->
1046 <!-- ==================================================================== -->
1047 <xsl:template match="table">
1049 <!-- existing border attribute will result in <table class="bordered"> -->
1050 <xsl:if test="@border">
1051 <xsl:attribute name="class">bordered</xsl:attribute>
1055 <xsl:when test="@style = 'zebra'">
1056 <xsl:apply-templates select="tr" mode="zebra-table" />
1058 <xsl:when test="@style = 'data'">
1059 <xsl:apply-templates select="tr" mode="data-table" />
1062 <xsl:apply-templates />
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])" />
1076 <xsl:for-each select="node()">
1078 <xsl:when test="local-name() = 'td'">
1080 <xsl:apply-templates select="*|@*|text()" />
1083 <xsl:when test="local-name() = 'th' and
1084 (not($cross-table) or
1085 count(preceding-sibling::*) > 0)">
1087 <xsl:apply-templates select="*|@*|text()" />
1091 <xsl:apply-templates select="self::node()" />
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. -->
1109 <xsl:when test="count(td) = 0">
1110 <xsl:attribute name="class">header</xsl:attribute>
1113 <xsl:when test="position() mod 2 = (count(preceding-sibling::tr[count(td) = 0]) mod 2)">
1114 <xsl:attribute name="class">odd</xsl:attribute>
1118 <xsl:apply-templates />
1121 <!-- /zebra-table -->
1124 <!-- ==================================================================== -->
1126 <!-- ==================================================================== -->
1127 <xsl:template match="ol">
1129 <!-- A. B. C. D. (list-style-type="upper-alpha") -->
1131 <xsl:when test="@type = 'A'">
1132 <xsl:attribute name="class">up-A</xsl:attribute>
1134 <xsl:when test="@type = 'a'">
1135 <xsl:attribute name="class">lo-A</xsl:attribute>
1139 <xsl:apply-templates/>
1145 <!-- ==================================================================== -->
1146 <!-- diverse elements -->
1147 <!-- Passes through content -->
1148 <!-- ==================================================================== -->
1149 <xsl:template match="summary|description|usage|syntax|default">
1150 <xsl:apply-templates/>
1155 <!-- ==================================================================== -->
1157 <!-- ==================================================================== -->
1158 <xsl:template match="a">
1160 <xsl:when test="not(@href)">
1162 <xsl:apply-templates select="@*|*|text()"/>
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>
1172 <xsl:apply-templates select="*|text()"/>
1180 <!-- ==================================================================== -->
1182 <!-- ==================================================================== -->
1183 <xsl:template name="toplink">
1185 <a href="#page-header"><img src="{$path}/images/up.gif" alt="top" /></a>
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>
1199 <xsl:value-of select="$message[@id='transnote']" />
1201 <xsl:text> </xsl:text>
1202 <xsl:apply-templates />
1203 <xsl:text>)</xsl:text>
1208 <!-- ==================================================================== -->
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>
1223 <!-- ==================================================================== -->
1225 <!-- link to a glossary anchor -->
1226 <!-- ==================================================================== -->
1227 <xsl:template match="glossary">
1228 <xsl:variable name="glosslink">
1230 <xsl:when test="@ref">
1231 <xsl:value-of select="@ref"/>
1234 <xsl:value-of select="translate(., $uppercase, $lowercase)"/>
1239 <a href="{$path}/glossary.html#{$glosslink}" class="glossarylink">
1240 <xsl:attribute name="title">
1241 <xsl:value-of select="$message[@id='glossarylink']" />
1243 <xsl:apply-templates />
1248 <!-- ==================================================================== -->
1249 <!-- Filter   in text() nodes. -->
1250 <!-- In some environments this character won't be transformed correctly, -->
1251 <!-- so we just write it explicitely as " " into the output. -->
1252 <!-- ==================================================================== -->
1253 <xsl:template match="text()" name="filter.nbsp">
1254 <xsl:param name="text" select="." />
1257 <xsl:when test="contains($text, ' ')">
1258 <xsl:value-of select="substring-before($text, ' ')" />
1260 <xsl:call-template name="filter.nbsp">
1261 <xsl:with-param name="text" select="substring-after($text, ' ')" />
1262 </xsl:call-template>
1265 <xsl:value-of select="$text" />
1269 <!-- /filter.nbsp -->
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>
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 -->
1306 <!-- ==================================================================== -->
1307 <!-- create a letter bar -->
1308 <!-- ==================================================================== -->
1309 <xsl:template name="letter-bar">
1310 <xsl:param name="letters" />
1311 <xsl:param name="first" />
1313 <xsl:if test="not($first)">
1314 <xsl:text> | </xsl:text>
1317 <a href="#{substring($letters,1,1)}">
1319 <xsl:value-of select="substring($letters, 1, 1)" />
1323 <xsl:if test="string-length($letters) > 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>
1330 <!-- /letter-bar -->
1333 <!-- ==================================================================== -->
1334 <!-- template(s) for collecting all start letters of directives -->
1335 <!-- ==================================================================== -->
1336 <xsl:template name="directive-startletters">
1337 <xsl:param name="directives" />
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"/>
1345 select="translate(substring(normalize-space(name), 1, 1),
1346 $lowercase, $uppercase)" />
1349 </xsl:call-template>
1351 <!-- /directive-startletters -->
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"/>
1361 <xsl:variable name="current" select="substring($letters, 1, 1)" />
1363 <xsl:if test="not($lastletter = $current)">
1364 <xsl:value-of select="$current" />
1367 <xsl:if test="string-length($letters) > 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>
1374 <!-- /_squeeze-letters -->
1377 <!-- ==================================================================== -->
1378 <!-- fix href and target attribute of an element. -->
1379 <!-- ==================================================================== -->
1380 <xsl:template name="helper.uri.fix">
1381 <xsl:param name="uri"/>
1384 <!-- lame is_absolute_uri test -->
1385 <xsl:when test=" contains($uri, ':')
1386 and string-length(substring-before($uri, ':')) < 7">
1387 <xsl:if test="$ext-target">
1388 <xsl:attribute name="target">_blank</xsl:attribute>
1392 <xsl:variable name="fragment">
1393 <xsl:if test="contains($uri, '#')">
1394 <xsl:value-of select="concat('#', substring-after($uri, '#'))"/>
1397 <xsl:variable name="absuri">
1399 <xsl:when test="contains($uri, '#')">
1400 <xsl:value-of select="concat('#', substring-before($uri, '#'))"/>
1403 <xsl:value-of select="$uri"/>
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)"/>
1416 <!-- /helper.uri.fix -->
1419 <!-- ==================================================================== -->
1420 <!-- Ignore table hints used for latex -->
1421 <!-- ==================================================================== -->
1422 <xsl:template match="columnspec">
1425 <xsl:template match="column">