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 / F252947_hhc.xsl < prev    next >
Extensible Markup Language  |  2003-05-02  |  28KB  |  703 lines

  1. <?xml version="1.0"?><!--
  2. /* ====================================================================
  3.  * The Apache Software License, Version 1.1
  4.  *
  5.  * Copyright (c) 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 "../xsl/util/lf.xml">
  57.     <!ENTITY tab SYSTEM "../xsl/util/tab.xml">
  58.  
  59.     <!ENTITY ul.start SYSTEM "../xsl/util/ul-start.xml">
  60.     <!ENTITY ul.end SYSTEM   "../xsl/util/ul-end.xml"  >
  61.     <!ENTITY li.start SYSTEM "../xsl/util/li-start.xml">
  62.     <!ENTITY li.end SYSTEM   "../xsl/util/li-end.xml"  >
  63. ]>
  64. <xsl:stylesheet version="1.0"
  65.               xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  66.                   xmlns="">
  67.  
  68. <!--                                                                      -->
  69. <!-- WARNING! Do not touch anything, especially the whitespaces [1]       -->
  70. <!-- unless you know, what you're doing. The HTML help compiler parses    -->
  71. <!-- the TOC file not really as html instead of line by line and takes    -->
  72. <!-- care of whitespace indentations etc.                                 -->
  73. <!--                                                                      -->
  74. <!--   [1] Covered by the &lf; and &tab; entities.                        -->
  75. <!--                                                                      -->
  76. <!-- You have been warned.                                                -->
  77. <!--                                                                      -->
  78.  
  79. <!-- create nodeset for referencing later                                 -->
  80. <xsl:variable name="not-exists" select="document('')/xsl:stylesheet/xsl:template
  81.                                         [@name='data']/not-exists/file" />
  82.  
  83. <xsl:template name="data">
  84. <!-- documents not converted (yet?). -->
  85. <not-exists>
  86. <!--  example: <file>developer/API.xml</file> -->
  87. </not-exists>
  88. </xsl:template>
  89.  
  90. <!-- Constants used for case translation -->
  91. <xsl:variable name="lowercase" select="'abcdefghijklmnopqrstuvwxyz'" />
  92. <xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
  93.  
  94. <!-- document() works relative to the xsl (!) file -->
  95. <xsl:variable name="basedir" select="'../../'"/>
  96.  
  97. <!-- icons -->
  98. <xsl:variable name="icon.document" select="'11'" />
  99. <xsl:variable name="icon.document.not-translated" select="'12'" />
  100. <xsl:variable name="icon.section" select="'35'" />
  101. <xsl:variable name="icon.directive" select="'41'" />
  102. <xsl:variable name="icon.commondirective" select="'19'" />
  103. <!-- this should not happen. this icon is only displayed within the
  104.      toc view of the help workshop (it's a question mark): -->
  105. <xsl:variable name="icon.no-anchor" select="'9'" />
  106.  
  107. <!-- for module-translatename -->
  108. <xsl:include href="../xsl/util/modtrans.xsl"/>
  109.  
  110. <!-- ==================================================================== -->
  111. <!-- <sitemap>                                                            -->
  112. <!-- Create CHM contents file (toc) from sitemap                          -->
  113. <!-- The file is an html style text file (see warning on top)             -->
  114. <!-- ==================================================================== -->
  115. <xsl:template match="/sitemap">
  116.  
  117. <!-- html head -->
  118. <xsl:text><html><head></xsl:text>
  119. <xsl:text><title>Apache HTTP Server Documentation</title></xsl:text>
  120. <xsl:text></head></xsl:text>&lf;
  121.  
  122. <xsl:text><body></xsl:text>&lf;
  123.  
  124. <!-- toc properties first -->
  125. <xsl:text><object type="text/site properties"></xsl:text>&lf;&tab;
  126. <!-- XXX: that magic value is still obfuscated. Research needed ... -->
  127. <xsl:text><param name="Window Styles" value="0x800027"></xsl:text>&lf;&tab;
  128. <xsl:text><param name="Font" value="</xsl:text>
  129.     <xsl:value-of select="$toc-font" />
  130. <xsl:text>"></xsl:text>&lf;
  131. <xsl:text></object></xsl:text>&lf;
  132.  
  133. &ul.start; &lf;
  134.  
  135.     <!-- index page on top. -->
  136.     &li.start;
  137.     <xsl:call-template name="object">
  138.         <xsl:with-param name="name"
  139.             select="$messages/message[@name='apachehttpserver']" />
  140.         <xsl:with-param name="href" select="'index.html'" />
  141.         <xsl:with-param name="indent" select="' '" />
  142.     </xsl:call-template>
  143.     &li.end; &lf;
  144.  
  145.     <!-- iterate over the categories in document order -->
  146.     <xsl:for-each select="category">
  147.         &li.start;
  148.         <xsl:call-template name="folder">
  149.             <xsl:with-param name="name" select="normalize-space(title)" />
  150.         </xsl:call-template>&lf;&tab;
  151.  
  152.         &ul.start; &lf;&tab;
  153.             <xsl:apply-templates select="page" />
  154.             <xsl:apply-templates select="modulefilelist" />
  155.         &ul.end; &lf;
  156.         &li.end; &lf;&tab;
  157.     </xsl:for-each>&lf;
  158.  
  159. &ul.end; &lf;
  160.  
  161. <xsl:text></body></html></xsl:text>&lf;
  162. </xsl:template>
  163. <!-- /sitemap -->
  164.  
  165.  
  166. <!-- ==================================================================== -->
  167. <!-- category/page                                                        -->
  168. <!-- ==================================================================== -->
  169. <xsl:template match="category/page">
  170. &li.start;
  171.  
  172. <!-- document entry, if not href attribute, assume it means "sitemap" -->
  173. <xsl:call-template name="object">
  174.     <xsl:with-param name="name">
  175.         <xsl:choose>
  176.         <xsl:when test="@href">
  177.             <xsl:value-of select="normalize-space(.)" />
  178.         </xsl:when>
  179.         <xsl:otherwise>
  180.             <xsl:value-of select="normalize-space($messages/message
  181.                                                   [@name='sitemap'])" />
  182.         </xsl:otherwise>
  183.         </xsl:choose>
  184.     </xsl:with-param>
  185.     <xsl:with-param name="href">
  186.         <xsl:choose>
  187.         <xsl:when test="not(@href)">
  188.             <xsl:text>sitemap.html</xsl:text>
  189.         </xsl:when>
  190.         <xsl:when test="contains(@href, '#')">
  191.             <xsl:value-of select="substring-before(@href, '#')" />
  192.         </xsl:when>
  193.         <xsl:otherwise>
  194.             <xsl:value-of select="@href"/>
  195.         </xsl:otherwise>
  196.         </xsl:choose>
  197.     </xsl:with-param>
  198.     <xsl:with-param name="indent" select="' '" />
  199. </xsl:call-template>
  200.  
  201. <!-- now try to index the sections of the document -->
  202. <xsl:apply-templates select="self::page" mode="index" />
  203.  
  204. &li.end; &lf;&tab;
  205. </xsl:template>
  206. <!-- /category/page -->
  207.  
  208.  
  209. <!-- ==================================================================== -->
  210. <!-- category/page, mode="index"                                          -->
  211. <!-- display all section headings of one page                             -->
  212. <!-- ==================================================================== -->
  213. <xsl:template match="category/page" mode="index">
  214. <xsl:variable name="href.offline">
  215.     <xsl:choose>
  216.     <xsl:when test="string-length(@href) = 0">
  217.         <xsl:text>sitemap.html</xsl:text>
  218.     </xsl:when>
  219.     <xsl:otherwise>
  220.         <xsl:call-template name="helper.href.offline">
  221.             <xsl:with-param name="href" select="@href" />
  222.         </xsl:call-template>
  223.     </xsl:otherwise>
  224.     </xsl:choose>
  225. </xsl:variable>
  226. <xsl:variable name="xml"
  227.     select="concat(substring-before($href.offline, '.html'), '.xml')" />
  228.  
  229. <xsl:if test="not($xml = $not-exists)">
  230.     <xsl:variable name="xmlfile">
  231.         <xsl:variable name="metafile"
  232.             select="document(document(concat($basedir, $xml))/*/@metafile)
  233.                     /metafile" />
  234.         <xsl:choose>
  235.         <xsl:when test="$metafile/variants/variant[.=$messages/@lang] and not
  236.                         ($metafile/variants/variant[.=$messages/@lang]
  237.                          /@htmlonly = 'yes')">
  238.                 <xsl:value-of select="concat($basedir,
  239.                                    substring-before($xml, '.xml'), $xml-ext)" />
  240.         </xsl:when>
  241.         <xsl:otherwise>
  242.             <xsl:value-of select="concat($basedir, $xml)" />
  243.         </xsl:otherwise>
  244.         </xsl:choose>
  245.     </xsl:variable>
  246.  
  247.     <xsl:variable name="current" select="document($xmlfile)" />
  248.  
  249.     <xsl:if test="count($current/*/*[local-name()='section' or
  250.                                      local-name()='category']) > 1">
  251.         &lf;&tab;&tab;&tab;
  252.         &ul.start; &lf;&tab;&tab;&tab;
  253.  
  254.         <xsl:for-each select="$current/*/*[local-name()='section' or
  255.                                            local-name()='category']">
  256.             &li.start;
  257.  
  258.             <xsl:call-template name="object">
  259.                 <xsl:with-param name="name" select="normalize-space(title)" />
  260.                 <xsl:with-param name="href">
  261.                     <xsl:if test="@id">
  262.                         <xsl:value-of
  263.                             select="concat(substring-before($xml, '.xml'),
  264.                                            '.html#', @id)" />
  265.                     </xsl:if>
  266.                 </xsl:with-param>
  267.                 <xsl:with-param name="indent" select="' '" />
  268.             </xsl:call-template>
  269.  
  270.             &li.end; &lf;&tab;&tab;
  271.         </xsl:for-each>
  272.  
  273.         &ul.end; &lf;&tab;
  274.     </xsl:if> <!-- count() > 1 -->
  275. </xsl:if> <!-- xml exists -->
  276. </xsl:template>
  277. <!-- /category/page, "index" -->
  278.  
  279.  
  280. <!-- ==================================================================== -->
  281. <!-- category/modulefilelist                                              -->
  282. <!-- process all listed module files                                      -->
  283. <!-- ==================================================================== -->
  284. <xsl:template match="category/modulefilelist">
  285. <!-- create a module name translation list for sorting -->
  286. <xsl:variable name="translist">
  287.     <xsl:text>-</xsl:text>
  288.  
  289.     <xsl:for-each select="modulefile">
  290.         <xsl:variable name="current"
  291.             select="document(concat($basedir,'mod/',.))/modulesynopsis" />
  292.    
  293.         <xsl:text> </xsl:text>
  294.         <xsl:value-of select="$current/name"/>
  295.         <xsl:text> </xsl:text>
  296.         <xsl:call-template name="module-translatename">
  297.             <xsl:with-param name="name" select="$current/name"/>
  298.         </xsl:call-template>
  299.         <xsl:text> -</xsl:text>
  300.     </xsl:for-each>
  301. </xsl:variable>
  302.  
  303. <!-- put core and mpm_common on top -->
  304. <xsl:call-template name="toc-entry.mpm">
  305.     <xsl:with-param name="current"
  306.         select="document(concat($basedir, 'mod/', modulefile[starts-with(.,
  307.                          'core.xml')]/text()))/modulesynopsis" />
  308.     <xsl:with-param name="name" select="'core'" />
  309. </xsl:call-template>
  310.  
  311. <xsl:call-template name="toc-entry.mpm">
  312.     <xsl:with-param name="current"
  313.         select="document(concat($basedir, 'mod/', modulefile[starts-with(.,
  314.                          'mpm_common.xml')]/text()))/modulesynopsis" />
  315.     <xsl:with-param name="name" select="'common'" />
  316. </xsl:call-template>
  317.  
  318. <!-- remaining MPMs -->
  319. <xsl:for-each select="modulefile">
  320. <xsl:sort select="substring-before(substring-after($translist, concat('- ',
  321.     document(concat($basedir, 'mod/', .))/modulesynopsis/name, ' ')), ' -')" />
  322.  
  323.     <xsl:variable name="current"
  324.         select="document(concat($basedir, 'mod/', .))/modulesynopsis" />
  325.  
  326.     <xsl:if test="$current/status='MPM' and not($current/name='mpm_common')">
  327.         <xsl:call-template name="toc-entry.mpm">
  328.             <xsl:with-param name="current" select="$current" />
  329.             <xsl:with-param name="name" select="substring-before(
  330.                 substring-after($translist, concat('- ', $current/name, ' ')),
  331.                 ' -')" />
  332.         </xsl:call-template>
  333.     </xsl:if>
  334. </xsl:for-each>
  335.  
  336. <!-- normal modules -->
  337. <xsl:for-each select="modulefile">
  338. <xsl:sort select="substring-before(substring-after($translist, concat('- ',
  339.     document(concat($basedir, 'mod/', .))/modulesynopsis/name, ' ')), ' -')" />
  340.  
  341.     <xsl:variable name="current"
  342.         select="document(concat($basedir, 'mod/', .))/modulesynopsis" />
  343.  
  344.     <xsl:if test="not($current/status='MPM') and not($current/status='Core')">
  345.         <xsl:call-template name="toc-entry.module">
  346.             <xsl:with-param name="current" select="$current"/>
  347.         </xsl:call-template>
  348.     </xsl:if>
  349. </xsl:for-each>
  350. </xsl:template>
  351. <!-- /category/modulefilelist -->
  352.  
  353.  
  354. <!-- ==================================================================== -->
  355. <!-- toc-entry.mpm                                                        -->
  356. <!-- create entry (and initiate subsection entries) of an mpm             -->
  357. <!-- ==================================================================== -->
  358. <xsl:template name="toc-entry.mpm">
  359. <xsl:param name="current" />
  360. <xsl:param name="name" />
  361.  
  362. &li.start;
  363.  
  364. <xsl:call-template name="object">
  365.     <xsl:with-param name="name">
  366.         <xsl:choose>
  367.         <xsl:when test="$name='core'">
  368.             <xsl:value-of select="$messages/message[@name='apachecore']" />
  369.         </xsl:when>
  370.         <xsl:when test="$name='common'">
  371.             <xsl:value-of select="$messages/message[@name='apachempmcommon']" />
  372.         </xsl:when>
  373.         <xsl:otherwise>
  374.             <xsl:value-of select="$messages/message[@name='apachempm']" />
  375.             <xsl:text> </xsl:text>
  376.             <xsl:value-of select="$name" />
  377.         </xsl:otherwise>
  378.         </xsl:choose>
  379.     </xsl:with-param>
  380.     <xsl:with-param name="href"
  381.         select="concat('mod/', $current/name, '.html')" />
  382.     <xsl:with-param name="indent" select="' '" />
  383. </xsl:call-template>
  384.     
  385. <xsl:call-template name="sections-and-directives">
  386.     <xsl:with-param name="current" select="$current" />
  387. </xsl:call-template>
  388.  
  389. &li.end; &lf;&tab;
  390. </xsl:template>
  391. <!-- /toc-entry.mpm -->
  392.   
  393.  
  394. <!-- ==================================================================== -->
  395. <!-- toc-entry.module                                                     -->
  396. <!-- create entry (and initiate subsection entries) of a module           -->
  397. <!-- ==================================================================== -->
  398. <xsl:template name="toc-entry.module">
  399. <xsl:param name="current"/>
  400.  
  401. &li.start;
  402.  
  403. <xsl:call-template name="object">
  404.     <xsl:with-param name="name">
  405.         <xsl:value-of select="$messages/message[@name='apachemodule']" />
  406.         <xsl:text> </xsl:text>
  407.         <xsl:value-of select="$current/name" />
  408.     </xsl:with-param>
  409.     <xsl:with-param name="href"
  410.         select="concat('mod/', $current/name, '.html')" />
  411.     <xsl:with-param name="indent" select="' '" />
  412. </xsl:call-template>
  413.     
  414. <xsl:call-template name="sections-and-directives">
  415.     <xsl:with-param name="current" select="$current" />
  416. </xsl:call-template>
  417.  
  418. &li.end; &lf;&tab;
  419. </xsl:template>
  420. <!-- /toc-entry.module -->
  421.  
  422.  
  423. <!-- ==================================================================== -->
  424. <!-- sections-and-directives                                              -->
  425. <!-- process sections and directives of a module file                     -->
  426. <!-- ==================================================================== -->
  427. <xsl:template name="sections-and-directives">
  428. <xsl:param name="current" />
  429.  
  430. <xsl:if test="count($current/section) > 0 or
  431.               count($current/directivesynopsis) > 0">
  432.     &lf;&tab;&tab;
  433.  
  434.     &ul.start; &lf;&tab;&tab;
  435.  
  436.     <!-- sections -->
  437.     <xsl:for-each select="$current/section">
  438.         &li.start;
  439.  
  440.         <xsl:call-template name="object">
  441.             <xsl:with-param name="name" select="normalize-space(title)" />
  442.             <xsl:with-param name="href">
  443.                 <xsl:if test="@id">
  444.                     <xsl:value-of
  445.                         select="concat('mod/', $current/name, '.html#', @id)" />
  446.                 </xsl:if>
  447.             </xsl:with-param>
  448.             <xsl:with-param name="indent" select="' '" />
  449.         </xsl:call-template>
  450.  
  451.         &li.end; &lf;&tab;&tab;
  452.     </xsl:for-each>
  453.  
  454.     <!-- directives within the current document -->
  455.     <xsl:for-each select="$current/directivesynopsis[not(@location)]">
  456.     <xsl:sort select="name" />
  457.         &li.start;
  458.  
  459.         <xsl:call-template name="object">
  460.             <xsl:with-param name="name">
  461.                 <xsl:if test="@type='section'"><</xsl:if>
  462.                 <xsl:value-of select="name"/>
  463.                 <xsl:if test="@type='section'">></xsl:if>
  464.                 <xsl:choose>
  465.                 <xsl:when test="$messages/message[@name='directive']
  466.                                 /@replace-space-with">
  467.                     <xsl:value-of select="$messages/message[@name='directive']
  468.                                           /@replace-space-with" />
  469.                 </xsl:when>
  470.                 <xsl:otherwise>
  471.                     <xsl:text> </xsl:text>
  472.                 </xsl:otherwise>
  473.                 </xsl:choose>
  474.                 <xsl:value-of select="$messages/message[@name='directive']" />
  475.             </xsl:with-param>
  476.             <xsl:with-param name="href"
  477.                 select="concat('mod/', $current/name, '.html#',
  478.                                translate(name, $uppercase, $lowercase))" />
  479.             <xsl:with-param name="indent" select="' '" />
  480.             <xsl:with-param name="icon" select="$icon.directive" />
  481.         </xsl:call-template>
  482.  
  483.         &li.end; &lf;&tab;&tab;
  484.     </xsl:for-each>
  485.  
  486.     <!-- directives described elsewhere -->
  487.     <xsl:for-each select="$current/directivesynopsis[@location]">
  488.     <xsl:sort select="name" />
  489.         &li.start;
  490.  
  491.         <xsl:call-template name="object">
  492.             <xsl:with-param name="name">
  493.                 <xsl:if test="@type='section'"><</xsl:if>
  494.                 <xsl:value-of select="name"/>
  495.                 <xsl:if test="@type='section'">></xsl:if>
  496.                 <xsl:choose>
  497.                 <xsl:when test="$messages/message[@name='directive']
  498.                                 /@replace-space-with">
  499.                     <xsl:value-of select="$messages/message[@name='directive']
  500.                                           /@replace-space-with" />
  501.                 </xsl:when>
  502.                 <xsl:otherwise>
  503.                     <xsl:text> </xsl:text>
  504.                 </xsl:otherwise>
  505.                 </xsl:choose>
  506.                 <xsl:value-of select="$messages/message[@name='directive']" />
  507.             </xsl:with-param>
  508.             <xsl:with-param name="href"
  509.                 select="concat('mod/', @location, '.html#',
  510.                                translate(name, $uppercase, $lowercase))" />
  511.             <xsl:with-param name="indent" select="' '" />
  512.             <xsl:with-param name="icon" select="$icon.commondirective" />
  513.         </xsl:call-template>
  514.  
  515.         &li.end; &lf;&tab;&tab;
  516.     </xsl:for-each>
  517.  
  518.     &ul.end; &lf;&tab;
  519. </xsl:if> <!-- sections or directives present -->
  520. </xsl:template>
  521. <!-- /sections-and-directives -->
  522.  
  523.  
  524. <!-- ==================================================================== -->
  525. <!-- object                                                               -->
  526. <!-- display an <object> and do some magic to select the right content    -->
  527. <!-- ==================================================================== -->
  528. <xsl:template name="object">
  529. <xsl:param name="name" select="'? unknown ?'" />
  530. <xsl:param name="href" />
  531. <xsl:param name="icon" select="$icon.section" />
  532. <xsl:param name="indent" />
  533.  
  534. <xsl:variable name="href.offline">
  535.     <xsl:call-template name="helper.href.offline">
  536.         <xsl:with-param name="href" select="$href" />
  537.     </xsl:call-template>
  538. </xsl:variable>
  539.  
  540. <!-- xml file is expected to have the same basename -->
  541. <xsl:variable name="xml"
  542.     select="concat(substring-before($href.offline, '.html'), '.xml')" />
  543.  
  544. <xsl:text><object type="text/sitemap"></xsl:text>&lf;
  545. <xsl:value-of select="$indent" />
  546.  
  547. <xsl:text><param name="Name" value="</xsl:text>
  548.     <xsl:call-template name="filter.attval">
  549.         <xsl:with-param name="text" select="$name" />
  550.     </xsl:call-template>
  551. <xsl:text>"></xsl:text>&lf;
  552. <xsl:value-of select="$indent" />
  553.  
  554. <xsl:if test="string-length($href.offline) > 0">
  555.     <xsl:text><param name="Local" value="</xsl:text>
  556.         <xsl:call-template name="filter.attval">
  557.             <xsl:with-param name="text" select="$href.offline" />
  558.         </xsl:call-template>
  559.     <xsl:text>"></xsl:text>&lf;
  560.     <xsl:value-of select="$indent" />
  561. </xsl:if>
  562.  
  563. <xsl:text><param name="ImageNumber" value="</xsl:text>
  564.     <xsl:choose>
  565.     <xsl:when test="string-length($href.offline) > 0">
  566.         <xsl:choose>
  567.         <xsl:when test="contains($href, '#')">
  568.             <xsl:value-of select="$icon" />
  569.         </xsl:when>
  570.         <xsl:when test="$messages/@lang='en' or
  571.                         (not($xml = $not-exists) and
  572.                          (document(document(concat($basedir, $xml))
  573.                                    /*/@metafile)
  574.                           /metafile/variants/variant
  575.                           [.=$messages/@lang and not(@htmlonly='yes')]))">
  576.             <xsl:value-of select="$icon.document" />
  577.         </xsl:when>
  578.         <xsl:otherwise>
  579.             <xsl:value-of select="$icon.document.not-translated" />
  580.         </xsl:otherwise>
  581.         </xsl:choose>
  582.     </xsl:when>
  583.     <xsl:otherwise>
  584.         <xsl:value-of select="$icon.no-anchor" />
  585.     </xsl:otherwise>
  586.     </xsl:choose>
  587. <xsl:text>"></xsl:text>&lf;
  588. <xsl:value-of select="substring($indent, 2)" />
  589.  
  590. <xsl:text></object></xsl:text>
  591. </xsl:template>
  592. <!-- /object -->
  593.  
  594.  
  595. <!-- ==================================================================== -->
  596. <!-- folder                                                               -->
  597. <!-- ==================================================================== -->
  598. <xsl:template name="folder">
  599. <xsl:param name="name" select="'? unknown ?'" />
  600.  
  601. <xsl:text><object type="text/sitemap"></xsl:text>&lf;&tab;&tab;
  602. <xsl:text><param name="Name" value="</xsl:text>
  603.     <xsl:call-template name="filter.attval">
  604.         <xsl:with-param name="text" select="$name" />
  605.     </xsl:call-template>
  606. <xsl:text>"></xsl:text>&lf;&tab;
  607. <xsl:text></object></xsl:text>
  608. </xsl:template>
  609. <!-- /folder -->
  610.  
  611.  
  612. <!-- ==================================================================== -->
  613. <!-- helper.href.offline                                                  -->
  614. <!-- change uri reference to work offline (/ -> /index.html)              -->
  615. <!-- ==================================================================== -->
  616. <xsl:template name="helper.href.offline">
  617. <xsl:param name="href" />
  618.  
  619. <xsl:choose>
  620. <xsl:when test="string-length($href) = 0" />
  621. <xsl:when test="contains($href, '#') and '/' = substring($href,
  622.                                string-length(substring-before($href, '#')), 1)">
  623.     <xsl:value-of select="substring-before($href, '#')" />
  624.     <xsl:text>index.html#</xsl:text>
  625.     <xsl:value-of select="substring-after($href, '#')" />
  626. </xsl:when>
  627. <xsl:when test="substring($href, string-length($href), 1) = '/'">
  628.     <xsl:value-of select="$href" />
  629.     <xsl:text>index.html</xsl:text>
  630. </xsl:when>
  631. <xsl:otherwise>
  632.     <xsl:value-of select="$href" />
  633. </xsl:otherwise>
  634. </xsl:choose>
  635. </xsl:template>
  636. <!-- /helper.href.offline -->
  637.  
  638.  
  639. <!-- ==================================================================== -->
  640. <!-- filter.attval                                                        -->
  641. <!-- escape special characters for being valid within an attribute        -->
  642. <!-- ==================================================================== -->
  643. <xsl:template name="filter.attval">
  644. <xsl:param name="text" />
  645.  
  646. <xsl:choose>
  647. <xsl:when test="contains($text, '&')">
  648.     <xsl:call-template name="filter.attval.special">
  649.         <xsl:with-param name="text" select="substring-before($text, '&')" />
  650.     </xsl:call-template>
  651.     <xsl:text>&amp;</xsl:text>
  652.     <xsl:call-template name="filter.attval">
  653.         <xsl:with-param name="text" select="substring-after($text, '&')" />
  654.     </xsl:call-template>
  655. </xsl:when>
  656. <xsl:otherwise>
  657.     <xsl:call-template name="filter.attval.special">
  658.         <xsl:with-param name="text" select="$text" />
  659.     </xsl:call-template>
  660. </xsl:otherwise>
  661. </xsl:choose>
  662. </xsl:template>
  663. <!-- /filter.attval -->
  664.  
  665.  
  666. <!-- ==================================================================== -->
  667. <!-- filter.attval.special                                                -->
  668. <!-- accompanying template of filter.attval                               -->
  669. <!-- ==================================================================== -->
  670. <xsl:template name="filter.attval.special">
  671. <xsl:param name="text" />
  672.  
  673. <xsl:choose>
  674. <xsl:when test="contains($text, '<')">
  675.     <xsl:value-of select="substring-before($text, '<')" />
  676.     <xsl:text>&lt;</xsl:text>
  677.     <xsl:call-template name="filter.attval.special">
  678.         <xsl:with-param name="text" select="substring-after($text, '<')" />
  679.     </xsl:call-template>
  680. </xsl:when>
  681. <xsl:when test="contains($text, '>')">
  682.     <xsl:value-of select="substring-before($text, '>')" />
  683.     <xsl:text>&gt;</xsl:text>
  684.     <xsl:call-template name="filter.attval.special">
  685.         <xsl:with-param name="text" select="substring-after($text, '>')" />
  686.     </xsl:call-template>
  687. </xsl:when>
  688. <xsl:when test="contains($text, '"')">
  689.     <xsl:value-of select="substring-before($text, '"')" />
  690.     <xsl:text>&quot;</xsl:text>
  691.     <xsl:call-template name="filter.attval.special">
  692.         <xsl:with-param name="text" select="substring-after($text, '"')" />
  693.     </xsl:call-template>
  694. </xsl:when>
  695. <xsl:otherwise>
  696.     <xsl:value-of select="$text" />
  697. </xsl:otherwise>
  698. </xsl:choose>
  699. </xsl:template>
  700. <!-- /filter.attval.special -->
  701.  
  702. </xsl:stylesheet>
  703.