|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: How to create XSL for CALENDAR/MONTH layout?
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








