A couple of months ago a posted a short note on my XSLT stylesheets to convert the various calendars at use in the late Ottoman empire at will. Now, I have improved the functions and added the Ottoman fiscal calendar (mālī, sene-yi māliye) to the brew and uploaded everything under a CC BY-SA 3.0 license to GitHub. Feel free to fork and tinker with the code. Enjoy!

## General description

The single stylesheet in this repo was conceived as a remedy for the bugs in the XPath specification that prevent the computation of Islamic (hijrī) dates. As I was, at the same time, working on the transcription of Arabic and Ottoman Turkish sources from the nineteenth century, which made use of Gregorian, hijrī, rūmī, and mālī calendars, into XML files, I also wanted to reliably compute conversions between the various calendars.

In addition to numerical dates, the stylesheet provides a function that returns the common month names.

Detailed descriptions of the functions and their parameters can be found inside the stylesheet.

## Characteristics of the non-Gregorian calendars

• Hijrī reckoning relies on the observation of the lunar year. Year counts began with Muhammad’s exodus (hijrā) from Mecca to Medina. Hijrī dates cannot really be computed as observations of the new moon varied between locations. The stylesheet uses common astronomical computations of the lunar calendar.
• Rūmī reckoning is a Julian calendar that adopted 1 January as the beginning of the year. As the rules for leap years are slightly different between Julian and Gregorian calendars, the difference between these two is slowly increasing (currently 13 days).
• Mālī reckoning is a combination of the old Julian calendar beginning on 1 March and a hijrī year count, that was introduced as the fiscal calendar of the Ottoman Empire in 1676. Every 33 lunar years, the year counts between mālī and hijrī calendars are synchronised by dropping a year.

## Templates

• Templates for the conversion between calendars:
• funcDateG2H
• funcDateG2J
• funcDateG2JD
• funcDateG2M
• funcDateH2G
• funcDateH2J
• funcDateH2JD
• funcDateH2M
• funcDateJ2G
• funcDateJ2H
• funcDateJ2JD
• funcDateJD2G
• funcDateJD2H
• funcDateJD2J
• funcDateM2G
• funcDateM2H
• funcDateM2J
• Templates for converting Date formats
• The template “funcDateFormatTei” accepts the same input but produces a <tei:date> note with @when or @when, @when-custom, @calendar, and @datingMethod attributes depending on the input calendar.