home *** CD-ROM | disk | FTP | other *** search
/ PC World 2003 November / PCWorld_2003-11_cd.bin / Komunik / apache / apache_2.0.47-win32-x86-no_ssl.msi / Data.Cab / F251396_moduleindex.xsl < prev    next >
Extensible Markup Language  |  2003-05-29  |  16KB  |  369 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. <!-- <moduleindex>                                                        -->
  64. <!-- Builds the moduleindex page                                          -->
  65. <!-- ==================================================================== -->
  66. <xsl:template match="moduleindex">
  67. <html xml:lang="{$messages/@lang}" lang="{$messages/@lang}">
  68.     <xsl:call-template name="head"/>&lf;
  69.  
  70.     <body id="module-index">
  71.         <xsl:call-template name="top"/>  
  72.  
  73.         <div id="page-content">
  74.             <div id="preamble">
  75.                 <h1>
  76.                     <xsl:value-of select="title" />
  77.                 </h1>&lf;
  78.  
  79.                 <xsl:call-template name="langavail" />&lf;
  80.  
  81.                 <xsl:apply-templates select="summary" />
  82.             </div>&lf; <!-- /#preamble -->
  83.  
  84.             <xsl:if test="not($is-chm) or seealso">
  85.                 <div id="quickview">
  86.                     <xsl:if test="not($is-chm)">
  87.                         <ul id="toc">&lf;
  88.                         <li>
  89.                             <img src="{$path}/images/down.gif" alt="" />
  90.                             <xsl:text> </xsl:text>
  91.                             <a href="#core">
  92.                                 <xsl:value-of select="$messages/message
  93.                                                       [@name='corefeatures']" />
  94.                             </a>
  95.                         </li>
  96.                         <li>
  97.                             <img src="{$path}/images/down.gif" alt="" />
  98.                             <xsl:text> </xsl:text>
  99.                             <a href="#other">
  100.                                 <xsl:value-of select="$messages/message
  101.                                                       [@name='othermodules']" />
  102.                             </a>
  103.                         </li>
  104.                         </ul>
  105.                     </xsl:if> <!-- !$is-chm -->
  106.  
  107.                     <xsl:if test="seealso">
  108.                         <h3>
  109.                             <xsl:value-of select="$messages/message
  110.                                                   [@name='seealso']" />
  111.                         </h3>&lf;            
  112.  
  113.                         <ul class="seealso">&lf;
  114.                         <xsl:for-each select="seealso">
  115.                             <li>
  116.                                 <xsl:apply-templates />
  117.                             </li>&lf;
  118.                         </xsl:for-each>
  119.                         </ul>
  120.                     </xsl:if> <!-- /seealso -->
  121.                 </div> <!-- /#quickview -->
  122.             </xsl:if>&lf; <!-- have sidebar -->
  123.  
  124.             <xsl:call-template name="toplink" />&lf;
  125.  
  126.             <div class="section">
  127.                 <h2>
  128.                     <a name="core" id="core">
  129.                         <xsl:value-of select="$messages/message
  130.                                               [@name='corefeatures']" />
  131.                     </a>
  132.                 </h2>&lf;
  133.  
  134.                 <!-- core -->
  135.                 <dl>&lf;
  136.                 <dt>
  137.                     <a href="{document(modulefilelist/modulefile
  138.                                        [starts-with(., 'core.xml')])
  139.                               /modulesynopsis/name}.html">
  140.                         <xsl:value-of
  141.                             select="document(modulefilelist/modulefile
  142.                                              [starts-with(., 'core.xml')])
  143.                                     /modulesynopsis/name" />
  144.                     </a>
  145.                 </dt>
  146.                 <dd>
  147.                     <xsl:apply-templates
  148.                         select="document(modulefilelist/modulefile
  149.                                          [starts-with(., 'core.xml')])
  150.                                 /modulesynopsis/description" />
  151.                 </dd>&lf;
  152.  
  153.                 <!-- mpm_common -->
  154.                 <dt>
  155.                     <a href="{document(modulefilelist/modulefile
  156.                                        [starts-with(., 'mpm_common.xml')])
  157.                               /modulesynopsis/name}.html">
  158.                         <xsl:value-of
  159.                             select="document(modulefilelist/modulefile
  160.                                              [starts-with(., 'mpm_common.xml')])
  161.                                     /modulesynopsis/name" />
  162.                     </a>
  163.                 </dt>
  164.                 <dd class="separate">
  165.                     <xsl:apply-templates
  166.                         select="document(modulefilelist/modulefile
  167.                                          [starts-with(., 'mpm_common.xml')])
  168.                                 /modulesynopsis/description" />
  169.                 </dd>&lf;
  170.  
  171.                 <!-- and now the remaining MPMs -->
  172.                 <xsl:variable name="mpmmodules"
  173.                     select="document(modulefilelist/modulefile)
  174.                             /modulesynopsis
  175.                                 [status='MPM' and name != 'mpm_common']" />
  176.                 <xsl:variable name="translist">
  177.                     <xsl:call-template name="module-translist">
  178.                         <xsl:with-param name="modules" select="$mpmmodules" />
  179.                     </xsl:call-template>
  180.                 </xsl:variable>
  181.  
  182.                 <xsl:for-each select="$mpmmodules">
  183.                 <xsl:sort select="substring-before(substring-after($translist,
  184.                     concat('- ', translate(normalize-space(name), $lowercase,
  185.                     $uppercase), ' ')), ' -')" />
  186.  
  187.                     <dt>
  188.                         <a href="{name}.html">
  189.                             <xsl:value-of select="name" />
  190.                         </a>
  191.                     </dt>
  192.                     <dd>
  193.                         <xsl:apply-templates select="description" />
  194.                     </dd>&lf;
  195.                 </xsl:for-each>
  196.                 </dl>
  197.             </div>&lf; <!-- /core section -->
  198.  
  199.             <xsl:call-template name="toplink" />&lf;
  200.  
  201.             <div class="section">
  202.                 <h2>
  203.                     <a name="other" id="other">
  204.                         <xsl:value-of select="$messages/message
  205.                                               [@name='othermodules']" />
  206.                     </a>
  207.                 </h2>&lf;
  208.             
  209.                 <xsl:variable name="modules"
  210.                     select="document(modulefilelist/modulefile)
  211.                             /modulesynopsis[status!='MPM' and
  212.                                             status!='Core']" />
  213.  
  214.                 <xsl:variable name="start-letters">
  215.                     <xsl:call-template name="module-startletters">
  216.                         <xsl:with-param name="modules" select="$modules" />
  217.                     </xsl:call-template>
  218.                 </xsl:variable>
  219.  
  220.                 <p class="letters">
  221.                     <xsl:call-template name="letter-bar">
  222.                         <xsl:with-param name="letters" select="$start-letters"/>
  223.                         <xsl:with-param name="first" select="true()"/>
  224.                     </xsl:call-template>
  225.                 </p>&lf;
  226.  
  227.                 <dl>
  228.                 <xsl:call-template name="mindex-of-letter">
  229.                     <xsl:with-param name="letters-todo"
  230.                         select="$start-letters" />
  231.                     <xsl:with-param name="modules" select="$modules" />
  232.                 </xsl:call-template>
  233.                 </dl>
  234.             </div> <!-- /modules section -->
  235.         </div>&lf; <!-- /#page-content -->
  236.  
  237.         <xsl:call-template name="bottom" />&lf;
  238.     </body>
  239. </html>
  240. </xsl:template> 
  241. <!-- /moduleindex -->
  242.  
  243.  
  244. <!-- ==================================================================== -->
  245. <!-- the working horse. builds list items of all modules starting with    -->
  246. <!-- one letter when done, it calls itself to catch the next letter       -->
  247. <!-- ==================================================================== -->
  248. <xsl:template name="mindex-of-letter">
  249. <xsl:param name="letters-todo"/>
  250. <xsl:param name="modules"/>
  251.  
  252. <xsl:variable name="letter" select="substring($letters-todo, 1, 1)" />
  253. <xsl:variable name="translist">
  254.     <xsl:call-template name="module-translist">
  255.         <xsl:with-param name="modules" select="$modules" />
  256.     </xsl:call-template>
  257. </xsl:variable>
  258.  
  259. <xsl:for-each
  260.     select="$modules[$letter=substring(substring-before(substring-after(
  261.         $translist, concat('- ', translate(normalize-space(name), $lowercase,
  262.         $uppercase), ' ')), ' -'), 1, 1)]">
  263. <xsl:sort
  264.     select="substring-before(substring-after($translist, concat('- ',
  265.         translate(normalize-space(name),$lowercase,$uppercase), ' ')), ' -')" />
  266.  
  267.     <dt>
  268.         <a href="{name}.html">
  269.             <xsl:if test="position() = 1">
  270.                 <xsl:attribute name="id">
  271.                     <xsl:value-of select="$letter" />
  272.                 </xsl:attribute>
  273.                 <xsl:attribute name="name">
  274.                     <xsl:value-of select="$letter" />
  275.                 </xsl:attribute>
  276.             </xsl:if>
  277.  
  278.             <xsl:value-of select="name" />
  279.         </a>
  280.     </dt>
  281.     <dd>
  282.         <xsl:apply-templates select="description" />
  283.     </dd>&lf;
  284. </xsl:for-each> <!-- /directives -->
  285.  
  286. <!-- call next letter, if there is -->
  287. <xsl:if test="string-length($letters-todo) > 1">
  288.     <xsl:call-template name="mindex-of-letter">
  289.         <xsl:with-param name="letters-todo"
  290.             select="substring($letters-todo, 2)" />
  291.         <xsl:with-param name="modules" select="$modules" />
  292.     </xsl:call-template>
  293. </xsl:if>
  294. </xsl:template>
  295. <!-- /mindex-of-letter -->
  296.  
  297.  
  298. <!-- ==================================================================== -->
  299. <!-- collect start letters of modules                                     -->
  300. <!-- ==================================================================== -->
  301. <xsl:template name="module-startletters">
  302. <xsl:param name="modules" />
  303.  
  304. <xsl:variable name="translist">
  305.     <xsl:call-template name="module-translist">
  306.         <xsl:with-param name="modules" select="$modules" />
  307.     </xsl:call-template>
  308. </xsl:variable>
  309.  
  310. <xsl:call-template name="_squeeze-letters">
  311.     <xsl:with-param name="lastletter" select="''" />
  312.     <xsl:with-param name="letters">
  313.         <xsl:for-each select="$modules">
  314.         <xsl:sort
  315.             select="substring-before(substring-after($translist, concat('- ',
  316.                 translate(normalize-space(name), $lowercase, $uppercase), ' ')),
  317.                 ' -')" />
  318.             <xsl:value-of
  319.                 select="substring(substring-before(substring-after($translist,
  320.                     concat('- ', translate(normalize-space(name), $lowercase,
  321.                     $uppercase), ' ')), ' -'), 1, 1)" />
  322.         </xsl:for-each>
  323.     </xsl:with-param>
  324. </xsl:call-template>
  325. </xsl:template>
  326. <!-- /module-startletters -->
  327.  
  328.  
  329. <!-- ==================================================================== -->
  330. <!-- define module name translations for sorting                          -->
  331. <!--                                                                      -->
  332. <!-- it's a kind of a hack...                                             -->
  333. <!-- we build a string that contains the following data:                  -->
  334. <!-- "- modulename sortname - modulename sortname - ..."                  -->
  335. <!-- (with all data in uppercase)                                         -->
  336. <!--                                                                      -->
  337. <!-- So, the translation from modulename to sortname can be done with the -->
  338. <!-- expression below:                                                    -->
  339. <!--
  340.        substring-before(
  341.            substring-after($translist, 
  342.                            concat('- ', translate(modulename,
  343.                                                   $lowercase, $uppercase),
  344.                                   ' ')
  345.                            ),
  346.            ' -')
  347.                                                                           -->
  348. <!-- ==================================================================== -->
  349. <xsl:template name="module-translist">
  350. <xsl:param name="modules" />
  351.  
  352. <xsl:text>-</xsl:text>
  353. <xsl:for-each select="$modules">
  354.     <xsl:variable name="sname" select="translate(normalize-space(name),
  355.                                        $lowercase, $uppercase)" />
  356.  
  357.     <xsl:text> </xsl:text>
  358.     <xsl:value-of select="$sname" />
  359.     <xsl:text> </xsl:text>
  360.     <xsl:call-template name="module-translatename">
  361.         <xsl:with-param name="name" select="$sname" />
  362.     </xsl:call-template>
  363.     <xsl:text> -</xsl:text>
  364. </xsl:for-each>
  365. </xsl:template>
  366. <!-- /module-translist -->
  367.  
  368. </xsl:stylesheet>
  369.