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 / content2html.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2004-07-12  |  5.0 KB  |  139 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 
  18.   xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
  19.   xmlns:col="http://apache.org/cocoon/collection/1.0" 
  20.   xmlns:xi="http://www.w3.org/2001/XInclude" 
  21.   xmlns:DAV="DAV:"
  22.   version="1.0">
  23.  
  24.   <xsl:import href="layout.xsl" />
  25.   <xsl:output indent="yes"/>
  26.   
  27.   <xsl:param name="base"/>
  28.   <xsl:param name="path"/>
  29.   
  30.   <xsl:param name="namespace"/>
  31.   <xsl:param name="principal"/>
  32.  
  33.   <xsl:param name="type">content</xsl:param>
  34.   
  35.   <xsl:template name="middle">
  36.     <column title="Content">
  37.       <xsl:apply-templates select="/document/col:resource|/document/col:collection" />
  38.     </column>
  39.   </xsl:template>
  40.   
  41.   <xsl:template match="col:resource|col:collection">
  42.     <xsl:choose>
  43.       <xsl:when test="local-name() = 'collection'">
  44.         <table width="100%" cellspacing="0" cellpadding="5" align="center">
  45.           <font size="+1" face="arial,helvetica,sanserif" color="#000000">
  46.             <tr>
  47.               <td align="left">
  48.                 <b>Filename</b>
  49.               </td>
  50.               <td align="left">
  51.                 <b>Type</b>
  52.               </td>
  53.               <td align="left">
  54.                 <b>Size</b>
  55.               </td>
  56.               <td align="left">
  57.                 <b>Last Modified</b>
  58.               </td>
  59.               <td align="right"/>
  60.             </tr>
  61.             <xsl:for-each select="col:collection|col:resource">
  62.               <tr>
  63.                 <td align="left">  
  64.                   <xsl:choose>
  65.                     <xsl:when test="$path != ''">
  66.                       <a href="{$base}/{$type}/{$path}/{@name}">
  67.                         <xsl:value-of select="@name"/>
  68.                       </a>
  69.                     </xsl:when>
  70.                     <xsl:otherwise>
  71.                       <a href="{$base}/{$type}/{@name}">
  72.                         <xsl:value-of select="@name"/>
  73.                       </a>
  74.                     </xsl:otherwise>
  75.                   </xsl:choose>
  76.                 </td>
  77.                 <td align="left">
  78.                   <xsl:value-of select="col:properties/DAV:getcontenttype"/>
  79.                 </td>
  80.                 <td align="left">
  81.                   <xsl:value-of select="col:properties/DAV:getcontentlength"/>
  82.                 </td>
  83.                 <td align="left">
  84.                   <xsl:value-of select="col:properties/DAV:modificationdate"/>
  85.                 </td>
  86.                 <td align="right">
  87.                   <form action="{$base}/delete" method="post">
  88.                     <input type="hidden" name="parentPath" value="{$path}" />
  89.                     <input type="hidden" name="resourceName" value="{@name}"/>
  90.                     <input type="submit" name="doDeleteSource" value="Delete"/>
  91.                   </form>
  92.                 </td>
  93.               </tr>
  94.             </xsl:for-each>
  95.             <tr>
  96.               <form action="{$base}/uploadsource" method="post" enctype="multipart/form-data">
  97.                 <input type="hidden" name="parentPath" value="{$path}"/>
  98.                 <td align="left"><input type="text" name="resourceName" size="15" maxlength="40"/></td>
  99.                 <td align="left" colspan="3">
  100.                  File:
  101.                  <input type="file" name="uploadFile" size="15" maxlength="40"/>
  102.                 </td>
  103.                 <td align="right">
  104.                   <input type="submit" name="doUploadSource" value="Upload File"/>
  105.                 </td>
  106.               </form>
  107.             </tr>
  108.             <tr>
  109.               <form action="{$base}/makecollection" method="post">
  110.                 <input type="hidden" name="parentPath" value="{$path}"/>
  111.                 <td align="left" colspan="4">
  112.                   <input type="text" name="collectionName" size="15" maxlength="40"/>
  113.                 </td>
  114.                 <td align="right">
  115.                   <input type="submit" name="doCreateCollection" value="Create collection"/>
  116.                 </td>
  117.               </form>
  118.             </tr>
  119.           </font>
  120.         </table>
  121.       </xsl:when>
  122.       <xsl:when test="col:properties/DAV:getcontenttype='text/plain'">
  123.         <pre>
  124.           <xi:include href="slide://{$principal}@{$namespace}/{$path}" parse="text"/>
  125.         </pre>
  126.       </xsl:when>
  127.       <xsl:when test="col:properties/DAV:getcontenttype='text/xml'">
  128.         <pre>
  129.           <xi:include href="slide://{$principal}@{$namespace}/{$path}" parse="text"/>
  130.         </pre>
  131.       </xsl:when>
  132.       <xsl:otherwise>
  133.         <h3>Could not display content.</h3>
  134.       </xsl:otherwise>
  135.     </xsl:choose>
  136.   </xsl:template>
  137.   
  138. </xsl:stylesheet>
  139.