apache > cocoon

Description of the Calendar Generator

Calendar Generator

Here is a sample output:

  <calendar:calendar xmlns:calendar="http://apache.org/cocoon/calendar/1.0"
      year="2004" month="January" prevMonth="12" prevYear="2003"
      nextMonth="02" nextYear="2004">
    <calendar:week number="1">
      <calendar:day number="1" weekday="THURSDAY" date="January 1, 2004"/>
      <calendar:day number="2" weekday="FRIDAY" date="January 2, 2004"/>
      <calendar:day number="3" weekday="SATURDAY" date="January 3, 2004"/>
      <calendar:day number="4" weekday="SUNDAY" date="January 4, 2004"/>

The src parameter is ignored.


Configuration options:

  • month (optional) : Sets the month for the calendar (January is 1). Default is the current month.
  • year (optional) : Sets the year for the calendar. Default is the current year.
  • dateFormat (optional) : Sets the format for the date attribute of each node, as described in java.text.SimpleDateFormat. If unset, the default format for the current locale (Dateformat.LONG) will be used.
  • lang (optional) : Sets the ISO language code for determining the locale.
  • country (optional) : Sets the ISO country code for determining the locale.
  • padweeks (optional): If true, the first and last incomplete weeks are padded with the last days of the previous month and first days of next month respectively. If false, the first and last weeks contain only the days part of the selected month, as shown in the sample output above. Default is "false".


The calendar generated is designed to honour the locale as much as possible. This means that uses the setting for the start of the week (Monday or Sunday), the name of the month, the dateformat and names of weekdays if part of the dateformat.
However, in order to provide tests based on weekdays (e.g. to color weekend days different from work days), the weekday is added as the English name in capitals. If you want to use it for display purposes, add an i18n transformation to convert the names into a localized version. The Calendar sample in the Cocoon samples has information on how to do that.