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 / F252971_moduleindex.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2003-06-30  |  9.8 KB  |  254 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. <xsl:stylesheet version="1.0"
  56.               xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  57.                   xmlns="http://www.w3.org/1999/xhtml">
  58.  
  59. <!-- ==================================================================== -->
  60. <!-- <moduleindex>                                                        -->
  61. <!-- Builds the moduleindex page                                          -->
  62. <!-- ==================================================================== -->
  63. <xsl:template match="moduleindex">
  64.  
  65.   <xsl:variable name="metafile" select="document(/*/@metafile)/metafile" /> 
  66.  
  67.   <xsl:call-template name="section-title"/>
  68.  
  69.   <xsl:apply-templates select="summary"/>
  70.  
  71.   <xsl:call-template name="seealso"/>
  72.  
  73.    <xsl:text>\subsection*{</xsl:text>
  74.    <xsl:value-of select="$messages/message[@name='corefeatures']" />
  75.    <xsl:text>}
  76.  
  77. \begin{description}
  78. \item[</xsl:text>
  79.     <xsl:apply-templates select="document(modulefilelist/modulefile
  80.                               [starts-with(., 'core.xml')])
  81.                               /modulesynopsis/name"/>
  82.     <xsl:text>] (p.\ \pageref{/mod/</xsl:text>
  83.     <xsl:value-of select="document(modulefilelist/modulefile
  84.                               [starts-with(., 'core.xml')])
  85.                               /modulesynopsis/name"/>
  86.     <xsl:text>}) </xsl:text>
  87.  
  88.     <xsl:apply-templates select="document(modulefilelist/modulefile
  89.                                  [starts-with(., 'core.xml')])
  90.                                  /modulesynopsis/description" />
  91.  
  92.     <xsl:text>
  93. \item[</xsl:text>
  94.  
  95.     <xsl:apply-templates  select="document(modulefilelist/modulefile
  96.                                   [starts-with(., 'mpm_common.xml')])
  97.                                   /modulesynopsis/name" />
  98.     <xsl:text>] (p.\ \pageref{/mod/</xsl:text>
  99.     <xsl:value-of select="document(modulefilelist/modulefile
  100.                                    [starts-with(., 'mpm_common.xml')])
  101.                                    /modulesynopsis/name"/>
  102.     <xsl:text>}) </xsl:text>
  103.     <xsl:apply-templates select="document(modulefilelist/modulefile
  104.                                          [starts-with(., 'mpm_common.xml')])
  105.                                          /modulesynopsis/description" />
  106.  
  107.  
  108.  
  109.     <!-- and now the remaining MPMs -->
  110.     <xsl:variable name="mpmmodules"
  111.          select="document(modulefilelist/modulefile)
  112.                  /modulesynopsis[status='MPM' and name != 'mpm_common']" />
  113.     <xsl:variable name="translist">
  114.       <xsl:call-template name="module-translist">
  115.          <xsl:with-param name="modules" select="$mpmmodules" />
  116.       </xsl:call-template>
  117.     </xsl:variable>
  118.  
  119.     <xsl:for-each select="$mpmmodules">
  120.       <xsl:sort select="substring-before(substring-after($translist,
  121.                   concat('- ', translate(normalize-space(name), $lowercase,
  122.                   $uppercase), ' ')), ' -')" />
  123.  
  124.       <xsl:text>
  125. \item[</xsl:text>
  126.       <xsl:apply-templates select="name"/>
  127.       <xsl:text>] (p.\ \pageref{/mod/</xsl:text>
  128.       <xsl:value-of select="name"/>
  129.       <xsl:text>}) </xsl:text>
  130.  
  131.       <xsl:apply-templates select="description" />
  132.  
  133.     </xsl:for-each>
  134.  
  135.     <xsl:text>\end{description}
  136.  
  137. </xsl:text>
  138.  
  139.     <!-- /core section -->
  140.  
  141.     <xsl:text>\section*{</xsl:text>
  142.     <xsl:value-of select="$messages/message[@name='othermodules']" />
  143.     <xsl:text>}
  144. \begin{description}
  145. </xsl:text>
  146.             
  147.     <xsl:variable name="modules"
  148.          select="document(modulefilelist/modulefile)
  149.                  /modulesynopsis[status!='MPM' and status!='Core']" />
  150.  
  151.     <xsl:call-template name="mindex-of-letter">
  152.        <xsl:with-param name="modules" select="$modules" />
  153.     </xsl:call-template>
  154.  
  155.     <xsl:text>\end{description}
  156. </xsl:text>
  157. </xsl:template> 
  158. <!-- /moduleindex -->
  159.  
  160.  
  161. <!-- ==================================================================== -->
  162. <!-- the working horse. builds list items of all modules starting with    -->
  163. <!-- one letter when done, it calls itself to catch the next letter       -->
  164. <!-- ==================================================================== -->
  165. <xsl:template name="mindex-of-letter">
  166. <xsl:param name="modules"/>
  167.  
  168. <xsl:variable name="translist">
  169.     <xsl:call-template name="module-translist">
  170.         <xsl:with-param name="modules" select="$modules" />
  171.     </xsl:call-template>
  172. </xsl:variable>
  173.  
  174. <xsl:for-each select="$modules">
  175. <xsl:sort
  176.     select="substring-before(substring-after($translist, concat('- ',
  177.         translate(normalize-space(name),$lowercase,$uppercase), ' ')), ' -')" />
  178.  
  179. <xsl:text>
  180. \item[</xsl:text>
  181. <xsl:apply-templates select="name"/>
  182. <xsl:text>] (p.\ \pageref{/mod/</xsl:text>
  183. <xsl:value-of select="name"/>
  184. <xsl:text>}) </xsl:text>
  185.  
  186.         <xsl:apply-templates select="description" />
  187.  
  188. </xsl:for-each> <!-- /directives -->
  189.  
  190. </xsl:template>
  191. <!-- /mindex-of-letter -->
  192.  
  193. <!-- ==================================================================== -->
  194. <!-- define module name translations for sorting                          -->
  195. <!--                                                                      -->
  196. <!-- it's a kind of a hack...                                             -->
  197. <!-- we build a string that contains the following data:                  -->
  198. <!-- "- modulename sortname - modulename sortname - ..."                  -->
  199. <!-- (with all data in uppercase)                                         -->
  200. <!--                                                                      -->
  201. <!-- So, the translation from modulename to sortname can be done with the -->
  202. <!-- expression below:                                                    -->
  203. <!--
  204.        substring-before(
  205.            substring-after($translist, 
  206.                            concat('- ', translate(modulename,
  207.                                                   $lowercase, $uppercase),
  208.                                   ' ')
  209.                            ),
  210.            ' -')
  211.                                                                           -->
  212. <!-- ==================================================================== -->
  213. <xsl:template name="module-translist">
  214. <xsl:param name="modules" />
  215.  
  216. <xsl:text>-</xsl:text>
  217. <xsl:for-each select="$modules">
  218.     <xsl:variable name="sname" select="translate(normalize-space(name),
  219.                                        $lowercase, $uppercase)" />
  220.  
  221.     <xsl:text> </xsl:text>
  222.     <xsl:value-of select="$sname" />
  223.     <xsl:text> </xsl:text>
  224.     <xsl:call-template name="module-translatename">
  225.         <xsl:with-param name="name" select="$sname" />
  226.     </xsl:call-template>
  227.     <xsl:text> -</xsl:text>
  228. </xsl:for-each>
  229. </xsl:template>
  230. <!-- /module-translist -->
  231.  
  232. <xsl:template name="module-translatename">
  233. <xsl:param name="name" />
  234.  
  235. <xsl:variable name="sname" select="translate($name, $lowercase, $uppercase)" />
  236.  
  237. <xsl:choose>
  238. <xsl:when test="starts-with($sname, 'MOD_') or starts-with($sname, 'MPM_')">
  239.     <xsl:value-of select="substring($name, 5)" />
  240. </xsl:when>
  241.  
  242. <xsl:when test="starts-with($sname, 'MPMT_')">
  243.     <xsl:value-of select="substring($name, 6)" />
  244. </xsl:when>
  245.  
  246. <xsl:otherwise>
  247.     <xsl:value-of select="$name" />
  248. </xsl:otherwise>
  249. </xsl:choose>
  250. </xsl:template>
  251. <!-- /module-translatename -->
  252.  
  253. </xsl:stylesheet>
  254.