home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 November / CMCD1104.ISO / Software / Complet / Apache / apache_2.0.52-win32-x86-no_ssl.msi / Data.Cab / F278613_quickreference.xsl < prev    next >
Extensible Markup Language  |  2004-05-04  |  8KB  |  210 lines

  1. <?xml version="1.0"?>
  2.  
  3. <!--
  4.  Copyright 2002-2004 The Apache Software Foundation
  5.  
  6.  Licensed under the Apache License, Version 2.0 (the "License");
  7.  you may not use this file except in compliance with the License.
  8.  You may obtain a copy of the License at
  9.  
  10.      http://www.apache.org/licenses/LICENSE-2.0
  11.  
  12.  Unless required by applicable law or agreed to in writing, software
  13.  distributed under the License is distributed on an "AS IS" BASIS,
  14.  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15.  See the License for the specific language governing permissions and
  16.  limitations under the License.
  17. -->
  18.  
  19. <!DOCTYPE xsl:stylesheet [
  20.     <!ENTITY lf SYSTEM "util/lf.xml">
  21. ]>
  22. <xsl:stylesheet version="1.0"
  23.               xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  24.                   xmlns="http://www.w3.org/1999/xhtml">
  25.  
  26. <!-- ==================================================================== -->
  27. <!-- <quickreference>                                                     -->
  28. <!-- Builds the directive quickreference page                             -->
  29. <!-- ==================================================================== -->
  30. <xsl:template match="quickreference">
  31. <html xml:lang="{$doclang}" lang="{$doclang}">
  32.     <xsl:call-template name="head"/>&lf;
  33.  
  34.     <body id="directive-index">&lf;
  35.         <xsl:call-template name="top"/>&lf;
  36.  
  37.         <div id="preamble">
  38.             <h1>
  39.                 <xsl:value-of select="title" />
  40.             </h1>&lf;
  41.  
  42.             <xsl:call-template name="langavail" />&lf;
  43.  
  44.             <xsl:apply-templates select="summary" />
  45.         </div>&lf; <!-- /#preamble -->
  46.  
  47.         <div id="directive-ref">
  48.             <xsl:variable name="directives"
  49.                 select="document(document($allmodules)/modulefilelist/modulefile)
  50.                         /modulesynopsis/directivesynopsis[not(@location)]" />
  51.  
  52.             <xsl:variable name="start-letters">
  53.                 <xsl:call-template name="directive-startletters">
  54.                     <xsl:with-param name="directives" select="$directives" />
  55.                 </xsl:call-template>
  56.             </xsl:variable>
  57.  
  58.             <table id="legend">&lf;
  59.             <tr>
  60.                 <td class="letters">
  61.                     <span>
  62.                         <xsl:call-template name="letter-bar">
  63.                             <xsl:with-param name="letters"
  64.                                 select="$start-letters" />
  65.                             <xsl:with-param name="first" select="true()" />
  66.                         </xsl:call-template>
  67.                     </span>
  68.                 </td>&lf;
  69.                 <td>
  70.                     <xsl:apply-templates select="legend/table[position()=1]" />
  71.                 </td>&lf;
  72.                 <td>
  73.                     <xsl:apply-templates select="legend/table[position()=2]" />
  74.                 </td>
  75.             </tr>&lf;
  76.             </table>&lf;
  77.  
  78.             <table class="qref">&lf;
  79.             <xsl:call-template name="reference-of-letter">
  80.                 <xsl:with-param name="letters-todo" select="$start-letters" />
  81.                 <xsl:with-param name="offset" select="number(0)" />
  82.                 <xsl:with-param name="directives" select="$directives" />
  83.             </xsl:call-template>
  84.             </table>
  85.         </div>&lf; <!-- /#directive-ref -->
  86.  
  87.         <xsl:call-template name="bottom"/>&lf;
  88.     </body>
  89. </html>
  90. </xsl:template>
  91. <!-- /quickreference -->
  92.  
  93.  
  94. <!-- ==================================================================== -->
  95. <!-- the working horse. builds rows of all directives starting with one   -->
  96. <!-- letter when done, it calls itself to catch the next letter           -->
  97. <!-- ==================================================================== -->
  98. <xsl:template name="reference-of-letter">
  99. <xsl:param name="letters-todo" />
  100. <xsl:param name="offset" />
  101. <xsl:param name="directives" />
  102.  
  103. <xsl:variable name="letter" select="substring($letters-todo, 1, 1)" />
  104.  
  105. <xsl:for-each
  106.     select="$directives[$letter=translate(substring(normalize-space(name), 1,1),
  107.                                           $lowercase,$uppercase)]">
  108. <xsl:sort select="name" />
  109.  
  110.     <tr>
  111.         <xsl:if test="position() mod 2 = $offset">
  112.             <xsl:attribute name="class">odd</xsl:attribute>
  113.         </xsl:if>
  114.  
  115.         <td>
  116.             <a href="{../name}.html#{translate(name, $uppercase, $lowercase)}">
  117.                 <xsl:if test="position()=1">
  118.                     <xsl:attribute name="id">
  119.                         <xsl:value-of select="$letter" />
  120.                     </xsl:attribute>
  121.                     <xsl:attribute name="name">
  122.                         <xsl:value-of select="$letter" />
  123.                     </xsl:attribute>
  124.                 </xsl:if>
  125.  
  126.                 <xsl:apply-templates select="syntax" />
  127.             </a>
  128.         </td>
  129.         <td>
  130.             <!-- if the default value contains (at least) one <br />, -->
  131.             <!-- this probably means that a short explanation follows -->
  132.             <!-- the actual default value. We cut off the string      -->
  133.             <!-- after the <br /> so it will not be shown here.       -->
  134.             <!-- (add the + character instead)                        -->
  135.             <xsl:variable name="default">
  136.                 <xsl:choose>
  137.                 <xsl:when test="count(default[count(br) > 0]) > 0">
  138.                     <xsl:value-of
  139.                         select="default/child::node()
  140.                                 [count(preceding-sibling::*) = 0]" />
  141.                 </xsl:when>
  142.                 <xsl:otherwise>
  143.                     <xsl:value-of select="default"/>
  144.                 </xsl:otherwise>
  145.                 </xsl:choose>
  146.             </xsl:variable>
  147.  
  148.             <xsl:value-of select="substring(substring-after(concat($default,
  149.                                   ' '), name),1,20)" />
  150.             <xsl:if test="string-length(substring-after(concat($default, ' '),
  151.                               name)) > 20
  152.                           or count(default[count(br) > 0]) > 0">
  153.                 <xsl:text> +</xsl:text>
  154.             </xsl:if>
  155.         </td>
  156.         <td>
  157.             <xsl:if test="contextlist/context
  158.                           [normalize-space(.)='server config']">s</xsl:if>
  159.             <xsl:if test="contextlist/context
  160.                           [normalize-space(.)='virtual host']">v</xsl:if>
  161.             <xsl:if test="contextlist/context
  162.                           [normalize-space(.)='directory']">d</xsl:if>
  163.             <xsl:if test="contextlist/context
  164.                           [normalize-space(.)='.htaccess']">h</xsl:if>
  165.         </td>
  166.         <td>
  167.             <xsl:choose>
  168.             <xsl:when test="../status='Base'">B</xsl:when>
  169.             <xsl:when test="../status='MPM'">M</xsl:when>
  170.             <xsl:when test="../status='Core'">C</xsl:when>
  171.             <xsl:when test="../status='Extension'">E</xsl:when>
  172.             <xsl:when test="../status='Experimental'">X</xsl:when>
  173.             </xsl:choose>
  174.         </td>
  175.     </tr>
  176.     <tr>
  177.         <xsl:if test="position() mod 2 = $offset">
  178.             <xsl:attribute name="class">odd</xsl:attribute>
  179.         </xsl:if>
  180.  
  181.         <td colspan="4" class="descr">
  182.             <xsl:choose>
  183.             <xsl:when test="string-length(normalize-space(description)) > 0">
  184.                 <xsl:apply-templates select="description"/>
  185.             </xsl:when>
  186.             <xsl:otherwise>
  187.                 <xsl:text>-</xsl:text>
  188.             </xsl:otherwise>
  189.             </xsl:choose>
  190.         </td>
  191.     </tr>&lf;
  192. </xsl:for-each> <!-- /directives -->
  193.  
  194. <!-- call next letter, if there is -->
  195. <xsl:if test="string-length($letters-todo) > 1">
  196.     <xsl:call-template name="reference-of-letter">
  197.         <xsl:with-param name="letters-todo"
  198.             select="substring($letters-todo, 2)" />
  199.         <xsl:with-param name="offset"
  200.             select="(count($directives[$letter=translate(substring(
  201.                     normalize-space(name), 1, 1), $lowercase, $uppercase)])
  202.                     + $offset) mod 2" />
  203.         <xsl:with-param name="directives" select="$directives" />
  204.     </xsl:call-template>
  205. </xsl:if>
  206. </xsl:template>
  207. <!-- /reference-of-letter -->
  208.  
  209. </xsl:stylesheet>
  210.