-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_date-functions.xsl
More file actions
53 lines (52 loc) · 4 KB
/
Copy pathtest_date-functions.xsl
File metadata and controls
53 lines (52 loc) · 4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:oape="https://openarabicpe.github.io/ns"
xmlns="http://www.w3.org/1999/xhtml"
exclude-result-prefixes="xs oape"
version="3.0">
<xsl:output method="html" indent="yes"/>
<!-- <xsl:include href="https://tillgrallert.github.io/xslt-calendar-conversion/functions/date-functions.xsl"/>-->
<xsl:import href="functions/date-functions.xsl"/>
<xsl:template match="/">
<xsl:variable name="v_input" select="'21 Rab II 1341'"/>
<!-- establish calendar -->
<xsl:variable name="v_calendar" select="oape:date-establish-calendar($v_input, 'date', false())"/>
<xsl:variable name="v_date-normalised" select="oape:date-normalise-input($v_input,'en', $v_calendar)"/>
<xsl:variable name="v_gregorian-date" select="oape:date-convert-calendars($v_date-normalised, $v_calendar, '#cal_gregorian')"/>
<xsl:variable name="v_islamic-date" select="oape:date-convert-calendars($v_gregorian-date, '#cal_gregorian', 'https://www.wikidata.org/wiki/Q28892')"/>
<xsl:variable name="v_julian-date" select="oape:date-convert-calendars($v_gregorian-date, '#cal_gregorian', 'https://www.wikidata.org/wiki/Q1279922')"/>
<xsl:variable name="v_ottoman-fiscal-date" select="oape:date-convert-calendars($v_gregorian-date, '#cal_gregorian', '#cal_ottomanfiscal')"/>
<xsl:variable name="v_coptic-date" select="oape:date-convert-calendars($v_gregorian-date,'#cal_gregorian', '#cal_coptic')"/>
<!-- output -->
<div>
<h1>Input: <xsl:value-of select="$v_input"/> = <xsl:value-of select="$v_date-normalised"/>, <xsl:value-of select="$v_calendar"/></h1>
<ul>
<li>Gregorian date: <xsl:copy-of select="oape:date-format-iso-string-to-tei($v_gregorian-date, '#cal_gregorian', true(), true(),'ar')"/>
</li>
<li>Islamic date: <xsl:value-of select="$v_islamic-date"/> aH (
<xsl:value-of select="oape:date-convert-calendars($v_islamic-date, '#cal_islamic', '#cal_gregorian')"/> /
<xsl:value-of select="oape:date-convert-calendars($v_islamic-date, '#cal_islamic', '#cal_julian')"/> R /
<xsl:value-of select="oape:date-convert-calendars($v_islamic-date, '#cal_islamic', '#cal_ottomanfiscal')"/> M)
<xsl:copy-of select="oape:date-format-iso-string-to-tei($v_islamic-date, '#cal_islamic', true(), true(),'ar')"/>
</li>
<li>Julian date: <xsl:value-of select="$v_julian-date"/> R (
<xsl:value-of select="oape:date-convert-calendars($v_julian-date, '#cal_julian', '#cal_gregorian')"/> /
<xsl:value-of select="oape:date-convert-calendars($v_julian-date, '#cal_julian', '#cal_islamic')"/> aH /
<xsl:value-of select="oape:date-convert-calendars($v_julian-date, '#cal_julian', '#cal_ottomanfiscal')"/> M)
<xsl:copy-of select="oape:date-format-iso-string-to-tei($v_julian-date, '#cal_julian', true(), true(),'ar')"/>
</li>
<li>Ottoman fiscal date: <xsl:value-of select="$v_ottoman-fiscal-date"/> M (
<xsl:value-of select="oape:date-convert-calendars($v_ottoman-fiscal-date, '#cal_ottomanfiscal', '#cal_gregorian')"/> /
<xsl:value-of select="oape:date-convert-calendars($v_ottoman-fiscal-date, '#cal_ottomanfiscal', '#cal_julian')"/> R /
<xsl:value-of select="oape:date-convert-calendars($v_ottoman-fiscal-date, '#cal_ottomanfiscal', '#cal_islamic')"/> aH)
<xsl:copy-of select="oape:date-format-iso-string-to-tei($v_ottoman-fiscal-date, '#cal_ottomanfiscal', true(), true(),'ar')"/>
</li>
<li>Coptic date: <xsl:value-of select="$v_coptic-date"/> C (
)
<xsl:copy-of select="oape:date-format-iso-string-to-tei($v_coptic-date, '#cal_coptic', true(), true(),'ar')"/>
</li>
</ul>
</div>
</xsl:template>
</xsl:stylesheet>