Get XML Chinese Calendar

Home | EPS | HTML | PNG/JPEG | PDF | XML | Design | Annotate | Software English | 简体中文 | 繁體中文

The XML output is the newest addition to ccal. It allows user to customize the appearance of the calendar itself using XSLT or XSL-FO. User can also easily add custom information to the XML file and have it shown together with the calendar. The type of customization allowed by XML is in contrast to that allowed by the Design Your Own Chinese Calendar application, which creates a monthly or yearly PDF calendar with a picture of your choice, but the appearance of the calendar part is fixed.

Two sample style sheets are available to download which illustrate the use of XSLT and XSL-FO. The sample style sheet for XSLT generates HTML outputs that are essentially the same as the HTML table versions. For illustration purposes, this sample style sheet also supports an "isholiday" custom attribute. If the optional 'isholiday="true"' attribute is added to a day (<ccal:day>) element, that day will be shown in red. In this sample XML calendar for February 2000, the Chinese New Year's Day for that Gold Dragon Year is marked in red this way. To see raw XML document when style sheet is being used, just view source from browser.

The sample style sheet for XSL-FO can be used to generate monthly calendar for printing. In addition to the "isholiday" custom attribute, a "note" custom attribute for the day (<ccal:day>) element is also supported by this style sheet. Any text specified there will be shown near the bottom of that day frame. A custom attribute "papertype" for the year (<ccal:year>) element is also supported by this style sheet to select either Letter sized paper or A4 sized paper. The above sample XML calendar for February 2000 in fact also makes use of the additional attributes, and this PDF calendar is the output generated by the freely available XSL-FO processor FOP. Refer to Get Annotated Chinese Calendar page for more detail.

You can, for any year from 1645 to 7000, get Chinese calendar for any given Gregorian calendar month or year in XML:

Character type:       Simplified Characters        Traditional Characters

Style sheet reference:       Without style sheet reference        With style sheet reference

Month Year

However, accuracy will gradually decrease beyond 300 years from the Year 2000. For historical years, the returned calendar is accurate to astronomical events during that period but in a few cases may be different from what was actually used since the algorithms used in those times were less accurate.

Please note that the Chinese name in month element refers to new lunar month(s) to start in that solar month unless there is no new lunar month in that solar month in which case it refers to the current running lunar month.

When you save the returned file, please use .xml as the file extension if it is not yet shown as the suggested extension.

Back to Make Your Own Chinese Calendar

Home | EPS | HTML | PNG/JPEG | PDF | XML | Design | Annotate | Software
English | 简体中文 | 繁體中文


Created by: Zhuo Meng (zxm8@case.edu) Usual disclaimer applies