home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / xampp / xampp-cocoon-addon-1.4.9-installer.exe / collection2html.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2004-07-12  |  3.7 KB  |  128 lines

  1. <?xml version="1.0"?>
  2. <!--
  3.   Copyright 1999-2004 The Apache Software Foundation
  4.  
  5.   Licensed under the Apache License, Version 2.0 (the "License");
  6.   you may not use this file except in compliance with the License.
  7.   You may obtain a copy of the License at
  8.  
  9.       http://www.apache.org/licenses/LICENSE-2.0
  10.  
  11.   Unless required by applicable law or agreed to in writing, software
  12.   distributed under the License is distributed on an "AS IS" BASIS,
  13.   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.   See the License for the specific language governing permissions and
  15.   limitations under the License.
  16. -->
  17. <xsl:stylesheet version="1.0" 
  18.   xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
  19.   xmlns:xlink="http://www.w3.org/1999/xlink"
  20.   xmlns:collection="http://apache.org/cocoon/collection/1.0">
  21.   
  22.   <xsl:param name="footer" />
  23.   <xsl:param name="requestURI"></xsl:param>
  24.   <xsl:variable name="adjustedRequestURI">
  25.     <xsl:choose>
  26.       <xsl:when test="substring($requestURI, string-length($requestURI),1)='/'"><xsl:value-of select="$requestURI"/></xsl:when>
  27.       <xsl:otherwise><xsl:value-of select="$requestURI"/>/</xsl:otherwise>
  28.     </xsl:choose>
  29.   </xsl:variable>
  30.   
  31.   <xsl:template match="/collection:collection">
  32.     <html>
  33.       <head>
  34.         <title>
  35.           <xsl:value-of select="@name"/>
  36.         </title>
  37.       </head>
  38.       <body bgcolor="#ffffff">
  39.         <table width="90%" cellspacing="0" cellpadding="5" align="center">
  40.           <tr>
  41.             <td colspan="3">
  42.               <font size="+2">
  43.                 <strong>
  44.                   Directory Listing For <xsl:value-of select="@name"/>
  45.                 </strong>
  46.               </font>
  47.             </td>
  48.           </tr>
  49.           <tr>
  50.             <td colspan="3"> </td>
  51.           </tr>
  52.           <xsl:call-template name="collection-header" />
  53.           <xsl:apply-templates>
  54.             <xsl:with-param name="href" select="$adjustedRequestURI" />
  55.           </xsl:apply-templates>
  56.           <tr>
  57.             <td colspan="3" bgcolor="#cccccc">
  58.               <font size="-1"><xsl:value-of select="$footer" /></font>
  59.             </td>
  60.           </tr>
  61.         </table>
  62.       </body>
  63.     </html>
  64.   </xsl:template>
  65.   
  66.   <xsl:template name="collection-header">
  67.     <tr bgcolor="#cccccc">
  68.       <td align="left">
  69.         <font size="+1">
  70.           <strong>Filename</strong>
  71.         </font>
  72.       </td>
  73.       <td align="right">
  74.         <font size="+1">
  75.           <strong>Size</strong>
  76.         </font>
  77.       </td>
  78.       <td align="right">
  79.         <font size="+1">
  80.           <strong>Last Modified</strong>
  81.         </font>
  82.       </td>
  83.     </tr>
  84.   </xsl:template>
  85.     
  86.   <xsl:template match="collection:collection">
  87.     <xsl:param name="href" />
  88.     <tr>
  89.       <xsl:if test="position() mod 2 = 0">
  90.         <xsl:attribute name="bgcolor">#eeeeee</xsl:attribute>
  91.       </xsl:if>
  92.       <td align="left">  <a href="{$href}{@name}">
  93.         <tt><xsl:value-of select="@name"/></tt></a>
  94.       </td>
  95.       <td align="right">
  96.         <tt> </tt>
  97.       </td>
  98.       <td align="right">
  99.         <tt>
  100.           <xsl:value-of select="@date"/>
  101.         </tt>
  102.       </td>
  103.     </tr>
  104.   </xsl:template>
  105.   
  106.   <xsl:template match="collection:resource">
  107.     <xsl:param name="href" />
  108.     <tr>
  109.       <xsl:if test="position() mod 2 = 0">
  110.         <xsl:attribute name="bgcolor">#eeeeee</xsl:attribute>
  111.       </xsl:if>
  112.       <td align="left">  <a href="{$href}{@name}">
  113.         <tt><xsl:value-of select="@name"/></tt></a>
  114.       </td>
  115.       <td align="right">
  116.         <tt><xsl:value-of select="@size"/></tt>
  117.       </td>
  118.       <td align="right">
  119.         <tt><xsl:value-of select="@date"/></tt>
  120.       </td>
  121.     </tr>
  122.   </xsl:template>
  123.   
  124.   <!-- ignore everything else -->
  125.   <xsl:template match="node()|@*" />
  126.   
  127. </xsl:stylesheet>
  128.