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 / calendar2html.xslt < prev    next >
Encoding:
Extensible Markup Language  |  2004-07-12  |  4.6 KB  |  178 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.  
  18. <!-- CVS $Id: calendar2html.xslt,v 1.3 2004/04/09 14:31:48 ugo Exp $ -->
  19.  
  20. <xsl:stylesheet version="1.0"
  21.                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  22.                 xmlns:calendar="http://apache.org/cocoon/calendar/1.0">
  23.  
  24.   <xsl:template match="/">
  25.     <html>
  26.       <head>
  27.         <title>
  28.           Calendar for <xsl:value-of select="calendar:calendar/@month"/>
  29.           <xsl:text> </xsl:text><xsl:value-of select="calendar:calendar/@year"/>
  30.         </title>
  31.         <style>
  32.           <xsl:comment>
  33. .calendar {
  34.   font-family: Georgia, "Book Antiqua", Palatino, "Times New Roman", serif;
  35.   margin-top: 20px;
  36.   padding-bottom: 1em;
  37.   background-color: white;
  38.   color: #333;
  39. }
  40.  
  41. .calendar table {
  42.   background-color: #888;
  43. }
  44.  
  45. .calendar table caption {
  46.   font-size: x-large;
  47.   font-weight: bold;
  48.   font-variant: small-caps;
  49.   padding-top: 0.2em;
  50.   padding-bottom: 0.3em;
  51.   background: #fff;
  52.   color: #333;
  53. }
  54.  
  55. .calendar table th {
  56.   font-size: small;
  57.   font-variant: small-caps;
  58.   background: #fff;
  59.   color: #333;
  60.   padding-bottom: 2px;
  61. }
  62.  
  63. .calendar .daytitle {
  64.   position: relative;
  65.   left: 0;
  66.   top: 0;
  67.   width: 25%;
  68.   padding: 3px 0;
  69.   color: #000;
  70.   border-right: 1px solid #888;
  71.   border-bottom: 1px solid #888;
  72.   font-size: small;
  73.   text-align: center;
  74. }
  75.  
  76. td {
  77.   vertical-align: top;
  78.   margin: 0;
  79.   padding: 0 5px 5px 0;
  80.   height: 7em;
  81.   width: 12%;
  82.   background: #fff;
  83.   color: #333;
  84. }
  85.  
  86. .calendar p {
  87.   text-align: center;
  88.   font-size: small;
  89. }
  90.           </xsl:comment>
  91.         </style>
  92.       </head>
  93.       <body>
  94.         <xsl:apply-templates/>
  95.       </body>
  96.     </html>
  97.   </xsl:template>
  98.  
  99.   <xsl:template match="calendar:calendar">
  100.     <div class="calendar">
  101.       <table cellpadding="0" cellspacing="1" summary="Monthly calendar">
  102.         <caption><xsl:value-of select="@month"/>
  103.           <xsl:text> </xsl:text><xsl:value-of select="@year"/>
  104.         </caption>
  105.         <thead>
  106.           <tr>
  107.             <th>Sunday</th>
  108.             <th>Monday</th>
  109.             <th>Tuesday</th>
  110.             <th>Wednesday</th>
  111.             <th>Thursday</th>
  112.             <th>Friday</th>
  113.             <th>Saturday</th>
  114.           </tr>
  115.         </thead>
  116.         <tbody>
  117.           <xsl:apply-templates select="calendar:week"/>
  118.         </tbody>
  119.       </table>
  120.     </div>
  121.   </xsl:template>
  122.   
  123.   <xsl:template match="calendar:week">
  124.     <tr>
  125.       <xsl:if test="position() = 1">
  126.         <xsl:choose>
  127.           <xsl:when test="count(calendar:day) = 1">
  128.             <td/><td/><td/><td/><td/><td/>
  129.           </xsl:when>
  130.           <xsl:when test="count(calendar:day) = 2">
  131.             <td/><td/><td/><td/><td/>
  132.           </xsl:when>
  133.           <xsl:when test="count(calendar:day) = 3">
  134.             <td/><td/><td/><td/>
  135.           </xsl:when>
  136.           <xsl:when test="count(calendar:day) = 4">
  137.             <td/><td/><td/>
  138.           </xsl:when>
  139.           <xsl:when test="count(calendar:day) = 5">
  140.             <td/><td/>
  141.           </xsl:when>
  142.           <xsl:when test="count(calendar:day) = 6">
  143.             <td/>
  144.           </xsl:when>
  145.         </xsl:choose>
  146.       </xsl:if>
  147.       <xsl:for-each select="calendar:day">
  148.         <td>
  149.           <div class="daytitle"><xsl:value-of select="@number"/></div>
  150.           <p><xsl:value-of select="@date"/></p>
  151.         </td>
  152.       </xsl:for-each>
  153.       <xsl:if test="position() = last()">
  154.         <xsl:choose>
  155.           <xsl:when test="count(calendar:day) = 1">
  156.             <td/><td/><td/><td/><td/><td/>
  157.           </xsl:when>
  158.           <xsl:when test="count(calendar:day) = 2">
  159.             <td/><td/><td/><td/><td/>
  160.           </xsl:when>
  161.           <xsl:when test="count(calendar:day) = 3">
  162.             <td/><td/><td/><td/>
  163.           </xsl:when>
  164.           <xsl:when test="count(calendar:day) = 4">
  165.             <td/><td/><td/>
  166.           </xsl:when>
  167.           <xsl:when test="count(calendar:day) = 5">
  168.             <td/><td/>
  169.           </xsl:when>
  170.           <xsl:when test="count(calendar:day) = 6">
  171.             <td/>
  172.           </xsl:when>
  173.         </xsl:choose>
  174.       </xsl:if>
  175.     </tr>
  176.   </xsl:template>
  177.  
  178. </xsl:stylesheet>