<?
xml version="1.0"?>
<!--/* ==================================================================== * The Apache Software License, Version 1.1 * Copyright (c) 2002-2003 The Apache Software Foundation. All rights * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * 4. The names "Apache" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact apache@apache.org. * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * ==================================================================== * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see <!
DOCTYPE xsl:
stylesheet [
<
xsl:
stylesheet version="1.0"<!-- Please, don't hard-code output strings! Use the language --> <!-- files and the translation "stuff"... --> <!-- Injected variables: --> <!-- $is-chm - (boolean) target is for CHM generation or not --> <!-- $messages - (node-set) localized common text snippets --> <!-- $output-encoding - (string) MIME charset name of the output --> <!-- Constants used for case translation --> <
xsl:
variable name="lowercase" select="'abcdefghijklmnopqrstuvwxyz'" />
<
xsl:
variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
<!-- space separated list of blockelements defined in common.dtd --> <!-- used for inline content catching in <example>s --> <
xsl:
variable name="blockelements">
p example note table ul ol dl pre img blockquote
<!-- relative path to /manual/ --> <
xsl:
variable name="path" select="document(/*/@metafile)/metafile/relpath" />
<!-- load outsourced page types --> <!-- load utility snippets --> <!-- make sure, we set relative anchors only, if we're actually --> <!-- transforming a modulefile (see <directive> template) --> <
xsl:
variable name="in-modulesynopsis" select="boolean(/modulesynopsis)" />
<!-- when referencing to a directory, we may need to complete the path --> <!-- with the index file (for offline applications like *.chm files) --> <
xsl:
variable name="index-file">
<!-- it may be desired to open external targets in a new window --> <
xsl:
variable name="ext-target" select="boolean($is-chm)" />
<!-- #################################################################### --> <!-- Utility templates for constructing pages --> <!-- #################################################################### --> <!-- ==================================================================== --> <!-- ==================================================================== --> <
xsl:
template name="head">
<!-- the meta element is necessary for offline handling like CHM --> <
xsl:
when test="$is-chm">
<
meta http-
equiv="Content-Type" content="text/html; charset={$output-encoding}" />
<
xsl:
text>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</
xsl:
text>
<
xsl:
text>This file is generated from xml source: DO NOT EDIT</
xsl:
text>
<
xsl:
text>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</
xsl:
text>
<
xsl:
value-
of select="name"/>
<
xsl:
value-
of select="title"/>
<!-- chm files get a slightly different stylesheet --> <
xsl:
when test="$is-chm">
<
link type="text/css" rel="stylesheet" media="all" <
link title="Main stylesheet" type="text/css" media="all" <
link title="No Sidebar - Default font size" type="text/css" media="all" rel="alternate stylesheet" <
link type="text/css" media="print" <!-- chm files do not need a favicon --> <
xsl:
if test="not($is-chm)">&lf;
<!-- ==================================================================== --> <!-- ==================================================================== --> <
xsl:
template name="top">
<
div id="page-header">&lf;
<
xsl:
call-
template name="super-menu" />&lf;
</
div>&lf;
<!-- /page-header --> <
a href="./{$index-file}">
<
xsl:
if test="parentdocument">
<
xsl:
attribute name="href">
<
xsl:
value-
of select="parentdocument/@href"/>
<
xsl:
with-
param name="uri" select="parentdocument/@href" />
<
xsl:
if test="$ext-target">
<
xsl:
attribute name="target">_blank</
xsl:
attribute>
<
xsl:
text> > </
xsl:
text>
<
xsl:
if test="$ext-target">
<
xsl:
attribute name="target">_blank</
xsl:
attribute>
<
xsl:
text> > </
xsl:
text>
<
xsl:
if test="$ext-target">
<
xsl:
attribute name="target">_blank</
xsl:
attribute>
<
xsl:
text> > </
xsl:
text>
<
a href="{$path}/{$index-file}">
<
xsl:
text> > </
xsl:
text>
<
a href="./{$index-file}">
<
xsl:
text> > </
xsl:
text>
<
a href="{parentdocument/@href}">
<
xsl:
with-
param name="uri" select="parentdocument/@href"/>
<
xsl:
value-
of select="parentdocument"/>
<!-- ==================================================================== --> <!-- ==================================================================== --> <
xsl:
template name="bottom">
<
xsl:
if test="$ext-target">
<
xsl:
attribute name="target">_blank</
xsl:
attribute>
<
xsl:
text>Apache HTTP Server Documentation Project</
xsl:
text>
<
xsl:
call-
template name="super-menu"/>
<!-- ==================================================================== --> <!-- Process a documentation section --> <!-- ==================================================================== --> <
xsl:
template match="section">
<
xsl:
call-
template name="toplink" />&lf;
<
div class="section">&lf;
<
a id="{@id}" name="{@id}">
<
xsl:
apply-
templates select="title" mode="print" />
<
xsl:
apply-
templates select="title" mode="print" />
</
div>
<!-- /.section --><!-- ==================================================================== --> <!-- handle subsections (lower level headings) --> <!-- ==================================================================== --> <
a id="{@id}" name="{@id}">
<
xsl:
apply-
templates select="title" mode="print" />
<
xsl:
apply-
templates select="title" mode="print" />
<!-- ==================================================================== --> <!-- handle subsubsections (h4) --> <!-- ==================================================================== --> <
a id="{@id}" name="{@id}">
<
xsl:
apply-
templates select="title" mode="print" />
<
xsl:
apply-
templates select="title" mode="print" />
<!-- ==================================================================== --> <!-- section nesting > h4 is not supported for now --> <!-- ==================================================================== --> <
xsl:
message terminate="yes">
<
xsl:
text>FATAL: exceeding maximum section nesting level.</
xsl:
text>
<
xsl:
text>Perhaps you should consider to split your document into</
xsl:
text>
<
xsl:
text>several ones...</
xsl:
text>
<!-- ==================================================================== --> <!-- (sub)section titles --> <!-- ==================================================================== --> <!-- ==================================================================== --> <!-- generate section index --> <!-- ==================================================================== --> <
xsl:
template match="section" mode="index">
<
xsl:
apply-
templates select="title" mode="print" />
<
xsl:
apply-
templates select="title" mode="print" />
<!-- ==================================================================== --> <!-- ==================================================================== --> <
xsl:
template name="super-menu">
<
a href="{$path}/mod/{$index-file}">
<
a href="{$path}/faq/{$index-file}">
<!-- ==================================================================== --> <!-- iterate over *all* nodes; bare text and other inline stuff is --> <!-- wrapped into <p><code>, block level elements (defined in --> <!-- $blockelements) are applied "as is" --> <!-- ==================================================================== --> <
xsl:
variable name="blocks" select="concat(' ', normalize-space($blockelements), ' ')" />
<
xsl:
template match="example">
<
xsl:
apply-
templates select="title" mode="print" />
<
xsl:
for-
each select="/node()">
<
xsl:
variable name="is-block-node" select="boolean(contains($blocks, concat(' ', local-name(), ' ')))"/>
<!-- bb = (number of) blocks nodes before (the current) --> select="count(preceding-sibling::*[ concat(' ', local-name(), ' '))])" />
<
xsl:
if test="$is-block-node or position()=last()">
<
xsl:
variable name="content">
<!-- phew. short explanation, what happens here: --> <!-- We want to get the inline stuff between the last --> <!-- block node and the current node. --> <!-- So filter all previous nodes for the condition --> <!-- that the number of block nodes of all of *their* --> <!-- previous nodes is >= $bb. Hope that helps ;-) --> select="preceding-sibling::node()[ count(preceding-sibling::*[ concat(' ', local-name(), ' '))]) select="self::node()[not($is-block-node)]" />
<!-- apply bare text only, if it's not only \s or empty --> <
xsl:
if test="not(normalize-space($content) = '')">
<!-- same as $content above. xsl:copy-of seems to make --> <!-- thread problems with xalan-j ... --> select="preceding-sibling::node()[ count(preceding-sibling::*[ concat(' ', local-name(), select="self::node()[not($is-block-node)]" />
<
xsl:
apply-
templates select="self::node()[$is-block-node]" />
</
div>
<!-- /.example --><!-- ==================================================================== --> <!-- ==================================================================== --> <!-- ==================================================================== --> <!-- ==================================================================== --> <
xsl:
template match="indent">
<!-- ==================================================================== --> <!-- ==================================================================== --> <
xsl:
template match="note">
<
xsl:
if test="@type='warning'">
<
xsl:
attribute name="class">warning</
xsl:
attribute>
<!-- ==================================================================== --> <!-- ==================================================================== --> <!-- ==================================================================== --> <!-- Inserts link to another directive, which might be in another module. --> <!-- References are converted into lower case. --> <!-- ==================================================================== --> <
xsl:
template match="directive" name="directive">
<
xsl:
when test="@module">
<
xsl:
variable name="lowerdirective" select="translate(., $uppercase, $lowercase)" />
<
a href="#{$lowerdirective}">
<
xsl:
if test="@type='section'"><</
xsl:
if>
<
xsl:
value-
of select="."/>
<
xsl:
if test="@type='section'">></
xsl:
if>
<
a href="{$path}/mod/{@module}.html#{$lowerdirective}">
<
xsl:
if test="@type='section'"><</
xsl:
if>
<
xsl:
value-
of select="."/>
<
xsl:
if test="@type='section'">></
xsl:
if>
<
xsl:
if test="@type='section'"><</
xsl:
if>
<
xsl:
value-
of select="."/>
<
xsl:
if test="@type='section'">></
xsl:
if>
<!-- ==================================================================== --> <!-- Inserts a link to refereed module --> <!-- ==================================================================== --> <
xsl:
template match="module" name="module">
<
a href="{$path}/mod/{.}.html">
<
xsl:
value-
of select="."/>
<!-- ==================================================================== --> <!-- ==================================================================== --> <
xsl:
template match="related">
<
xsl:
if test="count(modulelist/*) > 0">
<
xsl:
apply-
templates select="modulelist" />
<
xsl:
if test="count(directivelist/*) > 0">
<
xsl:
apply-
templates select="directivelist"/>
<!-- ==================================================================== --> <!-- ==================================================================== --> <
xsl:
for-
each select="module">
<
xsl:
call-
template name="module"/>
<!-- ==================================================================== --> <!-- ==================================================================== --> <
xsl:
for-
each select="directive">
<
xsl:
call-
template name="directive"/>
<!-- ==================================================================== --> <!-- ==================================================================== --> <
xsl:
template match="table">
<!-- existing border attribute will result in <table class="bordered"> --> <
xsl:
attribute name="class">bordered</
xsl:
attribute>
<!-- 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. --> <
xsl:
when test="@style = 'zebra'">
<
xsl:
for-
each select="tr">
<
xsl:
when test="count(td) = 0">
<
xsl:
attribute name="class">header</
xsl:
attribute>
(count(preceding-sibling::*[count(td) = 0]) mod 2)">
<
xsl:
attribute name="class">odd</
xsl:
attribute>
<!-- ==================================================================== --> <!-- ==================================================================== --> <
xsl:
template match="ol">
<!-- A. B. C. D. (list-style-type="upper-alpha") --> <
xsl:
if test="@type = 'A'">
<
xsl:
attribute name="class">up-A</
xsl:
attribute>
<!-- ==================================================================== --> <!-- diverse elements --> <!-- Passes through content --> <!-- ==================================================================== --> <
xsl:
template match="summary|description|usage|syntax|default">
<!-- ==================================================================== --> <!-- ==================================================================== --> <
xsl:
when test="not(@href)">
<
xsl:
apply-
templates select="@*|*|text()"/>
<
xsl:
apply-
templates select="@*"/>
<
xsl:
with-
param name="uri" select="@href"/>
<
xsl:
apply-
templates select="*|text()"/>
<!-- ==================================================================== --> <!-- ==================================================================== --> <
xsl:
template name="toplink">
<
a href="#page-header"><
img src="{$path}/images/up.gif" alt="top" /></
a>
<!-- ==================================================================== --> <!-- translator's notes are displayed in a different color --> <!-- ==================================================================== --> <
xsl:
template match="transnote">
<!-- ==================================================================== --> <!-- Filter   in text() nodes. --> <!-- In some environments this character won't be transformed correctly, --> <!-- so we just write it explicitely as " " into the output. --> <!-- ==================================================================== --> <
xsl:
param name="text" select="." />
<
xsl:
when test="contains($text, ' ')">
<
xsl:
value-
of select="substring-before($text, ' ')" />
<
xsl:
with-
param name="text" select="substring-after($text, ' ')" />
<
xsl:
value-
of select="$text" />
<!-- ==================================================================== --> <!-- Process everything else by just passing it through --> <!-- ==================================================================== --> <
xsl:
template match="*|@*">
<
xsl:
apply-
templates select="*|@*|text()" />
<!-- ==================================================================== --> <!-- create a letter bar --> <!-- ==================================================================== --> <
xsl:
template name="letter-bar">
<
xsl:
param name="letters" />
<
xsl:
param name="first" />
<
xsl:
if test="not($first)">
<
a href="#{substring($letters,1,1)}">
<
xsl:
value-
of select="substring($letters, 1, 1)" />
<
xsl:
if test="string-length($letters) > 1">
<
xsl:
call-
template name="letter-bar">
<
xsl:
with-
param name="letters" select="substring($letters, 2)" />
<
xsl:
with-
param name="first" select="false()" />
<!-- ==================================================================== --> <!-- 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"/>
select="translate(substring(normalize-space(name), 1, 1), $lowercase, $uppercase)" />
<!-- /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 test="string-length($letters) > 1">
<
xsl:
call-
template name="_squeeze-letters">
<
xsl:
with-
param name="letters" select="substring($letters, 2)" />
<
xsl:
with-
param name="lastletter" select="$current"/>
<!-- /_squeeze-letters --> <!-- ==================================================================== --> <!-- fix href and target attribute of an element. --> <!-- ==================================================================== --> <!-- lame is_absolute_uri test --> <
xsl:
when test=" contains($uri, ':') and string-length(substring-before($uri, ':')) < 7">
<
xsl:
if test="$ext-target">
<
xsl:
attribute name="target">_blank</
xsl:
attribute>
<
xsl:
variable name="fragment">
<
xsl:
if test="contains($uri, '#')">
<
xsl:
value-
of select="concat('#', substring-after($uri, '#'))"/>
<
xsl:
variable name="absuri">
<
xsl:
when test="contains($uri, '#')">
<
xsl:
value-
of select="concat('#', substring-before($uri, '#'))"/>
<
xsl:
value-
of select="$uri"/>
<
xsl:
if test="substring($absuri, string-length($uri), 1) = '/'">
<
xsl:
attribute name="href">
<
xsl:
value-
of select="concat($absuri, $index-file, $fragment)"/>