home *** CD-ROM | disk | FTP | other *** search
/ PC World 2003 May / PCWorld_2003-05_cd.bin / Komunik / apache / apache_2.0.45-win32-x86-no_ssl.msi / Data.Cab / F233078_quickreference.xsl < prev    next >
Extensible Markup Language  |  2002-12-24  |  7KB  |  217 lines

  1. <?xml version="1.0"?>
  2. <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]>
  3. <xsl:stylesheet version="1.0"
  4.               xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  5.                   xmlns="http://www.w3.org/1999/xhtml">
  6.  
  7.   <!--                                                    -->
  8.   <!-- <quickreference>                                   -->
  9.   <!-- Builds the directive quickreference page           -->
  10.   <!--                                                    -->
  11.   <xsl:template match="quickreference">
  12.     <html xml:lang="{$messages/@lang}" lang="{$messages/@lang}">
  13.       <xsl:call-template name="head"/>
  14.  
  15. <xsl:text>
  16. </xsl:text> <!-- insert line break -->
  17.  
  18.       <body id="directive-index">
  19.  
  20. <xsl:text>
  21. </xsl:text> <!-- insert line break -->
  22.  
  23.         <xsl:call-template name="top"/>
  24.  
  25. <xsl:text>
  26. </xsl:text> <!-- insert line break -->
  27.  
  28.         <div id="preamble">
  29.           <h1>
  30.             <xsl:value-of select="title"/>
  31.           </h1>
  32.  
  33. <xsl:text>
  34. </xsl:text> <!-- insert line break -->
  35.  
  36.           <xsl:apply-templates select="summary" />
  37.         </div> <!-- /preamble -->
  38.  
  39. <xsl:text>
  40. </xsl:text> <!-- insert a line break -->
  41.  
  42.         <div id="directive-ref">
  43.  
  44.          <xsl:variable name="directives" select="document(sitemap/category[@id='modules']/modulefilelist/modulefile)/modulesynopsis[status!='Obsolete']/directivesynopsis[not(@location)]"/>
  45.  
  46.           <!-- first collect the start letters -->
  47.           <xsl:variable name="start-letters">
  48.             <xsl:call-template name="directive-startletters">
  49.               <xsl:with-param name="directives" select="$directives"/>
  50.             </xsl:call-template>
  51.           </xsl:variable>
  52.  
  53.           <table id="legend">
  54.  
  55. <xsl:text>
  56. </xsl:text> <!-- insert line break -->
  57.  
  58.             <tr>
  59.               <td class="letters"><span>
  60.                 <xsl:call-template name="letter-bar">
  61.                   <xsl:with-param name="letters" select="$start-letters"/>
  62.                   <xsl:with-param name="first" select="true()"/>
  63.                 </xsl:call-template>
  64.               </span></td>
  65.  
  66. <xsl:text>
  67. </xsl:text> <!-- insert a line break -->
  68.  
  69.               <td>
  70.                 <xsl:apply-templates select="legend/table[position()=1]"/>
  71.               </td>
  72.  
  73. <xsl:text>
  74. </xsl:text> <!-- insert line break -->
  75.  
  76.               <td>
  77.                 <xsl:apply-templates select="legend/table[position()=2]"/>
  78.               </td>
  79.             </tr>
  80.  
  81. <xsl:text>
  82. </xsl:text> <!-- insert line break -->
  83.  
  84.           </table>
  85.  
  86. <xsl:text>
  87. </xsl:text> <!-- insert a line break -->
  88.  
  89.           <table class="qref">
  90.  
  91. <xsl:text>
  92. </xsl:text> <!-- insert line break -->
  93.  
  94.             <xsl:call-template name="reference-of-letter">
  95.               <xsl:with-param name="letters-todo" select="$start-letters"/>
  96.               <xsl:with-param name="offset" select="number(0)"/>
  97.               <xsl:with-param name="directives" select="$directives"/>
  98.             </xsl:call-template>
  99.           </table>
  100.  
  101.         </div> <!-- /directive-ref -->
  102.  
  103. <xsl:text>
  104. </xsl:text> <!-- insert line break -->
  105.  
  106.         <xsl:call-template name="bottom"/>
  107.  
  108. <xsl:text>
  109. </xsl:text> <!-- insert line break -->
  110.  
  111.       </body>
  112.     </html>
  113.   </xsl:template>
  114.  
  115.  
  116.   <!--                                                     -->
  117.   <!-- the working horse. builds rows of all directives    -->
  118.   <!-- starting with one letter                            -->
  119.   <!-- when done, it calls itself to catch the next letter -->
  120.   <!--                                                     -->
  121.   <xsl:template name="reference-of-letter">
  122.   <xsl:param name="letters-todo"/>
  123.   <xsl:param name="offset"/>
  124.   <xsl:param name="directives"/>
  125.  
  126.     <xsl:variable name="letter" select="substring($letters-todo,1,1)"/>
  127.  
  128.     <xsl:for-each select="$directives[$letter=translate(substring(normalize-space(name),1,1),$lowercase,$uppercase)]">
  129.     <xsl:sort select="name"/>
  130.  
  131.       <tr>
  132.         <xsl:if test="position() mod 2 = $offset">
  133.           <xsl:attribute name="class">odd</xsl:attribute>
  134.         </xsl:if>
  135.  
  136.         <td>
  137.           <a href="{../name}.html#{translate(name,$uppercase,$lowercase)}">
  138.             <xsl:if test="position()=1">
  139.               <xsl:attribute name="id"><xsl:value-of select="$letter"/></xsl:attribute>
  140.               <xsl:attribute name="name"><xsl:value-of select="$letter"/></xsl:attribute>
  141.             </xsl:if>
  142.  
  143.             <xsl:apply-templates select="syntax"/>
  144.           </a>
  145.         </td>
  146.  
  147.         <td>
  148.           <xsl:variable name="default">
  149.             <xsl:choose>
  150.               <xsl:when test="count(default[count(br) > 0]) > 0">
  151.                 <xsl:value-of select="default/child::node()[count(preceding-sibling::*) = 0]"/>
  152.               </xsl:when>
  153.               <xsl:otherwise>
  154.                 <xsl:value-of select="default"/>
  155.               </xsl:otherwise>
  156.             </xsl:choose>
  157.           </xsl:variable>
  158.  
  159.           <xsl:value-of select="substring(substring-after(concat($default,' '),name),1,20)"/>
  160.           <xsl:if test="string-length(substring-after(concat($default,' '),name)) > 20
  161.                      or count(default[count(br) > 0]) > 0">
  162.             <xsl:text> +</xsl:text>
  163.           </xsl:if>
  164.         </td>
  165.  
  166.         <td>
  167.           <xsl:if test="contextlist/context[normalize-space(.)='server config']">s</xsl:if>
  168.           <xsl:if test="contextlist/context[normalize-space(.)='virtual host']">v</xsl:if>
  169.           <xsl:if test="contextlist/context[normalize-space(.)='directory']">d</xsl:if>
  170.           <xsl:if test="contextlist/context[normalize-space(.)='.htaccess']">h</xsl:if>
  171.         </td>
  172.  
  173.         <td>
  174.           <xsl:choose>
  175.             <xsl:when test="../status='Base'">B</xsl:when>
  176.             <xsl:when test="../status='MPM'">M</xsl:when>
  177.             <xsl:when test="../status='Core'">C</xsl:when>
  178.             <xsl:when test="../status='Extension'">E</xsl:when>
  179.             <xsl:when test="../status='Experimental'">X</xsl:when>
  180.           </xsl:choose>
  181.         </td>
  182.       </tr>
  183.  
  184.       <tr>
  185.         <xsl:if test="position() mod 2 = $offset">
  186.           <xsl:attribute name="class">odd</xsl:attribute>
  187.         </xsl:if>
  188.  
  189.         <td colspan="4" class="descr"><xsl:choose>
  190.           <xsl:when test="string-length(normalize-space(description)) > 0">
  191.             <xsl:apply-templates select="description"/>
  192.           </xsl:when>
  193.  
  194.           <xsl:otherwise>
  195.             <xsl:text>-</xsl:text>
  196.           </xsl:otherwise></xsl:choose>
  197.         </td>
  198.       </tr>
  199.  
  200. <xsl:text>
  201. </xsl:text> <!-- insert a line break -->
  202.  
  203.     </xsl:for-each> <!-- /directives -->
  204.  
  205.     <!-- call next letter, if there is -->
  206.     <xsl:if test="string-length($letters-todo) > 1">
  207.       <xsl:call-template name="reference-of-letter">
  208.         <xsl:with-param name="letters-todo" select="substring($letters-todo,2)"/>
  209.         <xsl:with-param name="offset" select="(count($directives[$letter=translate(substring(normalize-space(name),1,1),$lowercase,$uppercase)]) + $offset) mod 2"/>
  210.         <xsl:with-param name="directives" select="$directives"/>
  211.       </xsl:call-template>
  212.     </xsl:if>
  213.  
  214.   </xsl:template>
  215.   <!-- /reference-of-letter -->
  216.  
  217. </xsl:stylesheet>