[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

How to create XSL for CALENDAR/MONTH layout?

Subject: How to create XSL for CALENDAR/MONTH layout?
From: David Vogt <dvogt@xxxxxxxxxxxxx>
Date: Fri, 5 Jan 2001 06:35:45 -0600
calendar layout
I have a calendar that displays 12 months of a year.  Currently, all 12
months display across the page as one row.  Instead, I'd like to arrange
them a 3 rows with 4 months in each row.  Any ideas how to do this: <tr>4
MONTHS HERE</tr>?

The XML looks like this:

<CALENDAR>
 <YEAR>2000</YEAR>
 <MONTH>
  <MONTHNAME>January</MONTHNAME>
  <WEEK>
   <WEEKNUMBER>1</WEEKNUMBER>
   <DAY>1</DAY>
   <DAY>2</DAY>
   <DAY>3</DAY>
   <DAY>4</DAY>
   <DAY>5</DAY>
   <DAY>6</DAY>
   <DAY>7</DAY>
  </WEEK>
 </MONTH>
</CALENDAR>

The XSL looks like this:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="html"/>

<xsl:template match="*|/"><xsl:apply-templates/></xsl:template>

<xsl:template match="text()|@*"><xsl:value-of select="."/></xsl:template>

<xsl:template match="/">
<HTML style="">
 <HEAD style="">
  <TITLE style="">Year View</TITLE>
  <LINK style="" href="calendar.css" rel="stylesheet"/>
 </HEAD>
 <BODY style="">
  <TABLE style="" cellSpacing="0" cellPadding="0" width="597" align="left"
border="0">
  <TBODY style="">
   <xsl:apply-templates/>
  </TBODY>
  </TABLE>
 </BODY>
</HTML>
</xsl:template>

<xsl:template match="CALENDAR">
<tr>
 <xsl:apply-templates select="MONTH"/>
</tr>
</xsl:template>

<xsl:template match="MONTH">
 <td>
  <table cellspacing="0" cellpadding="0" width="162" border="0">
  <tbody>
   <tr>
    <td><img src="c:\spacer_white.gif" width="2"></img></td>
    <td align="middle" bgcolor="#000066">
     <table cellspacing="0" cellpadding="0" width="158"
background="c:\stripes.gif" border="0">
     <tbody>
      <tr falign="middle" background="c:\stripes.gif">
       <td class="calTextWhite" height="22" width="100%" align="center">
        <xsl:value-of select="MONTHNAME"/>
       </td>
      </tr>
     </tbody>
     </table>
    </td>
   </tr>
   <tr>
    <td><img src="c:\spacer_white.gif" width="2"></img></td>
    <td>
     <table cellspacing="0" cellpadding="0" width="158" bgcolor="#ffffff"
border="0">
     <tbody>
      <tr>
       <td class="calTextBlack" align="middle">M</td>
       <td class="calTextBlack" align="middle">Tu</td>
       <td class="calTextBlack" align="middle">W</td>
       <td class="calTextBlack" align="middle">Th</td>
       <td class="calTextBlack" align="middle">F</td>
       <td class="calTextBlack" align="middle">Sa</td>
       <td class="calTextBlack" align="middle">Su</td>
      </tr>
      <xsl:apply-templates select="WEEK"/>
     </tbody>
     </table>
    </td>
   </tr>
  </tbody>
  </table>
 </td>
</xsl:template>

<xsl:template match="WEEK">
 <tr>
  <xsl:apply-templates select="DAY"/>
 </tr>
</xsl:template>

<xsl:template match="DAY">
 <td class="calText" align="middle">
  <xsl:value-of select="DAYNUMBER"/>
 </td>
</xsl:template>

</xsl:stylesheet>

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.