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