httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n.@apache.org
Subject cvs commit: httpd-2.0/docs/manual/style/xsl moduleindex.xsl
Date Wed, 11 Dec 2002 15:39:28 GMT
nd          2002/12/11 07:39:27

  Modified:    docs/manual/style/xsl moduleindex.xsl
  Log:
  cleanup and introduce a letter bar for "other" modules for
  better navigation. insert also some more line breaks for better diffs.
  
  Reviewed by: Erik Abele, Astrid Ke▀ler
  
  Revision  Changes    Path
  1.5       +187 -102  httpd-2.0/docs/manual/style/xsl/moduleindex.xsl
  
  Index: moduleindex.xsl
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/docs/manual/style/xsl/moduleindex.xsl,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- moduleindex.xsl	2 Dec 2002 21:58:35 -0000	1.4
  +++ moduleindex.xsl	11 Dec 2002 15:39:26 -0000	1.5
  @@ -14,7 +14,6 @@
         <body id="module-index">
           <xsl:call-template name="top"/>  
   
  -<!--        <div id="page-content"> -->
           <div id="preamble">
             <h1>
               <xsl:value-of select="title"/>
  @@ -22,40 +21,15 @@
             
             <xsl:apply-templates select="summary" />
           </div>
  -          
  -<!--
  -        <div id="quickview">
  -          <ul id="toc">
  -            <li>
  -              <img src="{$path}/images/down.gif" alt="" />
  -              <xsl:text> </xsl:text>
  -              <a href="#core">
  -                <xsl:value-of select="$messages/message[@name='corefeatures']"/>
  -              </a>
  -            </li>
  -            
  -            <li>
  -              <img src="{$path}/images/down.gif" alt="" />
  -              <xsl:text> </xsl:text>
  -              <a href="#other">
  -                <xsl:value-of select="$messages/message[@name='othermodules']"/>
  -              </a>
  -            </li>
  -
  -            <li>
  -              <img src="{$path}/images/down.gif" alt="" />
  -              <xsl:text> </xsl:text>
  -              <a href="#obsolete">
  -                <xsl:value-of select="$messages/message[@name='obsoletemodules']"/>
  -              </a>
  -            </li>
  -          </ul>
  -        </div>
  --->
  -        <!-- /quickview -->
  +
  +<xsl:text>
  +</xsl:text> <!-- insert line break -->
   
           <xsl:call-template name="toplink"/>
   
  +<xsl:text>
  +</xsl:text> <!-- insert line break -->
  +
           <div class="section">
             <h2>
               <a name="core" id="core">
  @@ -63,31 +37,42 @@
               </a>
             </h2>
   
  +<xsl:text>
  +</xsl:text> <!-- insert line break -->
  +
             <dl>
  -            <xsl:for-each select="document(sitemap/category[@id='modules']/modulefilelist/modulefile)/modulesynopsis">
  -              <xsl:sort select="name"/>
   
  -              <xsl:if test="status='MPM' or status='Core'">
  -                <dt>
  -                  <a href="{name}.html">
  -                    <xsl:value-of select="name"/>
  -                  </a>
  -                </dt>
  -                <dd>
  -                  <xsl:apply-templates select="description"/>
  -                </dd>
  +<xsl:text>
  +</xsl:text> <!-- insert line break -->
  +
  +            <xsl:for-each select="document(sitemap/category[@id='modules']/modulefilelist/modulefile)/modulesynopsis[status='MPM'
or status='Core']">
  +            <xsl:sort select="name"/>
  +
  +              <dt>
  +                <a href="{name}.html">
  +                  <xsl:value-of select="name"/>
  +                </a>
  +              </dt>
  +              <dd>
  +                <xsl:apply-templates select="description"/>
  +              </dd>
   
   <xsl:text>
   </xsl:text> <!-- insert line break -->
   
  -              </xsl:if>
               </xsl:for-each>
             </dl>
           </div>
           <!-- /core section -->
   
  +<xsl:text>
  +</xsl:text> <!-- insert line break -->
  +
           <xsl:call-template name="toplink"/>
   
  +<xsl:text>
  +</xsl:text> <!-- insert line break -->
  +
           <div class="section">
             <h2>
               <a name="other" id="other">
  @@ -95,79 +80,179 @@
               </a>
             </h2>
               
  -          <dl>
  -            <xsl:for-each select="document(sitemap/category[@id='modules']/modulefilelist/modulefile)/modulesynopsis">
  -              <xsl:sort select="name"/>
  -                
  -              <xsl:if test="status!='MPM' and status!='Core' and status!='Obsolete'">
  -                <dt>
  -                  <a href="{name}.html">
  -                    <xsl:value-of select="name"/>
  -                  </a>
  -                </dt>
  -                <dd>
  -                  <xsl:apply-templates select="description"/>
  -                </dd>
  -
   <xsl:text>
   </xsl:text> <!-- insert line break -->
   
  -              </xsl:if>
  -            </xsl:for-each>
  -          </dl>
  -        </div>
  -        <!-- /modules section -->
  -
  -<!--
  -        <xsl:call-template name="toplink"/>
  -
  -        <div class="section">
  -          <h2>
  -            <a name="obsolete" id="obsolete">
  -              <xsl:value-of select="$messages/message[@name='obsoletemodules']"/>
  -            </a>
  -          </h2>
  -            
  -          <dl>
  -            <xsl:for-each select="document(sitemap/category[@id='modules']/modulefilelist/modulefile)/modulesynopsis">
  -              <xsl:sort select="name"/>
  -                
  -              <xsl:if test="status='Obsolete'">
  -                <dt>
  -                  <a href="obs_{name}.html">
  -                    <xsl:value-of select="name"/>
  -                  </a>
  -                </dt>
  -                <dd>
  -                  <xsl:if test="hint">
  -                    <em>
  -                      <xsl:text>(</xsl:text>
  -                      <xsl:apply-templates select="hint"/>
  -                      <xsl:text>)</xsl:text>
  -                    </em>
  -                    <br />
  -                  </xsl:if>
  +          <xsl:variable name="modules" select="document(sitemap/category[@id='modules']/modulefilelist/modulefile)/modulesynopsis[status!='MPM'
and status!='Core' and status!='Obsolete']"/>
   
  -                  <xsl:apply-templates select="description"/>
  -                </dd>
  +          <!-- collect the start letters -->
  +          <xsl:variable name="start-letters">
  +            <xsl:call-template name="module-startletters">
  +              <xsl:with-param name="modules" select="$modules"/>
  +            </xsl:call-template>
  +          </xsl:variable>
  +
  +          <!-- letter line -->
  +          <p class="letters">
  +            <xsl:call-template name="letter-bar">
  +              <xsl:with-param name="letters" select="$start-letters"/>
  +              <xsl:with-param name="first" select="true()"/>
  +            </xsl:call-template>
  +          </p>
  +          <!-- /letter line -->
   
   <xsl:text>
  -</xsl:text>
  +</xsl:text> <!-- insert line break -->
   
  -              </xsl:if>
  -            </xsl:for-each>
  +          <dl>
  +            <xsl:call-template name="mindex-of-letter">
  +              <xsl:with-param name="letters-todo" select="$start-letters"/>
  +              <xsl:with-param name="modules" select="$modules"/>
  +            </xsl:call-template>
             </dl>
           </div>
  --->
  -        <!-- /obsolete section -->
  +        <!-- /modules section -->
   
  -<!--        </div> <!- /page-content -->
  +<xsl:text>
  +</xsl:text> <!-- insert line break -->
   
           <xsl:call-template name="bottom"/>
   
  +<xsl:text>
  +</xsl:text> <!-- insert line break -->
  +
         </body>
       </html>
     </xsl:template> 
     <!-- /moduleindex -->
   
  -</xsl:stylesheet>
  +
  +  <!--                                                     -->
  +  <!-- the working horse. builds list items of all         -->
  +  <!-- modules starting with one letter                    -->
  +  <!-- when done, it calls itself to catch the next letter -->
  +  <!--                                                     -->
  +  <xsl:template name="mindex-of-letter">
  +  <xsl:param name="letters-todo"/>
  +  <xsl:param name="modules"/>
  +
  +    <xsl:variable name="letter" select="substring($letters-todo,1,1)"/>
  +    <xsl:variable name="translist">
  +      <xsl:call-template name="module-trans">
  +        <xsl:with-param name="modules" select="$modules"/>
  +      </xsl:call-template>
  +    </xsl:variable>
  +
  +    <xsl:for-each select="$modules[$letter=substring(substring-before(substring-after($translist,
concat('- ', translate(normalize-space(name),$lowercase,$uppercase), ' ')), ' -'), 1, 1)]">
  +    <xsl:sort select="substring-before(substring-after($translist, concat('- ', translate(normalize-space(name),$lowercase,$uppercase),
' ')), ' -')"/>
  +
  +      <dt>
  +        <a href="{name}.html">
  +          <xsl:if test="position()=1">
  +            <xsl:attribute name="id"><xsl:value-of select="$letter"/></xsl:attribute>
  +            <xsl:attribute name="name"><xsl:value-of select="$letter"/></xsl:attribute>
  +          </xsl:if>
  +
  +          <xsl:value-of select="name"/>
  +        </a>
  +      </dt>
  +      <dd>
  +        <xsl:apply-templates select="description"/>
  +      </dd>
  +
  +<xsl:text>
  +</xsl:text> <!-- insert a line break -->
  +
  +    </xsl:for-each> <!-- /directives -->
  +
  +    <!-- call next letter, if there is -->
  +    <xsl:if test="string-length($letters-todo) &gt; 1">
  +      <xsl:call-template name="mindex-of-letter">
  +        <xsl:with-param name="letters-todo" select="substring($letters-todo,2)"/>
  +        <xsl:with-param name="modules" select="$modules"/>
  +      </xsl:call-template>
  +    </xsl:if>
  +
  +  </xsl:template>
  +  <!-- /mindex-of-letter -->
  +
  +
  +  <!--                                                    -->
  +  <!-- collect start letters of modules                   -->
  +  <!--                                                    -->
  +  <xsl:template name="module-startletters">
  +  <xsl:param name="modules"/>
  +
  +    <xsl:variable name="translist">
  +      <xsl:call-template name="module-trans">
  +        <xsl:with-param name="modules" select="$modules"/>
  +      </xsl:call-template>
  +    </xsl:variable>
  +
  +    <xsl:call-template name="_squeeze-letters">
  +      <xsl:with-param name="lastletter" select="''"/>
  +
  +      <xsl:with-param name="letters">
  +        <xsl:for-each select="$modules">
  +        <xsl:sort select="substring-before(substring-after($translist, concat('- ',
translate(normalize-space(name),$lowercase,$uppercase), ' ')), ' -')"/>
  +          <xsl:value-of select="substring(substring-before(substring-after($translist,
concat('- ', translate(normalize-space(name),$lowercase,$uppercase), ' ')), ' -'), 1, 1)"/>
  +        </xsl:for-each>
  +      </xsl:with-param>
  +    </xsl:call-template>
  +
  +  </xsl:template>
  +  <!-- /module-startletters -->
  +  
  +
  +  <!--                                                     -->
  +  <!-- define module name translations for sorting         -->
  +  <!--                                                     -->
  +  <!-- it's a kind of a hack...                            -->
  +  <!-- we build a string that contains the following data: -->
  +  <!-- "- modulename sortname - modulename sortname - ..." -->
  +  <!-- (with all data in uppercase)                        -->
  +  <!--                                                     -->
  +  <!-- So, the translation from modulename to sortname     -->
  +  <!-- can be done with the expression below:              -->
  +  <!--
  +       substring-before(
  +           substring-after($translist, 
  +                           concat('- ',
  +                                  translate(modulename,
  +                                            $lowercase,
  +                                            $uppercase),
  +                                  ' ')
  +                           ),
  +           ' -')
  +                                                           -->
  +  <!--                                                     -->
  +  <xsl:template name="module-trans">
  +  <xsl:param name="modules"/>
  +
  +    <xsl:text>-</xsl:text>
  +    <xsl:for-each select="$modules">
  +      <xsl:variable name="sname" select="translate(normalize-space(name),$lowercase,$uppercase)"/>
  +
  +      <xsl:text> </xsl:text>
  +      <xsl:value-of select="$sname"/>
  +      <xsl:text> </xsl:text>
  +
  +      <xsl:choose>
  +        <xsl:when test="starts-with($sname,'MOD_') or starts-with($sname,'MPM_')">
  +          <xsl:value-of select="substring($sname, 5)"/>
  +        </xsl:when>
  +        <xsl:when test="starts-with($sname,'MPMT_')">
  +          <xsl:value-of select="substring($sname, 6)"/>
  +        </xsl:when>
  +        <xsl:otherwise>
  +          <xsl:value-of select="$sname"/>
  +        </xsl:otherwise>
  +      </xsl:choose>
  +
  +      <xsl:text> -</xsl:text>
  +    </xsl:for-each>
  +
  +  </xsl:template>
  +  <!-- /module-trans -->
  +
  +  </xsl:stylesheet>
  
  
  

Mime
View raw message