home *** CD-ROM | disk | FTP | other *** search
/ PC World 2004 May / PCWorld_2004-05_cd.bin / komunikace / apache / apache_2.0.48-win32-x86-no_ssl.msi / Data.Cab / F252984_quickreference.xsl < prev    next >
Extensible Markup Language  |  2003-05-29  |  10KB  |  246 lines

  1. <?xml version="1.0"?><!--
  2. /* ====================================================================
  3.  * The Apache Software License, Version 1.1
  4.  *
  5.  * Copyright (c) 2002-2003 The Apache Software Foundation.  All rights
  6.  * reserved.
  7.  *
  8.  * Redistribution and use in source and binary forms, with or without
  9.  * modification, are permitted provided that the following conditions
  10.  * are met:
  11.  *
  12.  * 1. Redistributions of source code must retain the above copyright
  13.  *    notice, this list of conditions and the following disclaimer.
  14.  *
  15.  * 2. Redistributions in binary form must reproduce the above copyright
  16.  *    notice, this list of conditions and the following disclaimer in
  17.  *    the documentation and/or other materials provided with the
  18.  *    distribution.
  19.  *
  20.  * 3. The end-user documentation included with the redistribution,
  21.  *    if any, must include the following acknowledgment:
  22.  *       "This product includes software developed by the
  23.  *        Apache Software Foundation (http://www.apache.org/)."
  24.  *    Alternately, this acknowledgment may appear in the software itself,
  25.  *    if and wherever such third-party acknowledgments normally appear.
  26.  *
  27.  * 4. The names "Apache" and "Apache Software Foundation" must
  28.  *    not be used to endorse or promote products derived from this
  29.  *    software without prior written permission. For written
  30.  *    permission, please contact apache@apache.org.
  31.  *
  32.  * 5. Products derived from this software may not be called "Apache",
  33.  *    nor may "Apache" appear in their name, without prior written
  34.  *    permission of the Apache Software Foundation.
  35.  *
  36.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  37.  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  38.  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  39.  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  40.  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  41.  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  42.  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  43.  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  44.  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  45.  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  46.  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  47.  * SUCH DAMAGE.
  48.  * ====================================================================
  49.  *
  50.  * This software consists of voluntary contributions made by many
  51.  * individuals on behalf of the Apache Software Foundation.  For more
  52.  * information on the Apache Software Foundation, please see
  53.  * <http://www.apache.org/>.
  54.  */ -->
  55. <!DOCTYPE xsl:stylesheet [
  56.     <!ENTITY lf SYSTEM "util/lf.xml">
  57. ]>
  58. <xsl:stylesheet version="1.0"
  59.               xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  60.                   xmlns="http://www.w3.org/1999/xhtml">
  61.  
  62. <!-- ==================================================================== -->
  63. <!-- <quickreference>                                                     -->
  64. <!-- Builds the directive quickreference page                             -->
  65. <!-- ==================================================================== -->
  66. <xsl:template match="quickreference">
  67. <html xml:lang="{$messages/@lang}" lang="{$messages/@lang}">
  68.     <xsl:call-template name="head"/>&lf;
  69.  
  70.     <body id="directive-index">&lf;
  71.         <xsl:call-template name="top"/>&lf;
  72.  
  73.         <div id="preamble">
  74.             <h1>
  75.                 <xsl:value-of select="title" />
  76.             </h1>&lf;
  77.  
  78.             <xsl:call-template name="langavail" />&lf;
  79.  
  80.             <xsl:apply-templates select="summary" />
  81.         </div>&lf; <!-- /#preamble -->
  82.  
  83.         <div id="directive-ref">
  84.             <xsl:variable name="directives"
  85.                 select="document(modulefilelist/modulefile)
  86.                         /modulesynopsis/directivesynopsis[not(@location)]" />
  87.  
  88.             <xsl:variable name="start-letters">
  89.                 <xsl:call-template name="directive-startletters">
  90.                     <xsl:with-param name="directives" select="$directives" />
  91.                 </xsl:call-template>
  92.             </xsl:variable>
  93.  
  94.             <table id="legend">&lf;
  95.             <tr>
  96.                 <td class="letters">
  97.                     <span>
  98.                         <xsl:call-template name="letter-bar">
  99.                             <xsl:with-param name="letters"
  100.                                 select="$start-letters" />
  101.                             <xsl:with-param name="first" select="true()" />
  102.                         </xsl:call-template>
  103.                     </span>
  104.                 </td>&lf;
  105.                 <td>
  106.                     <xsl:apply-templates select="legend/table[position()=1]" />
  107.                 </td>&lf;
  108.                 <td>
  109.                     <xsl:apply-templates select="legend/table[position()=2]" />
  110.                 </td>
  111.             </tr>&lf;
  112.             </table>&lf;
  113.  
  114.             <table class="qref">&lf;
  115.             <xsl:call-template name="reference-of-letter">
  116.                 <xsl:with-param name="letters-todo" select="$start-letters" />
  117.                 <xsl:with-param name="offset" select="number(0)" />
  118.                 <xsl:with-param name="directives" select="$directives" />
  119.             </xsl:call-template>
  120.             </table>
  121.         </div>&lf; <!-- /#directive-ref -->
  122.  
  123.         <xsl:call-template name="bottom"/>&lf;
  124.     </body>
  125. </html>
  126. </xsl:template>
  127. <!-- /quickreference -->
  128.  
  129.  
  130. <!-- ==================================================================== -->
  131. <!-- the working horse. builds rows of all directives starting with one   -->
  132. <!-- letter when done, it calls itself to catch the next letter           -->
  133. <!-- ==================================================================== -->
  134. <xsl:template name="reference-of-letter">
  135. <xsl:param name="letters-todo" />
  136. <xsl:param name="offset" />
  137. <xsl:param name="directives" />
  138.  
  139. <xsl:variable name="letter" select="substring($letters-todo, 1, 1)" />
  140.  
  141. <xsl:for-each
  142.     select="$directives[$letter=translate(substring(normalize-space(name), 1,1),
  143.                                           $lowercase,$uppercase)]">
  144. <xsl:sort select="name" />
  145.  
  146.     <tr>
  147.         <xsl:if test="position() mod 2 = $offset">
  148.             <xsl:attribute name="class">odd</xsl:attribute>
  149.         </xsl:if>
  150.  
  151.         <td>
  152.             <a href="{../name}.html#{translate(name, $uppercase, $lowercase)}">
  153.                 <xsl:if test="position()=1">
  154.                     <xsl:attribute name="id">
  155.                         <xsl:value-of select="$letter" />
  156.                     </xsl:attribute>
  157.                     <xsl:attribute name="name">
  158.                         <xsl:value-of select="$letter" />
  159.                     </xsl:attribute>
  160.                 </xsl:if>
  161.  
  162.                 <xsl:apply-templates select="syntax" />
  163.             </a>
  164.         </td>
  165.         <td>
  166.             <!-- if the default value contains (at least) one <br />, -->
  167.             <!-- this probably means that a short explanation follows -->
  168.             <!-- the actual default value. We cut off the string      -->
  169.             <!-- after the <br /> so it will not be shown here.       -->
  170.             <!-- (add the + character instead)                        -->
  171.             <xsl:variable name="default">
  172.                 <xsl:choose>
  173.                 <xsl:when test="count(default[count(br) > 0]) > 0">
  174.                     <xsl:value-of
  175.                         select="default/child::node()
  176.                                 [count(preceding-sibling::*) = 0]" />
  177.                 </xsl:when>
  178.                 <xsl:otherwise>
  179.                     <xsl:value-of select="default"/>
  180.                 </xsl:otherwise>
  181.                 </xsl:choose>
  182.             </xsl:variable>
  183.  
  184.             <xsl:value-of select="substring(substring-after(concat($default,
  185.                                   ' '), name),1,20)" />
  186.             <xsl:if test="string-length(substring-after(concat($default, ' '),
  187.                               name)) > 20
  188.                           or count(default[count(br) > 0]) > 0">
  189.                 <xsl:text> +</xsl:text>
  190.             </xsl:if>
  191.         </td>
  192.         <td>
  193.             <xsl:if test="contextlist/context
  194.                           [normalize-space(.)='server config']">s</xsl:if>
  195.             <xsl:if test="contextlist/context
  196.                           [normalize-space(.)='virtual host']">v</xsl:if>
  197.             <xsl:if test="contextlist/context
  198.                           [normalize-space(.)='directory']">d</xsl:if>
  199.             <xsl:if test="contextlist/context
  200.                           [normalize-space(.)='.htaccess']">h</xsl:if>
  201.         </td>
  202.         <td>
  203.             <xsl:choose>
  204.             <xsl:when test="../status='Base'">B</xsl:when>
  205.             <xsl:when test="../status='MPM'">M</xsl:when>
  206.             <xsl:when test="../status='Core'">C</xsl:when>
  207.             <xsl:when test="../status='Extension'">E</xsl:when>
  208.             <xsl:when test="../status='Experimental'">X</xsl:when>
  209.             </xsl:choose>
  210.         </td>
  211.     </tr>
  212.     <tr>
  213.         <xsl:if test="position() mod 2 = $offset">
  214.             <xsl:attribute name="class">odd</xsl:attribute>
  215.         </xsl:if>
  216.  
  217.         <td colspan="4" class="descr">
  218.             <xsl:choose>
  219.             <xsl:when test="string-length(normalize-space(description)) > 0">
  220.                 <xsl:apply-templates select="description"/>
  221.             </xsl:when>
  222.             <xsl:otherwise>
  223.                 <xsl:text>-</xsl:text>
  224.             </xsl:otherwise>
  225.             </xsl:choose>
  226.         </td>
  227.     </tr>&lf;
  228. </xsl:for-each> <!-- /directives -->
  229.  
  230. <!-- call next letter, if there is -->
  231. <xsl:if test="string-length($letters-todo) > 1">
  232.     <xsl:call-template name="reference-of-letter">
  233.         <xsl:with-param name="letters-todo"
  234.             select="substring($letters-todo, 2)" />
  235.         <xsl:with-param name="offset"
  236.             select="(count($directives[$letter=translate(substring(
  237.                     normalize-space(name), 1, 1), $lowercase, $uppercase)])
  238.                     + $offset) mod 2" />
  239.         <xsl:with-param name="directives" select="$directives" />
  240.     </xsl:call-template>
  241. </xsl:if>
  242. </xsl:template>
  243. <!-- /reference-of-letter -->
  244.  
  245. </xsl:stylesheet>
  246.