This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: How to create XSL for CALENDAR/MONTH layout?
- To: "'xsl-list at lists dot mulberrytech dot com'" <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] How to create XSL for CALENDAR/MONTH layout?
- From: Adam Van Den Hoven <Adam dot Hoven at bluezone dot net>
- Date: Fri, 5 Jan 2001 10:49:32 -0800
- Reply-To: xsl-list at lists dot mulberrytech dot com
While I'm sure that you could do this using XSL, the obvious question is why
would you want to? Obviously, you are going to have to generate the calendar
data for each year you want to generate.
If you were to use XML your example code would be wrong and highlights some
of the problems with using XML as the source for a calendar. Your XML should
look like:
<CALENDAR>
<YEAR>2000</YEAR>
<MONTH>
<MONTHNAME>January</MONTHNAME>
<WEEK>
<WEEKNUMBER>1</WEEKNUMBER>
<DAY>2</DAY>
<DAY>3</DAY>
<DAY>4</DAY>
<DAY>5</DAY>
<DAY>6</DAY>
<DAY>7</DAY>
<DAY>8</DAY>
</WEEK>
</MONTH>
</CALENDAR>
--OR--
<CALENDAR>
<YEAR>2000</YEAR>
<MONTH>
<MONTHNAME>January</MONTHNAME>
<WEEK>
<WEEKNUMBER>1</WEEKNUMBER>
<DAY>26</DAY>
<DAY>27</DAY>
<DAY>28</DAY>
<DAY>29</DAY>
<DAY>30</DAY>
<DAY>31</DAY>
<DAY>1</DAY>
</WEEK>
<WEEK>
<WEEKNUMBER>2</WEEKNUMBER>
<DAY>2</DAY>
<DAY>3</DAY>
<DAY>4</DAY>
<DAY>5</DAY>
<DAY>6</DAY>
<DAY>7</DAY>
<DAY>8</DAY>
</WEEK>
</MONTH>
</CALENDAR>
It seems to me to be FAR more efficient to generate the results using
javascript. Because of the way that Javascript handles dates, its is very
easy to create a calendar, including handling those trailing days (the parts
of the first and last weeks that have days in other months).
Further, with a bit of careful thought your function could be made very
flexible. Simply include arguments for start and end dates, whether to show
trailing dates (like Dec 31, 1999), how many months to show in a single row,
etc.
I honestly think that XSL is the wrong tool for this job... try doing it
with Javascript.
Adam van den Hoven
Internet Application Developer
Blue Zone
tel. 604.685.4310
fax. 604.685.4391
Blue Zone makes you interactive. http://www.bluezone.net/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list