common.xsl revision f4a6ce7d0d0311e4da2d4df6812263c562a05a3e
2N/A<?xml version="1.0"?>
2N/A
2N/A<!--
2N/A Copyright 2002-2004 The Apache Software Foundation
2N/A
2N/A Licensed under the Apache License, Version 2.0 (the "License");
2N/A you may not use this file except in compliance with the License.
2N/A 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 [
2N/A <!ENTITY nbsp SYSTEM "util/nbsp.xml">
2N/A <!ENTITY lf SYSTEM "util/lf.xml">
2N/A]>
2N/A<xsl:stylesheet version="1.0"
2N/A xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
2N/A xmlns="http://www.w3.org/1999/xhtml">
2N/A
2N/A<!-- -->
2N/A<!-- Please, don't hard-code output strings! Use the language -->
2N/A<!-- files and the translation "stuff"... -->
2N/A<!-- -->
2N/A
2N/A<!-- Injected variables: -->
2N/A<!-- $is-chm - (boolean) target is for CHM generation or not -->
2N/A<!-- $is-zip - (boolean) target is for ZIP generation or not -->
2N/A<!-- $messages - (node-set) localized common text snippets -->
2N/A<!-- $output-encoding - (string) MIME charset name of the output -->
2N/A<!-- encoding -->
2N/A
2N/A<!-- Constants used for case translation -->
2N/A<xsl:variable name="lowercase" select="'abcdefghijklmnopqrstuvwxyz'" />
2N/A<xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
2N/A
2N/A<!-- space separated list of blockelements defined in common.dtd -->
2N/A<!-- used for inline content catching in <example>s -->
2N/A<xsl:variable name="blockelements">
2N/A p example note table ul ol dl pre img blockquote
2N/A</xsl:variable>
2N/A
2N/A<!-- relative path to /manual/ -->
2N/A<xsl:variable name="metafile" select="document(/*/@metafile)/metafile" />
2N/A<xsl:variable name="path" select="$metafile/relpath" />
2N/A
2N/A<!-- load outsourced page types -->
2N/A<xsl:include href="moduleindex.xsl" />
2N/A<xsl:include href="directiveindex.xsl" />
2N/A<xsl:include href="manualpage.xsl" />
2N/A<xsl:include href="synopsis.xsl" />
2N/A<xsl:include href="sitemap.xsl" />
2N/A<xsl:include href="indexpage.xsl" />
2N/A<xsl:include href="quickreference.xsl" />
2N/A<xsl:include href="faq.xsl" />
2N/A
2N/A<!-- load utility snippets -->
2N/A<xsl:include href="util/modtrans.xsl" />
2N/A
2N/A<!-- make sure, we set relative anchors only, if we're actually -->
2N/A<!-- transforming a modulefile (see <directive> template) -->
2N/A<xsl:variable name="in-modulesynopsis" select="boolean(/modulesynopsis)" />
2N/A
2N/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) -->
2N/A<xsl:variable name="index-file">
2N/A <xsl:if test="$is-chm or $is-zip">index.html</xsl:if>
2N/A</xsl:variable>
2N/A
2N/A<!-- it may be desired to open external targets in a new window -->
2N/A<xsl:variable name="ext-target" select="boolean($is-chm)" />
2N/A
2N/A<!-- #################################################################### -->
2N/A<!-- Utility templates for constructing pages -->
2N/A<!-- #################################################################### -->
2N/A
2N/A<!-- ==================================================================== -->
2N/A<!-- HTML head -->
2N/A<!-- ==================================================================== -->
2N/A<xsl:template name="head">
2N/A<head>
2N/A <!-- the meta element is necessary for offline handling like CHM -->
2N/A <xsl:choose>
2N/A <xsl:when test="$is-chm or $is-zip">
2N/A <meta http-equiv="Content-Type"
2N/A content="text/html; charset={$output-encoding}" />
2N/A </xsl:when>
2N/A <xsl:otherwise>
2N/A <xsl:comment>
2N/A &lf;
2N/A <xsl:text> </xsl:text>
2N/A <xsl:text>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</xsl:text>
2N/A &lf;
2N/A <xsl:text> </xsl:text>
2N/A <xsl:text>This file is generated from xml source: DO NOT EDIT</xsl:text>
2N/A &lf;
2N/A <xsl:text> </xsl:text>
2N/A <xsl:text>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</xsl:text>
2N/A &lf;
2N/A <xsl:text> </xsl:text>
2N/A </xsl:comment>
2N/A </xsl:otherwise>
2N/A </xsl:choose>&lf;
2N/A
2N/A <title>
2N/A <xsl:choose>
2N/A <xsl:when test="name">
2N/A <xsl:value-of select="name"/>
2N/A </xsl:when>
2N/A
2N/A <xsl:otherwise>
2N/A <xsl:value-of select="title"/>
2N/A </xsl:otherwise>
2N/A </xsl:choose>
2N/A
2N/A <xsl:text> </xsl:text>
2N/A <xsl:value-of select="$messages/message[@name='apachetitle']"/>
2N/A </title>&lf;
2N/A
2N/A <!-- chm files get a slightly different stylesheet -->
2N/A <xsl:choose>
2N/A <xsl:when test="$is-chm">
2N/A <link type="text/css" rel="stylesheet" media="all"
2N/A href="{$path}/style/css/manual-chm.css" />
2N/A </xsl:when>
2N/A <!-- zip packages do also -->
2N/A <xsl:when test="$is-zip">
2N/A <link title="Main stylesheet" type="text/css" media="all"
2N/A rel="stylesheet"
2N/A href="{$path}/style/css/manual-zip.css" />&lf;
2N/A <link title="No Sidebar - Default font size" type="text/css" media="all"
2N/A rel="alternate stylesheet"
2N/A href="{$path}/style/css/manual-zip-100pc.css"/>
2N/A </xsl:when>
2N/A <xsl:otherwise>
2N/A <link title="Main stylesheet" type="text/css" media="all"
2N/A rel="stylesheet"
2N/A href="{$path}/style/css/manual.css" />&lf;
2N/A <link title="No Sidebar - Default font size" type="text/css" media="all"
2N/A rel="alternate stylesheet"
2N/A href="{$path}/style/css/manual-loose-100pc.css"/>
2N/A </xsl:otherwise>
2N/A </xsl:choose>&lf;
2N/A
2N/A <link type="text/css" media="print"
2N/A rel="stylesheet"
2N/A href="{$path}/style/css/manual-print.css"/>
2N/A
2N/A <!-- chm files do not need a favicon -->
2N/A <xsl:if test="not($is-chm or $is-zip)">&lf;
2N/A <link rel="shortcut icon" href="{$path}/images/favicon.ico" />
2N/A </xsl:if>
2N/A</head>
2N/A</xsl:template>
2N/A<!-- /head -->
2N/A
2N/A
2N/A<!-- ==================================================================== -->
2N/A<!-- page top -->
2N/A<!-- ==================================================================== -->
2N/A<xsl:template name="top">
2N/A<div id="page-header">&lf;
2N/A <xsl:call-template name="super-menu" />&lf;
2N/A
2N/A <p class="apache">
2N/A <xsl:value-of select="$messages/message[@name='apachehttpserver']"/>
2N/A </p>&lf;
2N/A
2N/A <img src="{$path}/images/feather.gif" alt="" />
2N/A</div>&lf; <!-- /page-header -->
2N/A
2N/A<div class="up">
2N/A <a href="./{$index-file}">
2N/A <xsl:if test="parentdocument">
2N/A <xsl:attribute name="href">
2N/A <xsl:value-of select="parentdocument/@href"/>
2N/A </xsl:attribute>
2N/A
2N/A <xsl:call-template name="helper.uri.fix">
2N/A <xsl:with-param name="uri" select="parentdocument/@href" />
2N/A </xsl:call-template>
2N/A </xsl:if>
2N/A
2N/A <img src="{$path}/images/left.gif" alt="&lt;-" title="&lt;-" />
2N/A </a>
2N/A</div>&lf;
2N/A
2N/A<div id="path">&lf;
2N/A <a href="http://www.apache.org/">
2N/A <xsl:if test="$ext-target">
2N/A <xsl:attribute name="target">_blank</xsl:attribute>
2N/A </xsl:if>
2N/A <xsl:value-of select="$messages/message[@name='apache']" />
2N/A </a>
2N/A
2N/A <xsl:text> &gt; </xsl:text>
2N/A
2N/A <a href="http://httpd.apache.org/">
2N/A <xsl:if test="$ext-target">
2N/A <xsl:attribute name="target">_blank</xsl:attribute>
2N/A </xsl:if>
2N/A <xsl:value-of select="$messages/message[@name='http-server']" />
2N/A </a>
2N/A
2N/A <xsl:text> &gt; </xsl:text>
2N/A
2N/A <a href="http://httpd.apache.org/docs-project/">
2N/A <xsl:if test="$ext-target">
2N/A <xsl:attribute name="target">_blank</xsl:attribute>
2N/A </xsl:if>
2N/A <xsl:value-of select="$messages/message[@name='documentation']" />
2N/A </a>
2N/A
2N/A <xsl:if test="not(/indexpage)">
2N/A <xsl:text> &gt; </xsl:text>
2N/A
2N/A <a href="{$path}/{$index-file}">
2N/A <xsl:value-of select="$messages/message[@name='version']"/>
2N/A </a>
2N/A </xsl:if>
2N/A
2N/A <xsl:if test="/modulesynopsis or /directiveindex or /quickreference">
2N/A <xsl:text> &gt; </xsl:text>
2N/A
2N/A <a href="./{$index-file}">
2N/A <xsl:value-of select="$messages/message[@name='modules']"/>
2N/A </a>
2N/A </xsl:if>
2N/A
2N/A <xsl:if test="parentdocument/text()">
2N/A <xsl:text> &gt; </xsl:text>
2N/A
2N/A <a href="{parentdocument/@href}">
2N/A <xsl:call-template name="helper.uri.fix">
2N/A <xsl:with-param name="uri" select="parentdocument/@href"/>
2N/A </xsl:call-template>
2N/A <xsl:value-of select="parentdocument"/>
2N/A </a>
2N/A </xsl:if>
2N/A</div> <!-- /path -->
2N/A</xsl:template>
2N/A<!-- /top -->
2N/A
2N/A
2N/A<!-- ==================================================================== -->
2N/A<!-- out of date -->
2N/A<!-- ==================================================================== -->
2N/A<xsl:template name="outofdate">
2N/A<xsl:if test="$metafile/variants/variant[.=$messages/@lang]/@outdated = 'yes'">
2N/A &lf;
2N/A <div class="outofdate">
2N/A <xsl:value-of select="$messages/message[@name='outofdate']"/>
2N/A </div>
2N/A</xsl:if>
2N/A</xsl:template>
2N/A
2N/A
2N/A<!-- ==================================================================== -->
2N/A<!-- page bottom -->
2N/A<!-- ==================================================================== -->
2N/A<xsl:template name="bottom">
2N/A<xsl:call-template name="langavail">
2N/A <xsl:with-param name="position" select="'bottom'" />
2N/A</xsl:call-template>
2N/A
2N/A<div id="footer">&lf;
2N/A <p class="apache">
2N/A <xsl:text>Copyright 1999-2004 The Apache Software </xsl:text>
2N/A <xsl:text>Foundation.</xsl:text><br />
2N/A <xsl:value-of select="$messages/message[@name='licensed']"/>
2N/A <xsl:text> </xsl:text>
2N/A
2N/A <a href="http://www.apache.org/licenses/LICENSE-2.0">
2N/A <xsl:if test="$ext-target">
2N/A <xsl:attribute name="target">_blank</xsl:attribute>
2N/A </xsl:if>
2N/A <xsl:text>Apache License, Version 2.0</xsl:text>
2N/A </a>
2N/A <xsl:text>.</xsl:text>
2N/A </p>&lf;
2N/A
2N/A <xsl:call-template name="super-menu"/>
2N/A
2N/A</div> <!-- /footer -->
2N/A</xsl:template>
2N/A<!-- /bottom -->
2N/A
2N/A
2N/A<!-- ==================================================================== -->
2N/A<!-- build an "available languages" section -->
2N/A<!-- ==================================================================== -->
2N/A<xsl:template name="langavail">
2N/A<xsl:param name="position" select="'top'" />
2N/A
2N/A<xsl:if test="not($is-chm or $is-zip)">
2N/A<div class="{$position}lang">&lf;
2N/A <p>
2N/A <span>
2N/A <xsl:value-of select="$messages/message[@name='langavail']" />
2N/A <xsl:text>: </xsl:text>
2N/A </span>
2N/A
2N/A <xsl:for-each select="$metafile/variants/variant">
2N/A <xsl:sort select="." />
2N/A
2N/A <a href="{$path}/{.}{$metafile/path}{$metafile/basename}.html">
2N/A <xsl:if test="$metafile/basename = 'index'">
2N/A <xsl:attribute name="href">
2N/A <xsl:value-of
2N/A select="concat($path, '/', ., $metafile/path)" />
2N/A </xsl:attribute>
2N/A </xsl:if>
2N/A <xsl:if test="$messages/@lang != .">
2N/A <xsl:attribute name="hreflang">
2N/A <xsl:value-of select="." />
2N/A </xsl:attribute>
2N/A <xsl:attribute name="rel">alternate</xsl:attribute>
2N/A </xsl:if>
2N/A <xsl:attribute name="title">
2N/A <xsl:choose>
2N/A <xsl:when test=". != 'fr'"> <!-- no language file avail. -->
2N/A <xsl:value-of select="document(concat('/lang/', ., '.xml'))
2N/A /messages/@langname" />
2N/A </xsl:when>
2N/A <xsl:otherwise>
2N/A <xsl:text>Fran&#231;ais</xsl:text>
2N/A </xsl:otherwise>
2N/A </xsl:choose>
2N/A </xsl:attribute>
2N/A
2N/A &nbsp;
2N/A <xsl:value-of select="." />
2N/A &nbsp;
2N/A </a>
2N/A <xsl:if test="position() != last()">
2N/A <xsl:text> |&#xA;</xsl:text>
2N/A </xsl:if>
2N/A </xsl:for-each>
2N/A </p>&lf;
2N/A</div> <!-- /.{$position}lang -->
2N/A</xsl:if>
2N/A
2N/A<xsl:if test="$position = 'top'">
2N/A <xsl:call-template name="outofdate" />
2N/A</xsl:if>
2N/A
2N/A</xsl:template>
2N/A<!-- /langavail -->
2N/A
2N/A
2N/A<!-- ==================================================================== -->
2N/A<!-- Process a documentation section -->
2N/A<!-- ==================================================================== -->
2N/A<xsl:template match="section">
2N/A<xsl:call-template name="toplink" />&lf;
2N/A<div class="section">&lf;
2N/A
2N/A <!-- Section heading -->
2N/A <h2>
2N/A <xsl:choose>
2N/A <xsl:when test="@id">
2N/A <a id="{@id}" name="{@id}">
2N/A <xsl:apply-templates select="title" mode="print" />
2N/A </a>
2N/A </xsl:when>
2N/A
2N/A <xsl:otherwise>
2N/A <xsl:apply-templates select="title" mode="print" />
2N/A </xsl:otherwise>
2N/A </xsl:choose>
2N/A </h2>
2N/A
2N/A <!-- Section body -->
2N/A <xsl:apply-templates />
2N/A</div> <!-- /.section -->
2N/A</xsl:template>
2N/A<!-- /section -->
2N/A
2N/A
2N/A<!-- ==================================================================== -->
2N/A<!-- handle subsections (lower level headings) -->
2N/A<!-- ==================================================================== -->
2N/A<xsl:template match="section/section">
2N/A<!-- Section heading -->
2N/A<h3>
2N/A <xsl:choose>
2N/A <xsl:when test="@id">
2N/A <a id="{@id}" name="{@id}">
2N/A <xsl:apply-templates select="title" mode="print" />
2N/A </a>
2N/A </xsl:when>
2N/A
2N/A <xsl:otherwise>
2N/A <xsl:apply-templates select="title" mode="print" />
2N/A </xsl:otherwise>
2N/A </xsl:choose>
2N/A</h3>
2N/A
2N/A<!-- Section body -->
2N/A<xsl:apply-templates />
2N/A</xsl:template>
2N/A<!-- /section/section -->
2N/A
2N/A
2N/A<!-- ==================================================================== -->
2N/A<!-- handle subsubsections (h4) -->
2N/A<!-- ==================================================================== -->
2N/A<xsl:template match="section/section/section">
2N/A<!-- Section heading -->
2N/A<h4>
2N/A <xsl:choose>
2N/A <xsl:when test="@id">
2N/A <a id="{@id}" name="{@id}">
2N/A <xsl:apply-templates select="title" mode="print" />
2N/A </a>
2N/A </xsl:when>
2N/A
2N/A <xsl:otherwise>
2N/A <xsl:apply-templates select="title" mode="print" />
2N/A </xsl:otherwise>
2N/A </xsl:choose>
2N/A</h4>
2N/A
2N/A<!-- Section body -->
2N/A<xsl:apply-templates/>
2N/A
2N/A</xsl:template>
2N/A<!-- /section/section/section -->
2N/A
2N/A
2N/A<!-- ==================================================================== -->
2N/A<!-- section nesting > h4 is not supported for now -->
2N/A<!-- ==================================================================== -->
2N/A<xsl:template match="section/section/section/section">
2N/A<xsl:message terminate="yes">
2N/A <xsl:text>FATAL: exceeding maximum section nesting level.</xsl:text>
2N/A &lf;&lf;
2N/A <xsl:text>Perhaps you should consider to split your document into</xsl:text>
2N/A &lf;
2N/A <xsl:text>several ones...</xsl:text>
2N/A &lf;
2N/A</xsl:message>
2N/A</xsl:template>
2N/A<!-- /section/section/section/section -->
2N/A
2N/A
2N/A<!-- ==================================================================== -->
2N/A<!-- (sub)section titles -->
2N/A<!-- ==================================================================== -->
2N/A<xsl:template match="section/title" mode="print">
2N/A<xsl:apply-templates/>
2N/A</xsl:template>
2N/A<xsl:template match="section/title" />
2N/A<!-- /section/title -->
2N/A
2N/A
2N/A<!-- ==================================================================== -->
2N/A<!-- generate section index -->
2N/A<!-- ==================================================================== -->
2N/A<xsl:template match="section" mode="index">
2N/A<li>
2N/A <img src="{$path}/images/down.gif" alt="" />
2N/A <xsl:text> </xsl:text>
2N/A <xsl:choose>
2N/A <xsl:when test="@id">
2N/A <a href="#{@id}">
2N/A <xsl:apply-templates select="title" mode="print" />
2N/A </a>
2N/A </xsl:when>
2N/A <xsl:otherwise>
2N/A <xsl:apply-templates select="title" mode="print" />
2N/A </xsl:otherwise>
2N/A </xsl:choose>
2N/A</li>&lf;
2N/A</xsl:template>
2N/A<!-- /section index -->
2N/A
2N/A
2N/A<!-- ==================================================================== -->
2N/A<!-- docs super menu -->
2N/A<!-- ==================================================================== -->
2N/A<xsl:template name="super-menu">
2N/A<p class="menu">
2N/A <a href="{$path}/mod/{$index-file}">
2N/A <xsl:value-of select="$messages/message[@name='modules']" />
2N/A </a>
2N/A
2N/A <xsl:text> | </xsl:text>
2N/A
2N/A <a href="{$path}/mod/directives.html">
2N/A <xsl:value-of select="$messages/message[@name='directives']" />
2N/A </a>
2N/A
2N/A <xsl:text> | </xsl:text>
2N/A
2N/A <a href="{$path}/faq/{$index-file}">
2N/A <xsl:value-of select="$messages/message[@name='faq']" />
2N/A </a>
2N/A
2N/A <xsl:text> | </xsl:text>
2N/A
2N/A <a href="{$path}/glossary.html">
2N/A <xsl:value-of select="$messages/message[@name='glossary']" />
2N/A </a>
2N/A
2N/A <xsl:text> | </xsl:text>
2N/A
2N/A <a href="{$path}/sitemap.html">
2N/A <xsl:value-of select="$messages/message[@name='sitemap']" />
2N/A </a>
2N/A</p>
2N/A</xsl:template>
2N/A<!-- /super-menu -->
2N/A
2N/A
2N/A<!-- ==================================================================== -->
2N/A<!-- <example> -->
2N/A<!-- iterate over *all* nodes; bare text and other inline stuff is -->
2N/A<!-- wrapped into <p><code>, block level elements (defined in -->
2N/A<!-- $blockelements) are applied "as is" -->
2N/A<!-- ==================================================================== -->
2N/A<xsl:variable name="blocks"
2N/A select="concat(' ', normalize-space($blockelements), ' ')" />
2N/A
2N/A<xsl:template match="example">
2N/A<div class="example">
2N/A <xsl:apply-templates select="title" mode="print" />
2N/A
2N/A <xsl:for-each select="/node()">
2N/A <xsl:variable name="is-block-node"
2N/A select="boolean(contains($blocks,
2N/A concat(' ', local-name(), ' ')))"/>
2N/A <!-- bb = (number of) blocks nodes before (the current) -->
2N/A <xsl:variable name="bb"
2N/A select="count(preceding-sibling::*[
2N/A contains($blocks,
2N/A concat(' ', local-name(), ' '))])" />
2N/A
2N/A <xsl:if test="$is-block-node or position()=last()">
2N/A <xsl:variable name="content">
2N/A <!-- phew. short explanation, what happens here: -->
2N/A <!-- We want to get the inline stuff between the last -->
2N/A <!-- block node and the current node. -->
2N/A <!-- So filter all previous nodes for the condition -->
2N/A <!-- that the number of block nodes of all of *their* -->
2N/A <!-- previous nodes is >= $bb. Hope that helps ;-) -->
2N/A <xsl:apply-templates
2N/A select="preceding-sibling::node()[
2N/A count(preceding-sibling::*[
2N/A contains($blocks,
2N/A concat(' ', local-name(), ' '))])
2N/A &gt;= $bb]" />
2N/A
2N/A <xsl:apply-templates
2N/A select="self::node()[not($is-block-node)]" />
2N/A </xsl:variable>
2N/A
2N/A <!-- apply bare text only, if it's not only \s or empty -->
2N/A <xsl:if test="not(normalize-space($content) = '')">
2N/A <p><code>
2N/A <!-- same as $content above. xsl:copy-of seems to make -->
2N/A <!-- thread problems with xalan-j ... -->
2N/A <xsl:apply-templates
2N/A select="preceding-sibling::node()[
2N/A count(preceding-sibling::*[
2N/A contains($blocks,
2N/A concat(' ', local-name(),
2N/A ' '))])
2N/A &gt;= $bb]" />
2N/A
2N/A <xsl:apply-templates
2N/A select="self::node()[not($is-block-node)]" />
2N/A </code></p>
2N/A </xsl:if>
2N/A
2N/A <xsl:apply-templates select="self::node()[$is-block-node]" />
2N/A </xsl:if>
2N/A </xsl:for-each>
2N/A <!-- /node() -->
2N/A</div> <!-- /.example -->
2N/A</xsl:template>
2N/A<!-- /example -->
2N/A
2N/A
2N/A<!-- ==================================================================== -->
2N/A<!-- example/title -->
2N/A<!-- ==================================================================== -->
2N/A<xsl:template match="example/title" mode="print">
2N/A<h3>
2N/A <xsl:apply-templates/>
2N/A</h3>
2N/A</xsl:template>
2N/A<xsl:template match="example/title" />
2N/A<!-- /example/title -->
2N/A
2N/A
2N/A<!-- ==================================================================== -->
2N/A<!-- indentations -->
2N/A<!-- ==================================================================== -->
2N/A<xsl:template match="indent">
2N/A<span class="indent">
2N/A <xsl:apply-templates/>
2N/A</span>
2N/A</xsl:template>
2N/A<!-- /indent -->
2N/A
2N/A
2N/A<!-- ==================================================================== -->
2N/A<!-- <note> -->
2N/A<!-- ==================================================================== -->
2N/A<xsl:template match="note">
2N/A<div class="note">
2N/A <xsl:if test="@type='warning'">
2N/A <xsl:attribute name="class">warning</xsl:attribute>
2N/A </xsl:if>
2N/A
2N/A <xsl:apply-templates/>
2N/A</div>
2N/A</xsl:template>
2N/A<!-- /note -->
2N/A
2N/A
2N/A<!-- ==================================================================== -->
2N/A<!-- <note><title> -->
2N/A<!-- ==================================================================== -->
2N/A<xsl:template match="note/title">
2N/A<h3>
2N/A <xsl:apply-templates/>
2N/A</h3>
2N/A</xsl:template>
2N/A<!-- /note/title -->
2N/A
2N/A
2N/A<!-- ==================================================================== -->
2N/A<!-- <directive> -->
2N/A<!-- Inserts link to another directive, which might be in another module. -->
2N/A<!-- References are converted into lower case. -->
2N/A<!-- ==================================================================== -->
2N/A<xsl:template match="directive" name="directive">
2N/A<code class="directive">
2N/A <xsl:choose>
2N/A <xsl:when test="@module">
2N/A <xsl:variable name="lowerdirective"
2N/A select="translate(., $uppercase, $lowercase)" />
2N/A
2N/A <xsl:choose>
2N/A <xsl:when test="$in-modulesynopsis and @module = /modulesynopsis/name">
2N/A <a href="#{$lowerdirective}">
2N/A <xsl:if test="@type='section'">&lt;</xsl:if>
2N/A <xsl:value-of select="."/>
2N/A <xsl:if test="@type='section'">&gt;</xsl:if>
2N/A </a>
2N/A </xsl:when>
2N/A <xsl:otherwise>
2N/A <a href="{$path}/mod/{@module}.html#{$lowerdirective}">
2N/A <xsl:if test="@type='section'">&lt;</xsl:if>
2N/A <xsl:value-of select="."/>
2N/A <xsl:if test="@type='section'">&gt;</xsl:if>
2N/A </a>
2N/A </xsl:otherwise>
2N/A </xsl:choose>
2N/A </xsl:when>
2N/A
2N/A <xsl:otherwise>
2N/A <xsl:if test="@type='section'">&lt;</xsl:if>
2N/A <xsl:value-of select="."/>
2N/A <xsl:if test="@type='section'">&gt;</xsl:if>
2N/A </xsl:otherwise>
2N/A </xsl:choose>
2N/A</code>
2N/A</xsl:template>
2N/A<!-- /directive -->
2N/A
2N/A
2N/A<!-- ==================================================================== -->
2N/A<!-- <module> -->
2N/A<!-- Inserts a link to refereed module -->
2N/A<!-- ==================================================================== -->
2N/A<xsl:template match="module" name="module">
2N/A<code class="module">
2N/A <a href="{$path}/mod/{.}.html">
2N/A <xsl:value-of select="."/>
2N/A </a>
2N/A</code>
2N/A</xsl:template>
2N/A<!-- /module -->
2N/A
2N/A
2N/A<!-- ==================================================================== -->
2N/A<!-- <related> -->
2N/A<!-- ==================================================================== -->
2N/A<xsl:template match="related">
2N/A<table class="related">
2N/A<tr>
2N/A <th>
2N/A <xsl:value-of select="$messages/message[@name='relatedmodules']" />
</th>
<th>
<xsl:value-of select="$messages/message[@name='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>
<!-- 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:choose>
<xsl:when test="@style = 'zebra'">
<xsl:for-each select="tr">
<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:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates />
</xsl:otherwise>
</xsl:choose>
</table>
</xsl:template>
<!-- /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="$messages/message[@name='transnote']" />
</em>
<xsl:text> </xsl:text>
<xsl:apply-templates />
<xsl:text>)</xsl:text>
</span>
</xsl:template>
<!-- /transnote -->
<!-- ==================================================================== -->
<!-- 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>Please fix style/xsl/common.xsl!</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>