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

Re: A Calendar Project...

Subject: Re: A Calendar Project...
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Sun, 15 Jun 2003 17:01:07 -0400
calendar project

This is an interesting project. Time is a notoriously difficult thing to model, with many overlapping hierarchies (weeks and months, for example).

How to write an HTML table display of a sequence of 'day' elements tagged like this:

<day weekday="Tue" val="2003-07-01"/>
<day weekday="Wed" val="2003-07-02"/>
<day weekday="Thu" val="2003-07-03"/>
<day weekday="Fri" val="2003-07-04"/>
<day weekday="Sat" val="2003-07-05"/>
<day weekday="Sun" val="2003-07-06"/>
<day weekday="Mon" val="2003-07-07"/>
<day weekday="Tue" val="2003-07-08"/>
<day weekday="Wed" val="2003-07-09"/>
<day weekday="Thu" val="2003-07-10"/>
<day weekday="Fri" val="2003-07-11"/>

I would probably do by using a key-based grouping solution, keying each day by its first most recent Sunday (the ones in front would "fall out" and be returned with the empty string as key value), and not try to model a "week" as a group.

That way you get lots more flexibility: the "current calendar" could be as extensive as you needed in any direction, without having to worry about grouping by weeks.

XSLT 2 gives grouping instructions that should make all of this much easier.


At 02:34 AM 6/15/2003, you wrote:
I'm embarking on a calendar project... from the ground up.  So, I have the
luxuray of putting it together any way I like : )
I'm trying to determine the best XML data structure to suit XSLT processing.

Thinking in terms of the XSLT processor:
    1)  I need to be able to create standard 7 day week wide calendar by
30/31 day month view
    2)  I need to be able to create a week view in a vertical and horizontal
display format
    3) As well an assortment of calendar views...

With item # 1 above, the challenge is to create 7 TD's then a new TR... 7
TD's a new TR and so on...
The challenge in general is the grouping of different calendar parts, and
the discovery of first day of week, etc...

Has anyone else done such a project?
I will be building my XML data source from ASP, so I will script it on the
fly in a suitable structure to be processed by XSLT.  I guess my real
question is:  what would be a good XML structure for XSLT processing of a

Here is a couple of ideas I had (very prelimary):

<CAL D="2003-06-04">
 <DATE D="2003-05-29" DOW="1" WK="100"/>
 <DATE D="2003-05-30" DOW="2" WK="100"/>
 <DATE D="2003-05-31" DOW="3" WK="100"/>
 <DATE D="2003-06-01" DOW="4" WK="100"/>
 <DATE D="2003-06-02" DOW="5" WK="100"/>
 <DATE D="2003-06-03" DOW="6" WK="100"/>
 <DATE D="2003-06-04" DOW="7" WK="100"/>
    <DATE D="2003-06-05" DOW="1" WK="101"/>

Where CAL/@D is the current date (not necessarily todays date but the
selected date)
Where CAL/DATE/@DOW is the day-of-week (sunday..monday..tuesday.. ..)
Where CAL/DATE/@WK is the week of the year

Here is another format:
<CAL D="2003-06-04">
 <WEEK W="100">
     <DATE D="2003-05-29" DOW="1" />
     <DATE D="2003-05-30" DOW="2" />
     <DATE D="2003-05-31" DOW="3" />
     <DATE D="2003-06-01" DOW="4" />
     <DATE D="2003-06-02" DOW="5" />
     <DATE D="2003-06-03" DOW="6" />
     <DATE D="2003-06-04" DOW="7" />
  <WEEK W="101">
    <DATE D="2003-06-05" DOW="1">

Again, the challeng (that I see) is grouping calendar dates into the different calendar views we are use to seeing. I've built a calendar before using ASP and recall the struggle I had of discovering first day of the month... what week day the first day of month fell on... I recall the "skipping" of non-current month dates, and so on...

Any ideas would be appreciated!  I'm working on this all day today.  Oh, and
if anyone is interested in collaboriting on this project, let me know.


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

Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
  Mulberry Technologies: A Consultancy Specializing in SGML and XML

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

Current Thread


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.
First Name
Last Name
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.