common.xsl revision d7e78dbedfc2093a291c4e52eda53c4cbdd606a1
2N/A<?xml version="1.0"?>
2N/A
2N/A<!--
2N/A Licensed to the Apache Software Foundation (ASF) under one or more
2N/A contributor license agreements. See the NOTICE file distributed with
2N/A this work for additional information regarding copyright ownership.
2N/A The ASF licenses this file to You under the Apache License, Version 2.0
2N/A (the "License"); you may not use this file except in compliance with
2N/A the License. You may obtain a copy of the License at
2N/A
2N/A http://www.apache.org/licenses/LICENSE-2.0
2N/A
2N/A Unless required by applicable law or agreed to in writing, software
2N/A distributed under the License is distributed on an "AS IS" BASIS,
2N/A WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2N/A See the License for the specific language governing permissions and
2N/A limitations under the License.
2N/A-->
2N/A
2N/A<!DOCTYPE xsl:stylesheet [
3783N/A <!ENTITY nbsp SYSTEM "util/nbsp.xml">
2N/A <!ENTITY lf SYSTEM "util/lf.xml">
2N/A <!ENTITY % HTTPD-VERSION SYSTEM "/version.ent">
32N/A %HTTPD-VERSION;
32N/A]>
313N/A<xsl:stylesheet version="1.0"
313N/A xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
313N/A xmlns="http://www.w3.org/1999/xhtml">
313N/A
313N/A<!-- -->
313N/A<!-- Please, don't hard-code output strings! Use the language -->
313N/A<!-- files and the translation "stuff"... -->
313N/A<!-- -->
313N/A
2238N/A<!-- Injected variables: -->
313N/A<!-- $is-chm - (boolean) target is for CHM generation or not -->
313N/A<!-- $is-zip - (boolean) target is for ZIP generation or not -->
313N/A<!-- $message - (node-set) localized common text snippets -->
313N/A<!-- $doclang - (string) document language -->
2238N/A<!-- $output-encoding - (string) MIME charset name of the output -->
313N/A<!-- encoding -->
2238N/A
127N/A<!-- Constants used for case translation -->
127N/A<xsl:variable name="lowercase" select="'abcdefghijklmnopqrstuvwxyz'" />
1622N/A<xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
1622N/A
1622N/A<!-- space separated list of blockelements defined in common.dtd -->
127N/A<!-- used for inline content catching in <example>s -->
538N/A<xsl:variable name="blockelements">
538N/A p example note table ul ol dl pre highlight img blockquote
538N/A</xsl:variable>
538N/A
538N/A<!-- relative path to /manual/ -->
538N/A<xsl:variable name="metafile" select="document(/*/@metafile)/metafile" />
538N/A<xsl:variable name="path" select="$metafile/relpath" />
538N/A
327N/A<!-- load outsourced page types -->
327N/A<xsl:include href="moduleindex.xsl" />
327N/A<xsl:include href="directiveindex.xsl" />
327N/A<xsl:include href="manualpage.xsl" />
327N/A<xsl:include href="synopsis.xsl" />
327N/A<xsl:include href="sitemap.xsl" />
327N/A<xsl:include href="indexpage.xsl" />
327N/A<xsl:include href="quickreference.xsl" />
327N/A<xsl:include href="faq.xsl" />
327N/A
327N/A<!-- load utility snippets -->
327N/A<xsl:include href="util/modtrans.xsl" />
2238N/A
2238N/A<!-- make sure, we set relative anchors only, if we're actually -->
2238N/A<!-- transforming a modulefile (see <directive> template) -->
2238N/A<xsl:variable name="in-modulesynopsis" select="boolean(/modulesynopsis)" />
177N/A
177N/A<!-- when referencing to a directory, we may need to complete the path -->
2N/A<!-- with the index file (for offline applications like *.chm files) -->
145N/A<xsl:variable name="index-file">
883N/A <xsl:if test="$is-chm or $is-zip">index.html</xsl:if>
26N/A</xsl:variable>
38N/A
38N/A<!-- it may be desired to open external targets in a new window -->
1622N/A<xsl:variable name="ext-target" select="boolean($is-chm)" />
26N/A
477N/A<xsl:template match="/">
538N/A <xsl:if test="not($metafile/@reference)">
38N/A <xsl:message terminate="yes">
2N/A Invalid metafile. Probably your build system is not up-to-date.
6N/A Get a current version and try again.
3778N/A </xsl:message>
3778N/A </xsl:if>
3778N/A <xsl:apply-templates />
3778N/A</xsl:template>
3778N/A
2N/A
3778N/A<!-- #################################################################### -->
3778N/A<!-- Utility templates for constructing pages -->
3778N/A<!-- #################################################################### -->
2N/A
34N/A<!-- ==================================================================== -->
34N/A<!-- HTML head -->
94N/A<!-- ==================================================================== -->
94N/A<xsl:template name="head">
156N/A<head>
156N/A <!-- the meta element is necessary for offline handling like CHM -->
34N/A <xsl:choose>
59N/A <xsl:when test="$is-chm or $is-zip">
1273N/A <meta http-equiv="Content-Type"
1273N/A content="text/html; charset={$output-encoding}" />
1622N/A </xsl:when>
72N/A <xsl:otherwise>
72N/A <xsl:comment>
59N/A &lf;
2N/A <xsl:text> </xsl:text>
85N/A <xsl:text>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</xsl:text>
61N/A <xsl:text>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</xsl:text>
61N/A &lf;
220N/A <xsl:text> </xsl:text>
61N/A <xsl:text>This file is generated from xml source: </xsl:text>
61N/A <xsl:text>DO NOT EDIT</xsl:text>
1762N/A &lf;
172N/A <xsl:text> </xsl:text>
61N/A <xsl:text>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</xsl:text>
61N/A <xsl:text>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</xsl:text>
220N/A &lf;
220N/A <xsl:text> </xsl:text>
61N/A </xsl:comment>
172N/A </xsl:otherwise>
454N/A </xsl:choose>&lf;
61N/A
172N/A <title>
61N/A <xsl:choose>
152N/A <xsl:when test="name">
74N/A <xsl:value-of select="name"/>
61N/A </xsl:when>
220N/A
85N/A <xsl:otherwise>
172N/A <xsl:value-of select="title"/>
61N/A </xsl:otherwise>
172N/A </xsl:choose>
61N/A
1762N/A <xsl:text> </xsl:text>
172N/A <xsl:value-of select="normalize-space($message[@id='apachetitle'])"/>
61N/A </title>&lf;
61N/A
220N/A <!-- chm files get a slightly different stylesheet -->
61N/A <xsl:choose>
454N/A <xsl:when test="$is-chm">
61N/A <link type="text/css" rel="stylesheet" media="all"
172N/A href="{$path}/style/css/manual-chm.css" />
61N/A </xsl:when>
172N/A <!-- zip packages do also -->
61N/A <xsl:when test="$is-zip">
152N/A <link title="Main stylesheet" type="text/css" media="all"
152N/A rel="stylesheet"
220N/A href="{$path}/style/css/manual-zip.css" />&lf;
61N/A <link title="No Sidebar - Default font size" type="text/css" media="all"
61N/A rel="alternate stylesheet"
43N/A href="{$path}/style/css/manual-zip-100pc.css"/>
220N/A </xsl:when>
43N/A <xsl:otherwise>
120N/A <link title="Main stylesheet" type="text/css" media="all"
64N/A rel="stylesheet"
64N/A href="{$path}/style/css/manual.css" />&lf;
64N/A <link title="No Sidebar - Default font size" type="text/css" media="all"
43N/A rel="alternate stylesheet"
43N/A href="{$path}/style/css/manual-loose-100pc.css"/>
120N/A
64N/A </xsl:otherwise>
64N/A </xsl:choose>&lf;
64N/A
220N/A <link type="text/css" media="print"
64N/A rel="stylesheet"
64N/A href="{$path}/style/css/manual-print.css"/>
486N/A <link href="{$path}/style/css/prettify.css" type="text/css" rel="stylesheet" />&lf;
486N/A <script type="text/javascript" src="{$path}/style/scripts/prettify.js">&lf;</script>&lf;
64N/A <!-- chm files do not need a favicon -->
64N/A <xsl:if test="not($is-chm or $is-zip)">&lf;
64N/A <link rel="shortcut icon" href="{$path}/images/favicon.ico" />
64N/A </xsl:if>
64N/A</head>
64N/A</xsl:template>
64N/A<!-- /head -->
43N/A
16N/A
16N/A<!-- ==================================================================== -->
16N/A<!-- page top -->
34N/A<!-- ==================================================================== -->
34N/A<xsl:template name="top">
16N/A<div id="page-header">&lf;
6N/A <xsl:call-template name="super-menu" />&lf;
12N/A
1622N/A <p class="apache">
12N/A <xsl:value-of select="normalize-space($message
12N/A [@id='apachehttpserver'])"/>
12N/A </p>&lf;
12N/A
12N/A <img src="{$path}/images/feather.gif" alt="" />
12N/A</div>&lf; <!-- /page-header -->
12N/A
12N/A<div class="up">
12N/A <a href="./{$index-file}">
369N/A <xsl:if test="parentdocument">
369N/A <xsl:attribute name="href">
3781N/A <xsl:value-of select="parentdocument/@href"/>
369N/A </xsl:attribute>
61N/A
61N/A <xsl:call-template name="helper.uri.fix">
61N/A <xsl:with-param name="uri" select="parentdocument/@href" />
61N/A </xsl:call-template>
61N/A </xsl:if>
12N/A
181N/A <img src="{$path}/images/left.gif" alt="&lt;-" title="&lt;-" />
181N/A </a>
12N/A</div>&lf;
61N/A
61N/A<div id="path">&lf;
12N/A <a href="http://www.apache.org/">
279N/A <xsl:if test="$ext-target">
279N/A <xsl:attribute name="target">_blank</xsl:attribute>
181N/A </xsl:if>
181N/A <xsl:value-of select="$message[@id='apache']" />
181N/A </a>
2N/A
99N/A <xsl:text> &gt; </xsl:text>
99N/A
99N/A <a href="http://httpd.apache.org/">
181N/A <xsl:if test="$ext-target">
181N/A <xsl:attribute name="target">_blank</xsl:attribute>
181N/A </xsl:if>
181N/A <xsl:value-of select="$message[@id='http-server']" />
181N/A </a>
99N/A
40N/A <xsl:text> &gt; </xsl:text>
844N/A
40N/A <a href="http://httpd.apache.org/docs/">
40N/A <xsl:if test="$ext-target">
43N/A <xsl:attribute name="target">_blank</xsl:attribute>
40N/A </xsl:if>
3442N/A <xsl:value-of select="$message[@id='documentation']" />
2238N/A </a>
2238N/A
814N/A <xsl:if test="not(/indexpage)">
814N/A <xsl:text> &gt; </xsl:text>
814N/A
814N/A <a href="{$path}/{$index-file}">
814N/A <xsl:value-of select="$message[@id='version']"/>
814N/A </a>
814N/A </xsl:if>
814N/A
2238N/A <xsl:if test="/modulesynopsis or /directiveindex or /quickreference">
2238N/A <xsl:text> &gt; </xsl:text>
2N/A
99N/A <a href="./{$index-file}">
206N/A <xsl:value-of select="$message[@id='modules']"/>
2N/A </a>
814N/A </xsl:if>
99N/A
206N/A <xsl:if test="parentdocument/text()">
2N/A <xsl:text> &gt; </xsl:text>
151N/A
206N/A <a href="{parentdocument/@href}">
2N/A <xsl:call-template name="helper.uri.fix">
151N/A <xsl:with-param name="uri" select="parentdocument/@href"/>
206N/A </xsl:call-template>
2N/A <xsl:value-of select="parentdocument"/>
2238N/A </a>
2238N/A </xsl:if>
2238N/A</div> <!-- /path -->
2238N/A</xsl:template>
2238N/A<!-- /top -->
2238N/A
2N/A
61N/A<!-- ==================================================================== -->
61N/A<!-- out of date -->
61N/A<!-- ==================================================================== -->
61N/A<xsl:template name="outofdate">
61N/A<xsl:if test="$metafile/variants/variant[.=$doclang]/@outdated = 'yes'">
16N/A &lf;
16N/A <div class="outofdate">
814N/A <xsl:value-of select="$message[@id='outofdate']"/>
2238N/A </div>
2238N/A</xsl:if>
2238N/A</xsl:template>
2238N/A
2238N/A
2238N/A<!-- ==================================================================== -->
2238N/A<!-- page bottom -->
2238N/A<!-- ==================================================================== -->
2238N/A<xsl:template name="bottom">
2238N/A<xsl:call-template name="langavail">
2238N/A <xsl:with-param name="position" select="'bottom'" />
2238N/A</xsl:call-template>
2238N/A<xsl:choose>
814N/A<xsl:when test="not($is-chm or $is-zip or $metafile/basename = 'index')">
814N/A<div class="top"><a href="#page-header"><img alt="top" src="{$path}/images/up.gif" /></a></div>
814N/A<div class="section">
814N/A<h2><a name="comments_section" id="comments_section"><xsl:value-of select="$message[@id='comments']" /></a></h2>
814N/A<div class="warning"><strong>This section is experimental!</strong><br/>Comments placed here should not be expected
2140N/Ato last beyond the testing phase of this system, nor do we in any way guarantee that we'll read them.</div>&lf;
2140N/A<script type="text/javascript">
2127N/A<xsl:text disable-output-escaping="yes"><![CDATA[<!--//--><![CDATA[//><!--
2127N/Avar disqus_shortname = 'httpd';
2127N/Avar disqus_identifier = 'http://httpd.apache.org/docs/]]></xsl:text>&httpd.disqus;<xsl:value-of select="concat($metafile/path, $metafile/basename, '.html.', $doclang)" disable-output-escaping="yes" /><xsl:text disable-output-escaping="yes"><![CDATA[';
3293N/A(function(w, d) {
3293N/A if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
3293N/A d.write('<div id="disqus_thread"><\/div>');
3293N/A var s = d.createElement('script');
2140N/A s.type = 'text/javascript';
3783N/A s.async = true;
3783N/A s.src = 'http' + '://' + disqus_shortname + '.disqus.com/embed.js';
3783N/A (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
3783N/A }
3783N/A else {
3783N/A d.write('<div id="disqus_thread">Comments have been disabled for offline viewing.<\/div>');
3783N/A }
3783N/A})(window, document);
3783N/A//--><!]]]]>></xsl:text></script>
3783N/A</div>
3783N/A</xsl:when>
148N/A</xsl:choose>
148N/A<div id="footer">&lf;
148N/A <p class="apache">
148N/A <xsl:text>Copyright 2012 The Apache Software Foundation.</xsl:text><br />
2N/A <xsl:if test="normalize-space($message[@id='before-license'])">
47N/A <xsl:value-of select="$message[@id='before-license']"/>
2N/A <xsl:text> </xsl:text>
727N/A </xsl:if>
727N/A
727N/A <a href="http://www.apache.org/licenses/LICENSE-2.0">
3778N/A <xsl:if test="$ext-target">
3778N/A <xsl:attribute name="target">_blank</xsl:attribute>
3778N/A </xsl:if>
3778N/A <xsl:text>Apache License, Version 2.0</xsl:text>
3778N/A </a>
3778N/A <xsl:if test="normalize-space($message[@id='after-license'])">
3778N/A <xsl:text> </xsl:text>
3778N/A <xsl:value-of select="$message[@id='after-license']"/>
1192N/A </xsl:if>
1192N/A
148N/A <xsl:text>.</xsl:text>
2N/A </p>&lf;
146N/A <xsl:call-template name="super-menu"/>
146N/A
146N/A</div> <!-- /footer -->
146N/A
727N/A<script type="text/javascript">
146N/A<xsl:text disable-output-escaping="yes"><![CDATA[<!--//--><![CDATA[//><!--
1653N/Aif (typeof(prettyPrint) !== 'undefined') {
1653N/A prettyPrint();
1653N/A}
116N/A//--><!]]]]>></xsl:text></script>
260N/A</xsl:template>
260N/A<!-- /bottom -->
277N/A
260N/A
260N/A<!-- ==================================================================== -->
260N/A<!-- build an "available languages" section -->
260N/A<!-- ==================================================================== -->
260N/A<xsl:template name="langavail">
1767N/A<xsl:param name="position" select="'top'" />
260N/A
260N/A<xsl:if test="not($is-chm or $is-zip)">
127N/A<div class="{$position}lang">&lf;
1622N/A <p>
1767N/A <span>
260N/A <xsl:value-of select="$message[@id='langavail']" />
260N/A <xsl:text>: </xsl:text>
260N/A </span>
260N/A
1622N/A <xsl:for-each select="$metafile/variants/variant">
1622N/A <xsl:sort select="." />
260N/A
260N/A <a href="{$path}/{.}{$metafile/path}{$metafile/basename}.html">
260N/A <xsl:if test="$metafile/basename = 'index'">
260N/A <xsl:attribute name="href">
1713N/A <xsl:value-of
1713N/A select="concat($path, '/', ., $metafile/path)" />
1713N/A </xsl:attribute>
1713N/A </xsl:if>
1713N/A <xsl:if test="$doclang != .">
1713N/A <xsl:attribute name="hreflang">
1713N/A <xsl:value-of select="." />
1713N/A </xsl:attribute>
1713N/A <xsl:attribute name="rel">alternate</xsl:attribute>
260N/A </xsl:if>
2N/A <xsl:attribute name="title">
2N/A <xsl:value-of select="document(concat('/lang/', .,
82N/A '.xml'))
99N/A /language/messages/message
99N/A [@id='nativename']" />
302N/A </xsl:attribute>
2N/A
105N/A &nbsp;
2N/A <xsl:value-of select="." />
2238N/A &nbsp;
2238N/A </a>
2238N/A <xsl:if test="position() != last()">
2238N/A <xsl:text> |&#xA;</xsl:text>
2238N/A </xsl:if>
2N/A </xsl:for-each>
160N/A </p>&lf;
160N/A</div> <!-- /.{$position}lang -->
160N/A</xsl:if>
160N/A
165N/A<xsl:if test="$position = 'top'">
2N/A <xsl:call-template name="outofdate" />
2N/A</xsl:if>
2N/A
7N/A</xsl:template>
142N/A<!-- /langavail -->
43N/A
43N/A
16N/A<!-- ==================================================================== -->
43N/A<!-- Process a documentation section -->
138N/A<!-- ==================================================================== -->
224N/A<xsl:template match="section">
224N/A<xsl:call-template name="toplink" />&lf;
61N/A<div class="section">&lf;
61N/A
61N/A <!-- Section heading -->
61N/A <h2>
206N/A <xsl:choose>
206N/A <xsl:when test="@id">
1192N/A <a id="{@id}" name="{@id}">
206N/A <xsl:apply-templates select="title" mode="print" />
206N/A </a>
61N/A </xsl:when>
99N/A
99N/A <xsl:otherwise>
99N/A <xsl:apply-templates select="title" mode="print" />
99N/A </xsl:otherwise>
99N/A </xsl:choose>
99N/A </h2>
99N/A
99N/A <!-- Section body -->
99N/A <xsl:apply-templates />
61N/A</div> <!-- /.section -->
99N/A</xsl:template>
99N/A<!-- /section -->
1622N/A
1622N/A
99N/A<!-- ==================================================================== -->
61N/A<!-- handle subsections (lower level headings) -->
99N/A<!-- ==================================================================== -->
99N/A<xsl:template match="section/section">
99N/A<!-- Section heading -->
99N/A<h3>
61N/A <xsl:choose>
61N/A <xsl:when test="@id">
61N/A <a id="{@id}" name="{@id}">
61N/A <xsl:apply-templates select="title" mode="print" />
99N/A </a>
99N/A </xsl:when>
99N/A
99N/A <xsl:otherwise>
200N/A <xsl:apply-templates select="title" mode="print" />
200N/A </xsl:otherwise>
200N/A </xsl:choose>
99N/A</h3>
99N/A
99N/A<!-- Section body -->
99N/A<xsl:apply-templates />
99N/A</xsl:template>
99N/A<!-- /section/section -->
99N/A
99N/A
99N/A<!-- ==================================================================== -->
99N/A<!-- handle subsubsections (h4) -->
99N/A<!-- ==================================================================== -->
99N/A<xsl:template match="section/section/section">
99N/A<!-- Section heading -->
839N/A<h4>
839N/A <xsl:choose>
839N/A <xsl:when test="@id">
839N/A <a id="{@id}" name="{@id}">
839N/A <xsl:apply-templates select="title" mode="print" />
102N/A </a>
108N/A </xsl:when>
102N/A
61N/A <xsl:otherwise>
99N/A <xsl:apply-templates select="title" mode="print" />
99N/A </xsl:otherwise>
99N/A </xsl:choose>
99N/A</h4>
99N/A
99N/A<!-- Section body -->
99N/A<xsl:apply-templates/>
99N/A
99N/A</xsl:template>
99N/A<!-- /section/section/section -->
99N/A
99N/A
99N/A<!-- ==================================================================== -->
99N/A<!-- section nesting > h4 is not supported for now -->
99N/A<!-- ==================================================================== -->
200N/A<xsl:template match="section/section/section/section">
200N/A<xsl:message terminate="yes">
200N/A <xsl:text>FATAL: exceeding maximum section nesting level.</xsl:text>
200N/A &lf;&lf;
200N/A <xsl:text>Perhaps you should consider to split your document into</xsl:text>
200N/A &lf;
200N/A <xsl:text>several ones...</xsl:text>
200N/A &lf;
200N/A</xsl:message>
200N/A</xsl:template>
99N/A<!-- /section/section/section/section -->
99N/A
99N/A
99N/A<!-- ==================================================================== -->
99N/A<!-- Process source code highlighting -->
102N/A<!-- ==================================================================== -->
102N/A<xsl:template match="highlight">
102N/A<pre class="prettyprint lang-{@language}">
102N/A <!-- highlight body -->
102N/A <xsl:apply-templates />
99N/A</pre>&lf; <!-- /.highlight -->
99N/A</xsl:template>
99N/A<!-- /higlight -->
61N/A
61N/A
61N/A<!-- ==================================================================== -->
61N/A<!-- (sub)section titles -->
99N/A<!-- ==================================================================== -->
99N/A<xsl:template match="section/title" mode="print">
102N/A<xsl:apply-templates/>
99N/A</xsl:template>
99N/A<xsl:template match="section/title" />
99N/A<!-- /section/title -->
99N/A
459N/A
459N/A<!-- ==================================================================== -->
459N/A<!-- generate section index -->
459N/A<!-- ==================================================================== -->
459N/A<xsl:template match="section" mode="index">
459N/A<li>
459N/A <img src="{$path}/images/down.gif" alt="" />
99N/A <xsl:text> </xsl:text>
102N/A <xsl:choose>
99N/A <xsl:when test="@id">
459N/A <a href="#{@id}">
459N/A <xsl:apply-templates select="title" mode="print" />
459N/A </a>
459N/A </xsl:when>
109N/A <xsl:otherwise>
109N/A <xsl:apply-templates select="title" mode="print" />
109N/A </xsl:otherwise>
109N/A </xsl:choose>
109N/A</li>&lf;
109N/A</xsl:template>
109N/A<!-- /section index -->
109N/A
109N/A
109N/A<!-- ==================================================================== -->
109N/A<!-- docs super menu -->
109N/A<!-- ==================================================================== -->
99N/A<xsl:template name="super-menu">
99N/A<p class="menu">
99N/A <a href="{$path}/mod/{$index-file}">
99N/A <xsl:value-of select="$message[@id='modules']" />
200N/A </a>
200N/A
200N/A <xsl:text> | </xsl:text>
200N/A
99N/A <a href="{$path}/mod/directives.html">
99N/A <xsl:value-of select="$message[@id='directives']" />
99N/A </a>
99N/A
99N/A <xsl:text> | </xsl:text>
99N/A
109N/A <a href="http://wiki.apache.org/httpd/FAQ">
109N/A <xsl:value-of select="$message[@id='faq']" />
61N/A </a>
99N/A
99N/A <xsl:text> | </xsl:text>
99N/A
99N/A <a href="{$path}/glossary.html">
99N/A <xsl:value-of select="$message[@id='glossary']" />
99N/A </a>
99N/A
99N/A <xsl:text> | </xsl:text>
99N/A
99N/A <a href="{$path}/sitemap.html">
99N/A <xsl:value-of select="$message[@id='sitemap']" />
61N/A </a>
99N/A</p>
99N/A</xsl:template>
99N/A<!-- /super-menu -->
99N/A
99N/A
99N/A<!-- ==================================================================== -->
99N/A<!-- <example> -->
99N/A<!-- iterate over *all* nodes; bare text and other inline stuff is -->
99N/A<!-- wrapped into <p><code>, block level elements (defined in -->
99N/A<!-- $blockelements) are applied "as is" -->
99N/A<!-- ==================================================================== -->
459N/A<xsl:variable name="blocks"
2238N/A select="concat(' ', normalize-space($blockelements), ' ')" />
2238N/A
99N/A<xsl:template match="example">
99N/A<div class="example">
99N/A <xsl:apply-templates select="title" mode="print" />
99N/A
99N/A <xsl:for-each select="/node()">
99N/A <xsl:variable name="is-block-node"
99N/A select="boolean(contains($blocks,
61N/A concat(' ', local-name(), ' ')))"/>
99N/A <!-- bb = (number of) blocks nodes before (the current) -->
206N/A <xsl:variable name="bb"
206N/A select="count(preceding-sibling::*[
206N/A contains($blocks,
206N/A concat(' ', local-name(), ' '))])" />
206N/A
206N/A <xsl:if test="$is-block-node or position()=last()">
206N/A <xsl:variable name="content">
206N/A <!-- phew. short explanation, what happens here: -->
206N/A <!-- We want to get the inline stuff between the last -->
206N/A <!-- block node and the current node. -->
206N/A <!-- So filter all previous nodes for the condition -->
206N/A <!-- that the number of block nodes of all of *their* -->
206N/A <!-- previous nodes is >= $bb. Hope that helps ;-) -->
206N/A <xsl:apply-templates
206N/A select="preceding-sibling::node()[
206N/A count(preceding-sibling::*[
206N/A contains($blocks,
206N/A concat(' ', local-name(), ' '))])
206N/A &gt;= $bb]" />
206N/A
206N/A <xsl:apply-templates
206N/A select="self::node()[not($is-block-node)]" />
206N/A </xsl:variable>
206N/A
206N/A <!-- apply bare text only, if it's not only \s or empty -->
206N/A <xsl:if test="not(normalize-space($content) = '')">
219N/A <p><code>
219N/A <!-- same as $content above. xsl:copy-of seems to make -->
219N/A <!-- thread problems with xalan-j ... -->
99N/A <xsl:apply-templates
99N/A select="preceding-sibling::node()[
99N/A count(preceding-sibling::*[
99N/A contains($blocks,
99N/A concat(' ', local-name(),
99N/A ' '))])
206N/A &gt;= $bb]" />
206N/A
206N/A <xsl:apply-templates
99N/A select="self::node()[not($is-block-node)]" />
99N/A </code></p>
99N/A </xsl:if>
99N/A
99N/A <xsl:apply-templates select="self::node()[$is-block-node]" />
99N/A </xsl:if>
99N/A </xsl:for-each>
99N/A <!-- /node() -->
99N/A</div> <!-- /.example -->
99N/A</xsl:template>
2238N/A<!-- /example -->
99N/A
806N/A
806N/A<!-- ==================================================================== -->
806N/A<!-- example/title -->
99N/A<!-- ==================================================================== -->
99N/A<xsl:template match="example/title" mode="print">
99N/A<h3>
170N/A <xsl:apply-templates/>
170N/A</h3>
170N/A</xsl:template>
2238N/A<xsl:template match="example/title" />
2238N/A<!-- /example/title -->
2238N/A
99N/A
99N/A<!-- ==================================================================== -->
61N/A<!-- indentations -->
2337N/A<!-- ==================================================================== -->
2337N/A<xsl:template match="indent">
2337N/A<span class="indent">
2337N/A <xsl:apply-templates/>
2337N/A</span>
2337N/A</xsl:template>
2337N/A<!-- /indent -->
2337N/A
2337N/A
2337N/A<!-- ==================================================================== -->
2337N/A<!-- <note> -->
99N/A<!-- ==================================================================== -->
99N/A<xsl:template match="note">
99N/A<div class="note">
99N/A <xsl:if test="@type='warning'">
99N/A <xsl:attribute name="class">warning</xsl:attribute>
99N/A </xsl:if>
99N/A
99N/A <xsl:apply-templates/>
176N/A</div>
176N/A</xsl:template>
99N/A<!-- /note -->
99N/A
99N/A
61N/A<!-- ==================================================================== -->
99N/A<!-- <note><title> -->
99N/A<!-- ==================================================================== -->
99N/A<xsl:template match="note/title">
99N/A<h3>
99N/A <xsl:apply-templates/>
99N/A</h3>
99N/A</xsl:template>
99N/A<!-- /note/title -->
61N/A
99N/A
806N/A<!-- ==================================================================== -->
99N/A<!-- <directive> -->
99N/A<!-- Inserts link to another directive, which might be in another module. -->
99N/A<!-- References are converted into lower case. -->
99N/A<!-- ==================================================================== -->
176N/A<xsl:template match="directive" name="directive">
2238N/A<code class="directive">
2238N/A <xsl:choose>
64N/A <xsl:when test="@module">
2337N/A <xsl:variable name="lowerdirective"
2337N/A select="translate(., $uppercase, $lowercase)" />
2337N/A
62N/A <xsl:choose>
64N/A <xsl:when test="$in-modulesynopsis and @module = /modulesynopsis/name">
64N/A <a href="#{$lowerdirective}">
2337N/A <xsl:if test="@type='section'">&lt;</xsl:if>
2337N/A <xsl:value-of select="."/>
64N/A <xsl:if test="@type='section'">&gt;</xsl:if>
2337N/A </a>
2337N/A </xsl:when>
64N/A <xsl:otherwise>
64N/A <a href="{$path}/mod/{@module}.html#{$lowerdirective}">
62N/A <xsl:if test="@type='section'">&lt;</xsl:if>
62N/A <xsl:value-of select="."/>
62N/A <xsl:if test="@type='section'">&gt;</xsl:if>
62N/A </a>
181N/A </xsl:otherwise>
206N/A </xsl:choose>
814N/A </xsl:when>
206N/A
181N/A <xsl:otherwise>
181N/A <xsl:if test="@type='section'">&lt;</xsl:if>
181N/A <xsl:value-of select="."/>
181N/A <xsl:if test="@type='section'">&gt;</xsl:if>
1273N/A </xsl:otherwise>
1273N/A </xsl:choose>
1273N/A</code>
1273N/A</xsl:template>
1273N/A<!-- /directive -->
1273N/A
1273N/A
1273N/A<!-- ==================================================================== -->
<!-- <module> -->
<!-- Inserts a link to refereed module -->
<!-- ==================================================================== -->
<xsl:template match="module" name="module">
<code class="module">
<a href="{$path}/mod/{.}.html">
<xsl:value-of select="."/>
</a>
</code>
</xsl:template>
<!-- /module -->
<!-- ==================================================================== -->
<!-- <program> -->
<!-- Inserts a link to referred program -->
<!-- ==================================================================== -->
<xsl:template match="program">
<code class="program">
<a href="{$path}/programs/{normalize-space(.)}.html">
<xsl:value-of select="normalize-space(.)" />
</a>
</code>
</xsl:template>
<!-- /program -->
<!-- ==================================================================== -->
<!-- <related> -->
<!-- ==================================================================== -->
<xsl:template match="related">
<table class="related">
<tr>
<th>
<xsl:value-of select="$message[@id='relatedmodules']" />
</th>
<th>
<xsl:value-of select="$message[@id='relateddirectives']" />
</th>
</tr>
<tr>
<td>
<xsl:if test="count(modulelist/*) &gt; 0">
<ul>
<xsl:apply-templates select="modulelist" />
</ul>
</xsl:if>
</td>
<td>
<xsl:if test="count(directivelist/*) &gt; 0">
<ul>
<xsl:apply-templates select="directivelist"/>
</ul>
</xsl:if>
</td>
</tr>
</table>
</xsl:template>
<!-- /related -->
<!-- ==================================================================== -->
<!-- related/modulelist -->
<!-- ==================================================================== -->
<xsl:template match="related/modulelist">
<xsl:for-each select="module">
<li>
<xsl:call-template name="module"/>
</li>
</xsl:for-each>
</xsl:template>
<!-- /related/modulelist -->
<!-- ==================================================================== -->
<!-- related/directivelist -->
<!-- ==================================================================== -->
<xsl:template match="related/directivelist">
<xsl:for-each select="directive">
<li>
<xsl:call-template name="directive"/>
</li>
</xsl:for-each>
</xsl:template>
<!-- /related/directivelist -->
<!-- ==================================================================== -->
<!-- <table> -->
<!-- ==================================================================== -->
<xsl:template match="table">
<table>
<!-- existing border attribute will result in <table class="bordered"> -->
<xsl:if test="@border">
<xsl:attribute name="class">bordered</xsl:attribute>
</xsl:if>
<xsl:choose>
<xsl:when test="@style = 'zebra'">
<xsl:apply-templates select="tr" mode="zebra-table" />
</xsl:when>
<xsl:when test="@style = 'data'">
<xsl:apply-templates select="tr" mode="data-table" />
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates />
</xsl:otherwise>
</xsl:choose>
</table>
</xsl:template>
<!-- /table -->
<!-- data-table -->
<xsl:template match="tr" mode="data-table">
<!-- style="data": fixed font, padding-left and right alignment for <td>s -->
<xsl:variable name="cross-table" select="boolean(
preceding-sibling::tr/th[1]|following-sibling::tr/th[1])" />
<tr>
<xsl:for-each select="node()">
<xsl:choose>
<xsl:when test="local-name() = 'td'">
<td class="data">
<xsl:apply-templates select="*|@*|text()" />
</td>
</xsl:when>
<xsl:when test="local-name() = 'th' and
(not($cross-table) or
count(preceding-sibling::*) &gt; 0)">
<th class="data">
<xsl:apply-templates select="*|@*|text()" />
</th>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="self::node()" />
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</tr>&lf;
</xsl:template>
<!-- zebra-table -->
<xsl:template match="tr" mode="zebra-table">
<!-- style="zebra": alternating colors per row, i.e. every second row -->
<!-- gets a class="odd". Header lines (no <td>) get a -->
<!-- class="header". These lines will be excluded from -->
<!-- the "odd" line count. That way header lines act -->
<!-- interjectional, which creates a better visual and -->
<!-- psychological effect. -->
<tr>
<xsl:choose>
<xsl:when test="count(td) = 0">
<xsl:attribute name="class">header</xsl:attribute>
</xsl:when>
<xsl:when test="position() mod 2 = (count(preceding-sibling::tr[count(td) = 0]) mod 2)">
<xsl:attribute name="class">odd</xsl:attribute>
</xsl:when>
</xsl:choose>
<xsl:apply-templates />
</tr>&lf;
</xsl:template>
<!-- /zebra-table -->
<!-- ==================================================================== -->
<!-- <ol> -->
<!-- ==================================================================== -->
<xsl:template match="ol">
<ol>
<!-- A. B. C. D. (list-style-type="upper-alpha") -->
<xsl:choose>
<xsl:when test="@type = 'A'">
<xsl:attribute name="class">up-A</xsl:attribute>
</xsl:when>
<xsl:when test="@type = 'a'">
<xsl:attribute name="class">lo-A</xsl:attribute>
</xsl:when>
</xsl:choose>
<xsl:apply-templates/>
</ol>
</xsl:template>
<!-- /ol -->
<!-- ==================================================================== -->
<!-- diverse elements -->
<!-- Passes through content -->
<!-- ==================================================================== -->
<xsl:template match="summary|description|usage|syntax|default">
<xsl:apply-templates/>
</xsl:template>
<!-- /diverse -->
<!-- ==================================================================== -->
<!-- <a> -->
<!-- ==================================================================== -->
<xsl:template match="a">
<xsl:choose>
<xsl:when test="not(@href)">
<xsl:copy>
<xsl:apply-templates select="@*|*|text()"/>
</xsl:copy>
</xsl:when>
<xsl:otherwise>
<a href="@href">
<xsl:apply-templates select="@*"/>
<xsl:call-template name="helper.uri.fix">
<xsl:with-param name="uri" select="@href"/>
</xsl:call-template>
<xsl:apply-templates select="*|text()"/>
</a>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- /a -->
<!-- ==================================================================== -->
<!-- toplink -->
<!-- ==================================================================== -->
<xsl:template name="toplink">
<div class="top">
<a href="#page-header"><img src="{$path}/images/up.gif" alt="top" /></a>
</div>
</xsl:template>
<!-- /toplink -->
<!-- ==================================================================== -->
<!-- <transnote> -->
<!-- translator's notes are displayed in a different color -->
<!-- ==================================================================== -->
<xsl:template match="transnote">
<span class="transnote">
<xsl:text>(</xsl:text>
<em>
<xsl:value-of select="$message[@id='transnote']" />
</em>
<xsl:text> </xsl:text>
<xsl:apply-templates />
<xsl:text>)</xsl:text>
</span>
</xsl:template>
<!-- /transnote -->
<!-- ==================================================================== -->
<!-- <phonetic> -->
<!-- phonetics are enclosed in square brackets and displayed in a -->
<!-- different color -->
<!-- ==================================================================== -->
<xsl:template match="phonetic">
<span class="phonetic">
<xsl:text>[</xsl:text>
<xsl:apply-templates />
<xsl:text>]</xsl:text>
</span>
</xsl:template>
<!-- /phonetic -->
<!-- ==================================================================== -->
<!-- <glossary> -->
<!-- link to a glossary anchor -->
<!-- ==================================================================== -->
<xsl:template match="glossary">
<xsl:variable name="glosslink">
<xsl:choose>
<xsl:when test="@ref">
<xsl:value-of select="@ref"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="translate(., $uppercase, $lowercase)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<a href="{$path}/glossary.html#{$glosslink}" class="glossarylink">
<xsl:attribute name="title">
<xsl:value-of select="$message[@id='glossarylink']" />
</xsl:attribute>
<xsl:apply-templates />
</a>
</xsl:template>
<!-- /glossary -->
<!-- ==================================================================== -->
<!-- Filter &#160; in text() nodes. -->
<!-- In some environments this character won't be transformed correctly, -->
<!-- so we just write it explicitely as "&nbsp;" into the output. -->
<!-- ==================================================================== -->
<xsl:template match="text()" name="filter.nbsp">
<xsl:param name="text" select="." />
<xsl:choose>
<xsl:when test="contains($text, '&#160;')">
<xsl:value-of select="substring-before($text, '&#160;')" />
&nbsp;
<xsl:call-template name="filter.nbsp">
<xsl:with-param name="text" select="substring-after($text, '&#160;')" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$text" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- /filter.nbsp -->
<!-- ==================================================================== -->
<!-- Process everything else by just passing it through -->
<!-- ==================================================================== -->
<xsl:template match="*">
<xsl:message terminate="yes">
<xsl:text>Unknown element: </xsl:text>
<xsl:value-of select="local-name()" />&lf;
<xsl:text>Is the document valid (try `build validate-xml`)?</xsl:text>
</xsl:message>
</xsl:template>
<xsl:template match="@*">
<xsl:copy>
<xsl:apply-templates select="*|@*|text()" />
</xsl:copy>
</xsl:template>
<xsl:template match="br"><br /></xsl:template>
<xsl:template match="tr"><tr><xsl:apply-templates select="*|@*|text()" /></tr></xsl:template>
<xsl:template match="th"><th><xsl:apply-templates select="*|@*|text()" /></th></xsl:template>
<xsl:template match="td"><td><xsl:apply-templates select="*|@*|text()" /></td></xsl:template>
<xsl:template match="p"><p><xsl:apply-templates select="*|@*|text()" /></p></xsl:template>
<xsl:template match="ul"><ul><xsl:apply-templates select="*|@*|text()" /></ul></xsl:template>
<xsl:template match="li"><li><xsl:apply-templates select="*|@*|text()" /></li></xsl:template>
<xsl:template match="dl"><dl><xsl:apply-templates select="*|@*|text()" /></dl></xsl:template>
<xsl:template match="dt"><dt><xsl:apply-templates select="*|@*|text()" /></dt></xsl:template>
<xsl:template match="dd"><dd><xsl:apply-templates select="*|@*|text()" /></dd></xsl:template>
<xsl:template match="em"><em><xsl:apply-templates select="*|@*|text()" /></em></xsl:template>
<xsl:template match="strong"><strong><xsl:apply-templates select="*|@*|text()" /></strong></xsl:template>
<xsl:template match="pre"><pre><xsl:apply-templates select="*|@*|text()" /></pre></xsl:template>
<xsl:template match="code"><code><xsl:apply-templates select="*|@*|text()" /></code></xsl:template>
<xsl:template match="var"><var><xsl:apply-templates select="*|@*|text()" /></var></xsl:template>
<xsl:template match="dfn"><dfn><xsl:apply-templates select="*|@*|text()" /></dfn></xsl:template>
<xsl:template match="blockquote"><blockquote><xsl:apply-templates select="*|@*|text()" /></blockquote></xsl:template>
<xsl:template match="q"><q><xsl:apply-templates select="*|@*|text()" /></q></xsl:template>
<xsl:template match="cite"><cite><xsl:apply-templates select="*|@*|text()" /></cite></xsl:template>
<xsl:template match="img"><img><xsl:apply-templates select="*|@*|text()" /></img></xsl:template>
<!-- /pass through -->
<!-- ==================================================================== -->
<!-- create a letter bar -->
<!-- ==================================================================== -->
<xsl:template name="letter-bar">
<xsl:param name="letters" />
<xsl:param name="first" />
<xsl:if test="not($first)">
<xsl:text> | </xsl:text>
</xsl:if>
<a href="#{substring($letters,1,1)}">
&nbsp;
<xsl:value-of select="substring($letters, 1, 1)" />
&nbsp;
</a>
<xsl:if test="string-length($letters) &gt; 1">
<xsl:call-template name="letter-bar">
<xsl:with-param name="letters" select="substring($letters, 2)" />
<xsl:with-param name="first" select="false()" />
</xsl:call-template>
</xsl:if>
</xsl:template>
<!-- /letter-bar -->
<!-- ==================================================================== -->
<!-- template(s) for collecting all start letters of directives -->
<!-- ==================================================================== -->
<xsl:template name="directive-startletters">
<xsl:param name="directives" />
<xsl:call-template name="_squeeze-letters">
<xsl:with-param name="lastletter" select="''" />
<xsl:with-param name="letters">
<xsl:for-each select="$directives">
<xsl:sort select="name"/>
<xsl:value-of
select="translate(substring(normalize-space(name), 1, 1),
$lowercase, $uppercase)" />
</xsl:for-each>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<!-- /directive-startletters -->
<!-- ==================================================================== -->
<!-- squeeze subsequent letters in a string -->
<!-- ==================================================================== -->
<xsl:template name="_squeeze-letters">
<xsl:param name="letters"/>
<xsl:param name="lastletter"/>
<xsl:variable name="current" select="substring($letters, 1, 1)" />
<xsl:if test="not($lastletter = $current)">
<xsl:value-of select="$current" />
</xsl:if>
<xsl:if test="string-length($letters) &gt; 1">
<xsl:call-template name="_squeeze-letters">
<xsl:with-param name="letters" select="substring($letters, 2)" />
<xsl:with-param name="lastletter" select="$current"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<!-- /_squeeze-letters -->
<!-- ==================================================================== -->
<!-- fix href and target attribute of an element. -->
<!-- ==================================================================== -->
<xsl:template name="helper.uri.fix">
<xsl:param name="uri"/>
<xsl:choose>
<!-- lame is_absolute_uri test -->
<xsl:when test=" contains($uri, ':')
and string-length(substring-before($uri, ':')) &lt; 7">
<xsl:if test="$ext-target">
<xsl:attribute name="target">_blank</xsl:attribute>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="fragment">
<xsl:if test="contains($uri, '#')">
<xsl:value-of select="concat('#', substring-after($uri, '#'))"/>
</xsl:if>
</xsl:variable>
<xsl:variable name="absuri">
<xsl:choose>
<xsl:when test="contains($uri, '#')">
<xsl:value-of select="concat('#', substring-before($uri, '#'))"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$uri"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:if test="substring($absuri, string-length($uri), 1) = '/'">
<xsl:attribute name="href">
<xsl:value-of select="concat($absuri, $index-file, $fragment)"/>
</xsl:attribute>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- /helper.uri.fix -->
<!-- ==================================================================== -->
<!-- Ignore table hints used for latex -->
<!-- ==================================================================== -->
<xsl:template match="columnspec">
</xsl:template>
<xsl:template match="column">
</xsl:template>
</xsl:stylesheet>