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 / F278604_faq.xsl < prev    next >
Extensible Markup Language  |  2004-05-02  |  8KB  |  199 lines

  1. <?xml version="1.0"?>
  2.  
  3. <!--
  4.  Copyright 2003-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. <!-- <faq>                                                                -->
  28. <!-- Process an entire document into an HTML page                         -->
  29. <!-- ==================================================================== -->
  30. <xsl:template match="faq">
  31. <html xml:lang="{$doclang}" lang="{$doclang}">
  32.     <xsl:call-template name="head"/>&lf;
  33.  
  34.     <body id="manual-page">
  35.         <!-- unsqueeze if there's no sidebar -->
  36.         <xsl:if test="   not(count(section) > 1
  37.                       or (/faq/@all-in-one = 'yes')
  38.                       or seealso)">
  39.             <xsl:attribute name="class">no-sidebar</xsl:attribute>
  40.         </xsl:if>
  41.  
  42.         <xsl:call-template name="top" />          
  43.  
  44.         <div id="page-content">
  45.             <div id="preamble">        
  46.                 <h1>
  47.                     <xsl:value-of select="title" />
  48.                 </h1>&lf;
  49.  
  50.                 <xsl:call-template name="langavail" />&lf;
  51.  
  52.                 <xsl:apply-templates select="summary"/>
  53.             </div>&lf; <!-- /#preamble -->
  54.  
  55.             <xsl:if
  56.                 test="(    not($is-chm)
  57.                        and (count(section) > 1 or (/faq/@all-in-one = 'yes')))
  58.                       or seealso">
  59.                 <div id="quickview">
  60.                     <xsl:if test="not($is-chm)">
  61.                         <xsl:if test="count(section) > 1">
  62.                             <ul id="toc">
  63.                                 <xsl:apply-templates
  64.                                     select="section" mode="index" />
  65.                             </ul>
  66.                         </xsl:if>
  67.  
  68.                         <xsl:if test="/faq/@all-in-one = 'yes'">
  69.                             <ul id="toc">
  70.                             <li>
  71.                                 <img src="{$path}/images/down.gif" alt="" />
  72.                                 <xsl:text> </xsl:text>
  73.                                 <a href="#topics">
  74.                                     <xsl:value-of select="$message
  75.                                                           [@id='topics']" />
  76.                                 </a>
  77.                             </li>&lf;
  78.  
  79.                             <xsl:apply-templates
  80.                                 select="categories/categoryfile" mode="toc" />
  81.                             </ul>
  82.                         </xsl:if>
  83.                     </xsl:if> <!-- !$is-chm -->
  84.  
  85.                     <xsl:if test="seealso">
  86.                         <h3>
  87.                             <xsl:value-of
  88.                                 select="$message[@id='seealso']" />
  89.                         </h3>
  90.  
  91.                         <ul class="seealso">
  92.                         <xsl:for-each select="seealso">
  93.                             <li>
  94.                                 <xsl:apply-templates />
  95.                             </li>
  96.                         </xsl:for-each>
  97.                         </ul>
  98.                     </xsl:if>
  99.                 </div>&lf; <!-- /#quickview -->
  100.             </xsl:if> <!-- /have sidebar -->
  101.  
  102.             <!-- either one ... -->
  103.             <xsl:apply-templates select="section" />
  104.             <!-- ... or the other is allowed -->
  105.             <xsl:apply-templates select="categories" />
  106.         </div>&lf; <!-- /#page-content -->
  107.  
  108.         <xsl:call-template name="bottom" />&lf;
  109.     </body>
  110. </html>
  111. </xsl:template>
  112. <!-- /faq -->
  113.  
  114. <!-- ==================================================================== -->
  115. <!-- <categories> (see categories.xml)                                    -->
  116. <!-- ==================================================================== -->
  117. <xsl:template match="categories">
  118. <xsl:call-template name="toplink" />&lf;
  119.  
  120. <div class="section">&lf;
  121.  
  122.     <!-- Section heading -->
  123.     <h2>
  124.         <a name="topics" id="topics">
  125.             <xsl:value-of select="$message[@id='topics']" />
  126.         </a>
  127.     </h2>&lf;
  128.  
  129.     <dl>
  130.         <xsl:apply-templates select="categoryfile" mode="index"/>
  131.     </dl>
  132. </div> <!-- /.section -->
  133.  
  134. <xsl:if test="/faq/@all-in-one = 'yes'">
  135.     <xsl:apply-templates select="categoryfile" mode="suckin" />
  136. </xsl:if>
  137. </xsl:template>
  138. <!-- /categories -->
  139.  
  140. <!-- ==================================================================== -->
  141. <!-- <categoryfile> mode="index"                                          -->
  142. <!-- just write the short description with a link to the resource         -->
  143. <!-- ==================================================================== -->
  144. <xsl:template match="categories/categoryfile" mode="index">
  145. <xsl:variable name="current" select="document(.)/faq" />
  146.  
  147. <dt>
  148.     <a>
  149.         <xsl:attribute name="href">
  150.             <xsl:choose>
  151.             <xsl:when test="/faq/@all-in-one = 'yes'">
  152.                 <xsl:value-of select="concat('#', $current/section/@id)" />
  153.             </xsl:when>
  154.             <xsl:otherwise>
  155.                 <xsl:value-of select="concat(document($current/@metafile)
  156.                                              /metafile/basename, '.html')" />
  157.             </xsl:otherwise>
  158.             </xsl:choose>
  159.         </xsl:attribute>
  160.  
  161.         <xsl:value-of select="$current/section/title" />
  162.     </a>
  163. </dt>
  164. <dd>
  165.     <xsl:apply-templates select="$current/description" />
  166. </dd>&lf;
  167. </xsl:template>
  168. <!-- /categoryfile, "index" -->
  169.  
  170.  
  171. <!-- ==================================================================== -->
  172. <!-- <categoryfile> mode="toc"                                            -->
  173. <!-- create sidebar links                                                 -->
  174. <!-- ==================================================================== -->
  175. <xsl:template match="categories/categoryfile" mode="toc">
  176. <xsl:variable name="current" select="document(.)/faq" />
  177.  
  178. <li>
  179.     <img src="{$path}/images/down.gif" alt="" />
  180.     <xsl:text> </xsl:text>
  181.     <a href="#{$current/section/@id}">
  182.         <xsl:value-of select="$current/section/title" />
  183.     </a>
  184. </li>&lf;
  185. </xsl:template>
  186. <!-- /categoryfile, "toc" -->
  187.  
  188.  
  189. <!-- ==================================================================== -->
  190. <!-- <categoryfile> mode="suckin"                                         -->
  191. <!-- load whole file contents (for all-in-one page)                       -->
  192. <!-- ==================================================================== -->
  193. <xsl:template match="categories/categoryfile" mode="suckin">
  194. <xsl:apply-templates select="document(.)/faq/section" />
  195. </xsl:template>
  196. <!-- /categoryfile, "suckin" -->
  197.  
  198. </xsl:stylesheet>
  199.