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 / gallery.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2004-07-12  |  3.3 KB  |  98 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. <!-- $Id: gallery.xsl,v 1.3 2004/03/06 02:25:57 antonio Exp $ 
  18.  
  19. -->
  20. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  21.  
  22. <!-- The current picture (index) to display -->
  23. <xsl:param name="pic"/>
  24. <!-- Is this full screen? -->
  25. <xsl:param name="fullscreen"/>
  26.  
  27. <xsl:template match="pictures" xmlns:cl="http://apache.org/cocoon/portal/coplet/1.0">
  28. <xsl:variable name="maxp" select="count(picture)"/>
  29.  
  30. <xsl:choose>
  31. <xsl:when test="$fullscreen='true'">
  32.   <!-- This is the two column version: 
  33.   <table>
  34.     <xsl:for-each select="picture">
  35.         <xsl:if test="position() mod 2 = 1">
  36.             <tr>        
  37.                 <td><img src="{.}"/></td>
  38.                 <xsl:choose>
  39.                     <xsl:when test="position() = last()">
  40.                         <td> </td>
  41.                     </xsl:when>
  42.                     <xsl:otherwise>
  43.                         <xsl:variable name="p" select="position()+1"/>
  44.                         <td><img src="{//picture[position()=$p]}"/></td>
  45.                     </xsl:otherwise>
  46.                 </xsl:choose>
  47.             </tr>
  48.         </xsl:if>
  49.     </xsl:for-each>
  50.   </table>
  51.   -->
  52.   <!-- And this is the simple version -->
  53.       <table>
  54.           <tr width="100%">
  55.               <td>
  56.                 <xsl:for-each select="picture">
  57.                    <img src="{.}"/><xsl:text> </xsl:text>
  58.                 </xsl:for-each>
  59.               </td>
  60.           </tr>
  61.       </table>
  62. </xsl:when>
  63. <xsl:otherwise>
  64.   <xsl:variable name="picn">
  65.     <xsl:choose>
  66.       <xsl:when test="$pic=$maxp">1</xsl:when>
  67.       <xsl:when test="$pic=''">2</xsl:when>
  68.       <xsl:otherwise><xsl:value-of select="$pic+1"/></xsl:otherwise>
  69.     </xsl:choose>
  70.   </xsl:variable>
  71.   <xsl:variable name="picp">
  72.     <xsl:choose>
  73.       <xsl:when test="$pic=1 or $pic=''"><xsl:value-of select="$maxp"/></xsl:when>
  74.       <xsl:otherwise><xsl:value-of select="$pic - 1"/></xsl:otherwise>
  75.     </xsl:choose>
  76.   </xsl:variable>
  77.   <xsl:variable name="showpicindex">
  78.     <xsl:choose>
  79.       <xsl:when test="$pic=1 or $pic=''">1</xsl:when>
  80.       <xsl:otherwise><xsl:value-of select="$pic"/></xsl:otherwise>
  81.     </xsl:choose>
  82.   </xsl:variable>
  83.  
  84.   <p>Picture <xsl:value-of select="$showpicindex"/> of <xsl:value-of select="$maxp"/>
  85.     <xsl:if test="$showpicindex > 1">
  86.       - <cl:link path="attributes/picture" value="{$picp}">« Previous</cl:link>
  87.     </xsl:if>
  88.     <xsl:if test="$showpicindex < $maxp">
  89.       - <cl:link path="attributes/picture" value="{$picn}">Next »</cl:link>
  90.     </xsl:if>
  91.     </p>
  92.     <p><cl:link path="attributes/picture" value="{picture[position()=$showpicindex]}" coplet="GalleryViewer-1">Push to Viewer</cl:link></p>
  93.     <img src="{picture[position()=$showpicindex]}"/>
  94. </xsl:otherwise>
  95. </xsl:choose>
  96. </xsl:template>
  97. </xsl:stylesheet>
  98.