diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2016-10-19 18:25:21 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2016-10-19 18:25:21 (GMT) |
commit | d72feaf69933b069cff3c0cb20a5f5f03ecba77b (patch) | |
tree | bf51d2814f4be65c850dba86dc2a5db0ad38bedf /libxslt/tests/exslt/date | |
parent | 34be72f9ed749a5c013d3f7f47d810e8caf652cb (diff) | |
parent | 49e8fbec2420ef55b3246aabd89328b13530810c (diff) | |
download | blt-d72feaf69933b069cff3c0cb20a5f5f03ecba77b.zip blt-d72feaf69933b069cff3c0cb20a5f5f03ecba77b.tar.gz blt-d72feaf69933b069cff3c0cb20a5f5f03ecba77b.tar.bz2 |
Merge commit '49e8fbec2420ef55b3246aabd89328b13530810c' as 'libxslt'
Diffstat (limited to 'libxslt/tests/exslt/date')
87 files changed, 3645 insertions, 0 deletions
diff --git a/libxslt/tests/exslt/date/Makefile.am b/libxslt/tests/exslt/date/Makefile.am new file mode 100644 index 0000000..ec1b896 --- /dev/null +++ b/libxslt/tests/exslt/date/Makefile.am @@ -0,0 +1,87 @@ +## Process this file with automake to produce Makefile.in + +$(top_builddir)/xsltproc/xsltproc: + @(cd ../../../xsltproc ; $(MAKE) xsltproc) + +EXTRA_DIST = \ + current.xsl \ + date.1.out date.1.xml date.1.xsl \ + date.2.out date.2.xml date.2.xsl \ + datetime.1.out datetime.1.xml datetime.1.xsl \ + datetime.2.out datetime.2.xml datetime.2.xsl \ + gday.1.out gday.1.xml gday.1.xsl \ + gday.2.out gday.2.xml gday.2.xsl \ + gmonth.1.out gmonth.1.xml gmonth.1.xsl \ + gmonth.2.out gmonth.2.xml gmonth.2.xsl \ + gmonthday.1.out gmonthday.1.xml gmonthday.1.xsl \ + gmonthday.2.out gmonthday.2.xml gmonthday.2.xsl \ + gyear.1.out gyear.1.xml gyear.1.xsl \ + gyear.2.out gyear.2.xml gyear.2.xsl \ + gyearmonth.1.out gyearmonth.1.xml gyearmonth.1.xsl \ + gyearmonth.2.out gyearmonth.2.xml gyearmonth.2.xsl \ + time.1.out time.1.xml time.1.xsl \ + time.2.out time.2.xml time.2.xsl \ + add.1.out add.1.xml add.1.xsl \ + add.2.out add.2.xml add.2.xsl \ + add-duration.1.out add-duration.1.xml add-duration.1.xsl \ + add-duration.2.out add-duration.2.xml add-duration.2.xsl \ + sum.1.out sum.1.xml sum.1.xsl \ + sum.2.out sum.2.xml sum.2.xsl sum.2.err \ + difference.1.out difference.1.xml difference.1.xsl \ + difference.2.out difference.2.xml difference.2.xsl \ + duration.1.out duration.1.xml duration.1.xsl \ + duration.2.out duration.2.xml duration.2.xsl \ + seconds.1.out seconds.1.xml seconds.1.xsl \ + seconds.2.out seconds.2.xml seconds.2.xsl + +CLEANFILES = .memdump + +test-current: + @(echo > .memdump) + @echo \<doc/\> >current.xml + @echo "#" + @echo "# Inspect the following for correctness" + @echo "#" + @(for i in $(srcdir)/current.xsl ; do \ + name=`basename $$i .xsl` ; \ + if [ ! -f $(srcdir)/$$name.xml ] ; then continue ; fi ; \ + $(top_builddir)/xsltproc/xsltproc $(srcdir)/$$name.xsl $(srcdir)/$$name.xml;\ + grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true;\ + done) + @rm -f current.xml + +test-logall: + @echo '## Running exslt date tests' + +test tests: $(top_builddir)/xsltproc/xsltproc test-logall test-current + @echo '## Running exslt common tests' + @(echo > .memdump) + @(for i in $(srcdir)/*.xsl ; do \ + name=`basename $$i .xsl` ; \ + if [ ! -f $(srcdir)/$$name.xml ] ; then continue ; fi ; \ + log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc \ + $(srcdir)/$$name.xsl $(srcdir)/$$name.xml > $$name.res 2>$$name.bad;\ + if [ ! -f $(srcdir)/$$name.out ] ; then \ + cp $$name.res $(srcdir)/$$name.out ; \ + if [ -s $$name.bad ] ; then \ + mv $$name.bad $(srcdir)/$$name.err ; \ + fi ; \ + else \ + if [ ! -s $$name.res ] ; then \ + echo "Fatal error, no $$name.res\n" ; \ + else \ + diff $(srcdir)/$$name.out $$name.res ; \ + if [ -s $(srcdir)/$$name.err ] ; then \ + diff $(srcdir)/$$name.err $$name.bad; \ + else \ + diff /dev/null $$name.bad; \ + fi ; \ + fi ; \ + fi; \ + grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true`;\ + if [ -n "$$log" ] ; then \ + echo $$name result ; \ + echo "$$log" ; \ + fi ; \ + rm -f $$name.res $$name.bad; \ + done) diff --git a/libxslt/tests/exslt/date/add-duration.1.out b/libxslt/tests/exslt/date/add-duration.1.out new file mode 100644 index 0000000..5eb86bc --- /dev/null +++ b/libxslt/tests/exslt/date/add-duration.1.out @@ -0,0 +1,47 @@ + +add-duration : P1Y + -P1Y +result : P0D +add-duration : P1M + -P1M +result : P0D +add-duration : P1D + -P1D +result : P0D +add-duration : PT1H + -PT1H +result : P0D +add-duration : PT1M + -PT1M +result : P0D +add-duration : PT1S + -PT1S +result : P0D +add-duration : P1Y + -P12M +result : P0D +add-duration : P1D + -PT24H +result : P0D +add-duration : P1D + -PT1440M +result : P0D +add-duration : P1D + -PT86400S +result : P0D +add-duration : P1Y1D + -P12MT86400S +result : P0D +add-duration : P30D + PT24H +result : P31D +add-duration : P10Y + P45M +result : P13Y9M +add-duration : P10Y + -P12M +result : P9Y +add-duration : P5Y11M + -P12M +result : P4Y11M +add-duration : P1000Y11M30D + -PT9S +result : P1000Y11M29DT23H59M51S +add-duration : P12M29D + P365D +result : P1Y394D +add-duration : P1000Y + PT45.65S +result : P1000YT45.65S +add-duration : PT23H59M0S + PT59S +result : PT23H59M59S +add-duration : PT23H59M0S + PT61S +result : P1DT1S +add-duration : P1000Y11M30DT23H59M0.1S + PT59.9S +result : P1000Y11M31D +add-duration : P1000Y11M30DT23H59M1S + PT59S +result : P1000Y11M31D +add-duration : P1000Y11M30D + -P1DT9S +result : P1000Y11M28DT23H59M51S
\ No newline at end of file diff --git a/libxslt/tests/exslt/date/add-duration.1.xml b/libxslt/tests/exslt/date/add-duration.1.xml new file mode 100644 index 0000000..0896c50 --- /dev/null +++ b/libxslt/tests/exslt/date/add-duration.1.xml @@ -0,0 +1,27 @@ +<?xml version="1.0"?> +<page> + <date dur1='P1Y' dur2='-P1Y'/> + <date dur1='P1M' dur2='-P1M'/> + <date dur1='P1D' dur2='-P1D'/> + <date dur1='PT1H' dur2='-PT1H'/> + <date dur1='PT1M' dur2='-PT1M'/> + <date dur1='PT1S' dur2='-PT1S'/> + <date dur1='P1Y' dur2='-P12M'/> + <date dur1='P1D' dur2='-PT24H'/> + <date dur1='P1D' dur2='-PT1440M'/> + <date dur1='P1D' dur2='-PT86400S'/> + <date dur1='P1Y1D' dur2='-P12MT86400S'/> + <date dur1='P30D' dur2='PT24H'/> + <date dur1='P10Y' dur2='P45M'/> + <date dur1='P10Y' dur2='-P12M'/> + <date dur1='P5Y11M' dur2='-P12M'/> + <date dur1='P1000Y11M30D' dur2='-PT9S'/> + <date dur1='P12M29D' dur2='P365D'/> + <date dur1='P1000Y' dur2='PT45.65S'/> + <date dur1='PT23H59M0S' dur2='PT59S'/> + <date dur1='PT23H59M0S' dur2='PT61S'/> + <date dur1='P1000Y11M30DT23H59M0.1S' dur2='PT59.9S'/> + <date dur1='P1000Y11M30DT23H59M1S' dur2='PT59S'/> + <date dur1='P1000Y11M30D' dur2='-P1DT9S'/> +</page> + diff --git a/libxslt/tests/exslt/date/add-duration.1.xsl b/libxslt/tests/exslt/date/add-duration.1.xsl new file mode 100644 index 0000000..70a7079 --- /dev/null +++ b/libxslt/tests/exslt/date/add-duration.1.xsl @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:date="http://exslt.org/dates-and-times" + extension-element-prefixes="date"> + +<xsl:output method="text"/> +<xsl:strip-space elements="*"/> + +<xsl:template match="date"> +add-duration : <xsl:value-of select="@dur1"/> + <xsl:value-of select="@dur2"/> +result : <xsl:value-of select="date:add-duration(@dur1,@dur2)"/> +</xsl:template> + +</xsl:stylesheet> + diff --git a/libxslt/tests/exslt/date/add-duration.2.out b/libxslt/tests/exslt/date/add-duration.2.out new file mode 100644 index 0000000..afd7ad7 --- /dev/null +++ b/libxslt/tests/exslt/date/add-duration.2.out @@ -0,0 +1,13 @@ + +add-duration : 2001 + -P1Y +result : +add-duration : P1M + 2000-01-01 +result : +add-duration : P11M30D + -P12M +result : +add-duration : P11M + -P12D +result : +add-duration : P1000Y11M + -PT9S +result : +add-duration : -P1000Y + PT9S +result :
\ No newline at end of file diff --git a/libxslt/tests/exslt/date/add-duration.2.xml b/libxslt/tests/exslt/date/add-duration.2.xml new file mode 100644 index 0000000..e306bef --- /dev/null +++ b/libxslt/tests/exslt/date/add-duration.2.xml @@ -0,0 +1,12 @@ +<?xml version="1.0"?> +<page> + <!-- invalid types --> + <date dur1='2001' dur2='-P1Y'/> + <date dur1='P1M' dur2='2000-01-01'/> + <!-- cannot express result --> + <date dur1='P11M30D' dur2='-P12M'/> + <date dur1='P11M' dur2='-P12D'/> + <date dur1='P1000Y11M' dur2='-PT9S'/> + <date dur1='-P1000Y' dur2='PT9S'/> +</page> + diff --git a/libxslt/tests/exslt/date/add-duration.2.xsl b/libxslt/tests/exslt/date/add-duration.2.xsl new file mode 100644 index 0000000..70a7079 --- /dev/null +++ b/libxslt/tests/exslt/date/add-duration.2.xsl @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:date="http://exslt.org/dates-and-times" + extension-element-prefixes="date"> + +<xsl:output method="text"/> +<xsl:strip-space elements="*"/> + +<xsl:template match="date"> +add-duration : <xsl:value-of select="@dur1"/> + <xsl:value-of select="@dur2"/> +result : <xsl:value-of select="date:add-duration(@dur1,@dur2)"/> +</xsl:template> + +</xsl:stylesheet> + diff --git a/libxslt/tests/exslt/date/add.1.out b/libxslt/tests/exslt/date/add.1.out new file mode 100644 index 0000000..47394ae --- /dev/null +++ b/libxslt/tests/exslt/date/add.1.out @@ -0,0 +1,31 @@ + +add : 2000-01-01T01:01:00Z + PT0S +result : 2000-01-01T01:01:00Z +add : 2000-01-01T01:01:00Z + PT60S +result : 2000-01-01T01:02:00Z +add : 2000-01-01T01:01:00Z + PT59S +result : 2000-01-01T01:01:59Z +add : 2000-01-01 + PT86400S +result : 2000-01-02 +add : 2000-02-29 + PT86400S +result : 2000-03-01 +add : 2000-01-01 + -PT86400S +result : 1999-12-31 +add : -0001-12-31T23:59:59 + PT1S +result : 0001-01-01T00:00:00Z +add : 0001-01-01T00:00:00 + -PT1S +result : -0001-12-31T23:59:59Z +add : 2000-01-01T00:00:00Z + -PT59S +result : 1999-12-31T23:59:01Z +add : -0001 + -PT59S +result : -0002-12-31T23:59:01Z +add : -0001 + P1Y +result : 0001 +add : 2000-01 + -PT86400S +result : 1999-12-31 +add : 2000-01 + -P1D +result : 1999-12-31 +add : 1970-01-01T00:00:00-00:30 + -PT30S +result : 1969-12-31T23:59:30-00:30 +add : 2016-04-28T18:02:44+02:00 + P1D +result : 2016-04-29T18:02:44+02:00
\ No newline at end of file diff --git a/libxslt/tests/exslt/date/add.1.xml b/libxslt/tests/exslt/date/add.1.xml new file mode 100644 index 0000000..5555747 --- /dev/null +++ b/libxslt/tests/exslt/date/add.1.xml @@ -0,0 +1,19 @@ +<?xml version="1.0"?> +<page> + <date date='2000-01-01T01:01:00Z' dur='PT0S'/> + <date date='2000-01-01T01:01:00Z' dur='PT60S'/> + <date date='2000-01-01T01:01:00Z' dur='PT59S'/> + <date date='2000-01-01' dur='PT86400S'/> + <date date='2000-02-29' dur='PT86400S'/> + <date date='2000-01-01' dur='-PT86400S'/> + <date date='-0001-12-31T23:59:59' dur='PT1S'/> + <date date='0001-01-01T00:00:00' dur='-PT1S'/> + <date date='2000-01-01T00:00:00Z' dur='-PT59S'/> + <date date='-0001' dur='-PT59S'/> + <date date='-0001' dur='P1Y'/> + <date date='2000-01' dur='-PT86400S'/> + <date date='2000-01' dur='-P1D'/> + <date date='1970-01-01T00:00:00-00:30' dur='-PT30S'/> + <date date='2016-04-28T18:02:44+02:00' dur='P1D'/> +</page> + diff --git a/libxslt/tests/exslt/date/add.1.xsl b/libxslt/tests/exslt/date/add.1.xsl new file mode 100644 index 0000000..cc7ab1c --- /dev/null +++ b/libxslt/tests/exslt/date/add.1.xsl @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:date="http://exslt.org/dates-and-times" + extension-element-prefixes="date"> + +<xsl:output method="text"/> +<xsl:strip-space elements="*"/> + +<xsl:template match="date"> +add : <xsl:value-of select="@date"/> + <xsl:value-of select="@dur"/> +result : <xsl:value-of select="date:add(@date,@dur)"/> +</xsl:template> + +</xsl:stylesheet> + diff --git a/libxslt/tests/exslt/date/add.2.out b/libxslt/tests/exslt/date/add.2.out new file mode 100644 index 0000000..82bfe9d --- /dev/null +++ b/libxslt/tests/exslt/date/add.2.out @@ -0,0 +1,13 @@ + +add : PT0S + 2000-01-01T01:01:00Z +result : +add : 2000-01-01T01:01:00Z + +result : +add : + PT60S +result : +add : --10-29 + PT60S +result : +add : ---29 + PT60S +result : +add : 10:31:07 + PT60S +result :
\ No newline at end of file diff --git a/libxslt/tests/exslt/date/add.2.xml b/libxslt/tests/exslt/date/add.2.xml new file mode 100644 index 0000000..2b8c84c --- /dev/null +++ b/libxslt/tests/exslt/date/add.2.xml @@ -0,0 +1,12 @@ +<?xml version="1.0"?> +<page> + <!-- invalid arguments --> + <date date='PT0S' dur='2000-01-01T01:01:00Z'/> + <date date='2000-01-01T01:01:00Z' dur=''/> + <date date='' dur='PT60S'/> + <!-- invalid date/time types --> + <date date="--10-29" dur="PT60S"/> + <date date="---29" dur="PT60S"/> + <date date="10:31:07" dur="PT60S"/> +</page> + diff --git a/libxslt/tests/exslt/date/add.2.xsl b/libxslt/tests/exslt/date/add.2.xsl new file mode 100644 index 0000000..cc7ab1c --- /dev/null +++ b/libxslt/tests/exslt/date/add.2.xsl @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:date="http://exslt.org/dates-and-times" + extension-element-prefixes="date"> + +<xsl:output method="text"/> +<xsl:strip-space elements="*"/> + +<xsl:template match="date"> +add : <xsl:value-of select="@date"/> + <xsl:value-of select="@dur"/> +result : <xsl:value-of select="date:add(@date,@dur)"/> +</xsl:template> + +</xsl:stylesheet> + diff --git a/libxslt/tests/exslt/date/current.xsl b/libxslt/tests/exslt/date/current.xsl new file mode 100644 index 0000000..4cbe7bf --- /dev/null +++ b/libxslt/tests/exslt/date/current.xsl @@ -0,0 +1,47 @@ +<?xml version="1.0"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:date="http://exslt.org/dates-and-times"
+ extension-element-prefixes="date">
+
+<xsl:output method="text"/>
+
+<xsl:template match="/">
+ <xsl:message>Current Date : <xsl:value-of select="date:date-time()"/>
+ <!-- dateTime, date, gYearMonth or gYear; else NaN -->
+ year : <xsl:value-of select="date:year()"/>
+ <!-- dateTime, date, gYearMonth or gYear; else NaN -->
+ leap-year : <xsl:value-of select="date:leap-year()"/>
+ <!-- dateTime, date, gYearMonth, gMonth or gMonthDay; else NaN -->
+ month-in-year : <xsl:value-of select="date:month-in-year()"/>
+ <!-- dateTime, date, gYearMonth or gMonth; else '' -->
+ month-name : <xsl:value-of select="date:month-name()"/>
+ <!-- dateTime, date, gYearMonth or gMonth; else '' -->
+ month-abbreviation : <xsl:value-of select="date:month-abbreviation()"/>
+ <!-- dateTime or date; else NaN -->
+ week-in-year : <xsl:value-of select="date:week-in-year()"/>
+ <!-- dateTime, date; else NaN -->
+ day-in-year : <xsl:value-of select="date:day-in-year()"/>
+ <!-- dateTime, date, gMonthDay or gDay; else NaN -->
+ day-in-month : <xsl:value-of select="date:day-in-month()"/>
+ <!-- dateTime, date; else NaN -->
+ day-of-week-in-month : <xsl:value-of select="date:day-of-week-in-month()"/>
+ <!-- dateTime, date; else NaN -->
+ day-in-week : <xsl:value-of select="date:day-in-week()"/>
+ <!-- dateTime or date; else NaN -->
+ day-name : <xsl:value-of select="date:day-name()"/>
+ <!-- dateTime or date; else NaN -->
+ day-abbreviation : <xsl:value-of select="date:day-abbreviation()"/>
+ <!-- dateTime or time; else '' -->
+ time : <xsl:value-of select="date:time()"/>
+ <!-- dateTime or time; else NaN -->
+ hour-in-day : <xsl:value-of select="date:hour-in-day()"/>
+ <!-- dateTime or time; else NaN -->
+ minute-in-hour : <xsl:value-of select="date:minute-in-hour()"/>
+ <!-- dateTime or time; else NaN -->
+ second-in-minute : <xsl:value-of select="date:second-in-minute()"/>
+ </xsl:message>
+</xsl:template>
+
+</xsl:stylesheet>
+
diff --git a/libxslt/tests/exslt/date/date.1.out b/libxslt/tests/exslt/date/date.1.out new file mode 100644 index 0000000..f22546c --- /dev/null +++ b/libxslt/tests/exslt/date/date.1.out @@ -0,0 +1,182 @@ + + + + Test Date : 0001-12-31Z + year : 1 + leap-year : false + month-in-year : 12 + month-name : December + month-abbreviation : Dec + week-in-year : 1 + day-in-year : 365 + day-in-month : 31 + day-of-week-in-month : 5 + day-in-week : 2 + day-name : Monday + day-abbreviation : Mon + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : 3000-01-31 + year : 3000 + leap-year : false + month-in-year : 1 + month-name : January + month-abbreviation : Jan + week-in-year : 5 + day-in-year : 31 + day-in-month : 31 + day-of-week-in-month : 5 + day-in-week : 6 + day-name : Friday + day-abbreviation : Fri + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : 2000-02-29 + year : 2000 + leap-year : true + month-in-year : 2 + month-name : February + month-abbreviation : Feb + week-in-year : 9 + day-in-year : 60 + day-in-month : 29 + day-of-week-in-month : 5 + day-in-week : 3 + day-name : Tuesday + day-abbreviation : Tue + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : 9990001-12-31Z + year : 9990001 + leap-year : false + month-in-year : 12 + month-name : December + month-abbreviation : Dec + week-in-year : 1 + day-in-year : 365 + day-in-month : 31 + day-of-week-in-month : 5 + day-in-week : 2 + day-name : Monday + day-abbreviation : Mon + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : -0004-02-29 + year : -4 + leap-year : true + month-in-year : 2 + month-name : February + month-abbreviation : Feb + week-in-year : 9 + day-in-year : 60 + day-in-month : 29 + day-of-week-in-month : 5 + day-in-week : 1 + day-name : Sunday + day-abbreviation : Sun + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : 1999-01-02 + year : 1999 + leap-year : false + month-in-year : 1 + month-name : January + month-abbreviation : Jan + week-in-year : 53 + day-in-year : 2 + day-in-month : 2 + day-of-week-in-month : 1 + day-in-week : 7 + day-name : Saturday + day-abbreviation : Sat + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : 1999-01-03 + year : 1999 + leap-year : false + month-in-year : 1 + month-name : January + month-abbreviation : Jan + week-in-year : 53 + day-in-year : 3 + day-in-month : 3 + day-of-week-in-month : 1 + day-in-week : 1 + day-name : Sunday + day-abbreviation : Sun + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : 2004-01-01 + year : 2004 + leap-year : true + month-in-year : 1 + month-name : January + month-abbreviation : Jan + week-in-year : 1 + day-in-year : 1 + day-in-month : 1 + day-of-week-in-month : 1 + day-in-week : 5 + day-name : Thursday + day-abbreviation : Thu + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : 2006-01-01 + year : 2006 + leap-year : false + month-in-year : 1 + month-name : January + month-abbreviation : Jan + week-in-year : 52 + day-in-year : 1 + day-in-month : 1 + day-of-week-in-month : 1 + day-in-week : 1 + day-name : Sunday + day-abbreviation : Sun + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : 2007-12-31 + year : 2007 + leap-year : false + month-in-year : 12 + month-name : December + month-abbreviation : Dec + week-in-year : 1 + day-in-year : 365 + day-in-month : 31 + day-of-week-in-month : 5 + day-in-week : 2 + day-name : Monday + day-abbreviation : Mon + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN diff --git a/libxslt/tests/exslt/date/date.1.xml b/libxslt/tests/exslt/date/date.1.xml new file mode 100644 index 0000000..562e08e --- /dev/null +++ b/libxslt/tests/exslt/date/date.1.xml @@ -0,0 +1,15 @@ +<?xml version="1.0"?> +<page> + <!-- valid xs:date --> + <date date="0001-12-31Z"/> + <date date="3000-01-31"/> + <date date="2000-02-29"/> + <date date="9990001-12-31Z"/> + <date date="-0004-02-29"/> + <date date="1999-01-02"/> + <date date="1999-01-03"/> + <date date="2004-01-01"/> + <date date="2006-01-01"/> + <date date="2007-12-31"/> +</page> + diff --git a/libxslt/tests/exslt/date/date.1.xsl b/libxslt/tests/exslt/date/date.1.xsl new file mode 100644 index 0000000..06ffd8d --- /dev/null +++ b/libxslt/tests/exslt/date/date.1.xsl @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="ISO-8859-1"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:date="http://exslt.org/dates-and-times"
+ extension-element-prefixes="date">
+
+<xsl:output method="text"/>
+
+<xsl:template match="date">
+ Test Date : <xsl:value-of select="@date"/>
+ <!-- dateTime, date, gYearMonth or gYear; else NaN -->
+ year : <xsl:value-of select="date:year(@date)"/>
+ <!-- dateTime, date, gYearMonth or gYear; else NaN -->
+ leap-year : <xsl:value-of select="date:leap-year(@date)"/>
+ <!-- dateTime, date, gYearMonth, gMonth or gMonthDay; else NaN -->
+ month-in-year : <xsl:value-of select="date:month-in-year(@date)"/>
+ <!-- dateTime, date, gYearMonth or gMonth; else '' -->
+ month-name : <xsl:value-of select="date:month-name(@date)"/>
+ <!-- dateTime, date, gYearMonth or gMonth; else '' -->
+ month-abbreviation : <xsl:value-of select="date:month-abbreviation(@date)"/>
+ <!-- dateTime or date; else NaN -->
+ week-in-year : <xsl:value-of select="date:week-in-year(@date)"/>
+ <!-- dateTime, date; else NaN -->
+ day-in-year : <xsl:value-of select="date:day-in-year(@date)"/>
+ <!-- dateTime, date, gMonthDay or gDay; else NaN -->
+ day-in-month : <xsl:value-of select="date:day-in-month(@date)"/>
+ <!-- dateTime, date; else NaN -->
+ day-of-week-in-month : <xsl:value-of select="date:day-of-week-in-month(@date)"/>
+ <!-- dateTime, date; else NaN -->
+ day-in-week : <xsl:value-of select="date:day-in-week(@date)"/>
+ <!-- dateTime or date; else NaN -->
+ day-name : <xsl:value-of select="date:day-name(@date)"/>
+ <!-- dateTime or date; else NaN -->
+ day-abbreviation : <xsl:value-of select="date:day-abbreviation(@date)"/>
+ <!-- dateTime or time; else '' -->
+ time : <xsl:value-of select="date:time(@date)"/>
+ <!-- dateTime or time; else NaN -->
+ hour-in-day : <xsl:value-of select="date:hour-in-day(@date)"/>
+ <!-- dateTime or time; else NaN -->
+ minute-in-hour : <xsl:value-of select="date:minute-in-hour(@date)"/>
+ <!-- dateTime or time; else NaN -->
+ second-in-minute : <xsl:value-of select="date:second-in-minute(@date)"/>
+</xsl:template>
+
+</xsl:stylesheet>
+
diff --git a/libxslt/tests/exslt/date/date.2.out b/libxslt/tests/exslt/date/date.2.out new file mode 100644 index 0000000..7c7c4cd --- /dev/null +++ b/libxslt/tests/exslt/date/date.2.out @@ -0,0 +1,129 @@ + + + + Test Date : -1-01-31 + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : +1-01-31 + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + + Test Date : 0001-12-32Z + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : 0001-13-01 + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : 0001-11-00 + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : 0001-99-01 + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : 0001-01-99 + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN diff --git a/libxslt/tests/exslt/date/date.2.xml b/libxslt/tests/exslt/date/date.2.xml new file mode 100644 index 0000000..2b0fb9a --- /dev/null +++ b/libxslt/tests/exslt/date/date.2.xml @@ -0,0 +1,13 @@ +<?xml version="1.0"?>
+<page>
+ <!-- invalid xs:date syntax -->
+ <date date="-1-01-31"/>
+ <date date="+1-01-31"/>
+ <!-- invalid xs:date values -->
+ <date date="0001-12-32Z"/>
+ <date date="0001-13-01"/>
+ <date date="0001-11-00"/>
+ <date date="0001-99-01"/>
+ <date date="0001-01-99"/>
+</page>
+
diff --git a/libxslt/tests/exslt/date/date.2.xsl b/libxslt/tests/exslt/date/date.2.xsl new file mode 100644 index 0000000..06ffd8d --- /dev/null +++ b/libxslt/tests/exslt/date/date.2.xsl @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="ISO-8859-1"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:date="http://exslt.org/dates-and-times"
+ extension-element-prefixes="date">
+
+<xsl:output method="text"/>
+
+<xsl:template match="date">
+ Test Date : <xsl:value-of select="@date"/>
+ <!-- dateTime, date, gYearMonth or gYear; else NaN -->
+ year : <xsl:value-of select="date:year(@date)"/>
+ <!-- dateTime, date, gYearMonth or gYear; else NaN -->
+ leap-year : <xsl:value-of select="date:leap-year(@date)"/>
+ <!-- dateTime, date, gYearMonth, gMonth or gMonthDay; else NaN -->
+ month-in-year : <xsl:value-of select="date:month-in-year(@date)"/>
+ <!-- dateTime, date, gYearMonth or gMonth; else '' -->
+ month-name : <xsl:value-of select="date:month-name(@date)"/>
+ <!-- dateTime, date, gYearMonth or gMonth; else '' -->
+ month-abbreviation : <xsl:value-of select="date:month-abbreviation(@date)"/>
+ <!-- dateTime or date; else NaN -->
+ week-in-year : <xsl:value-of select="date:week-in-year(@date)"/>
+ <!-- dateTime, date; else NaN -->
+ day-in-year : <xsl:value-of select="date:day-in-year(@date)"/>
+ <!-- dateTime, date, gMonthDay or gDay; else NaN -->
+ day-in-month : <xsl:value-of select="date:day-in-month(@date)"/>
+ <!-- dateTime, date; else NaN -->
+ day-of-week-in-month : <xsl:value-of select="date:day-of-week-in-month(@date)"/>
+ <!-- dateTime, date; else NaN -->
+ day-in-week : <xsl:value-of select="date:day-in-week(@date)"/>
+ <!-- dateTime or date; else NaN -->
+ day-name : <xsl:value-of select="date:day-name(@date)"/>
+ <!-- dateTime or date; else NaN -->
+ day-abbreviation : <xsl:value-of select="date:day-abbreviation(@date)"/>
+ <!-- dateTime or time; else '' -->
+ time : <xsl:value-of select="date:time(@date)"/>
+ <!-- dateTime or time; else NaN -->
+ hour-in-day : <xsl:value-of select="date:hour-in-day(@date)"/>
+ <!-- dateTime or time; else NaN -->
+ minute-in-hour : <xsl:value-of select="date:minute-in-hour(@date)"/>
+ <!-- dateTime or time; else NaN -->
+ second-in-minute : <xsl:value-of select="date:second-in-minute(@date)"/>
+</xsl:template>
+
+</xsl:stylesheet>
+
diff --git a/libxslt/tests/exslt/date/datetime.1.out b/libxslt/tests/exslt/date/datetime.1.out new file mode 100644 index 0000000..c0b4c53 --- /dev/null +++ b/libxslt/tests/exslt/date/datetime.1.out @@ -0,0 +1,92 @@ + + + + Test Date : 2001-02-28T10:31:07 + year : 2001 + leap-year : false + month-in-year : 2 + month-name : February + month-abbreviation : Feb + week-in-year : 9 + day-in-year : 59 + day-in-month : 28 + day-of-week-in-month : 4 + day-in-week : 4 + day-name : Wednesday + day-abbreviation : Wed + time : 10:31:07 + hour-in-day : 10 + minute-in-hour : 31 + second-in-minute : 7 + + Test Date : 0001-12-31T23:59:59.1234-05:00 + year : 1 + leap-year : false + month-in-year : 12 + month-name : December + month-abbreviation : Dec + week-in-year : 1 + day-in-year : 365 + day-in-month : 31 + day-of-week-in-month : 5 + day-in-week : 2 + day-name : Monday + day-abbreviation : Mon + time : 23:59:59.1234-05:00 + hour-in-day : 23 + minute-in-hour : 59 + second-in-minute : 59.1234 + + Test Date : -0001-12-31T23:59:59-05:00 + year : -1 + leap-year : false + month-in-year : 12 + month-name : December + month-abbreviation : Dec + week-in-year : 52 + day-in-year : 365 + day-in-month : 31 + day-of-week-in-month : 5 + day-in-week : 1 + day-name : Sunday + day-abbreviation : Sun + time : 23:59:59-05:00 + hour-in-day : 23 + minute-in-hour : 59 + second-in-minute : 59 + + Test Date : 10000-12-31T23:59:59.9901Z + year : 10000 + leap-year : true + month-in-year : 12 + month-name : December + month-abbreviation : Dec + week-in-year : 52 + day-in-year : 366 + day-in-month : 31 + day-of-week-in-month : 5 + day-in-week : 1 + day-name : Sunday + day-abbreviation : Sun + time : 23:59:59.9901Z + hour-in-day : 23 + minute-in-hour : 59 + second-in-minute : 59.9901 + + Test Date : -10000-12-31T23:59:59Z + year : -10000 + leap-year : true + month-in-year : 12 + month-name : December + month-abbreviation : Dec + week-in-year : 1 + day-in-year : 366 + day-in-month : 31 + day-of-week-in-month : 5 + day-in-week : 4 + day-name : Wednesday + day-abbreviation : Wed + time : 23:59:59Z + hour-in-day : 23 + minute-in-hour : 59 + second-in-minute : 59 diff --git a/libxslt/tests/exslt/date/datetime.1.xml b/libxslt/tests/exslt/date/datetime.1.xml new file mode 100644 index 0000000..bbbf23d --- /dev/null +++ b/libxslt/tests/exslt/date/datetime.1.xml @@ -0,0 +1,10 @@ +<?xml version="1.0"?>
+<page>
+ <!-- valid xs:dateTime -->
+ <date date="2001-02-28T10:31:07"/>
+ <date date='0001-12-31T23:59:59.1234-05:00'/>
+ <date date='-0001-12-31T23:59:59-05:00'/>
+ <date date='10000-12-31T23:59:59.9901Z'/>
+ <date date='-10000-12-31T23:59:59Z'/>
+</page>
+
diff --git a/libxslt/tests/exslt/date/datetime.1.xsl b/libxslt/tests/exslt/date/datetime.1.xsl new file mode 100644 index 0000000..06ffd8d --- /dev/null +++ b/libxslt/tests/exslt/date/datetime.1.xsl @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="ISO-8859-1"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:date="http://exslt.org/dates-and-times"
+ extension-element-prefixes="date">
+
+<xsl:output method="text"/>
+
+<xsl:template match="date">
+ Test Date : <xsl:value-of select="@date"/>
+ <!-- dateTime, date, gYearMonth or gYear; else NaN -->
+ year : <xsl:value-of select="date:year(@date)"/>
+ <!-- dateTime, date, gYearMonth or gYear; else NaN -->
+ leap-year : <xsl:value-of select="date:leap-year(@date)"/>
+ <!-- dateTime, date, gYearMonth, gMonth or gMonthDay; else NaN -->
+ month-in-year : <xsl:value-of select="date:month-in-year(@date)"/>
+ <!-- dateTime, date, gYearMonth or gMonth; else '' -->
+ month-name : <xsl:value-of select="date:month-name(@date)"/>
+ <!-- dateTime, date, gYearMonth or gMonth; else '' -->
+ month-abbreviation : <xsl:value-of select="date:month-abbreviation(@date)"/>
+ <!-- dateTime or date; else NaN -->
+ week-in-year : <xsl:value-of select="date:week-in-year(@date)"/>
+ <!-- dateTime, date; else NaN -->
+ day-in-year : <xsl:value-of select="date:day-in-year(@date)"/>
+ <!-- dateTime, date, gMonthDay or gDay; else NaN -->
+ day-in-month : <xsl:value-of select="date:day-in-month(@date)"/>
+ <!-- dateTime, date; else NaN -->
+ day-of-week-in-month : <xsl:value-of select="date:day-of-week-in-month(@date)"/>
+ <!-- dateTime, date; else NaN -->
+ day-in-week : <xsl:value-of select="date:day-in-week(@date)"/>
+ <!-- dateTime or date; else NaN -->
+ day-name : <xsl:value-of select="date:day-name(@date)"/>
+ <!-- dateTime or date; else NaN -->
+ day-abbreviation : <xsl:value-of select="date:day-abbreviation(@date)"/>
+ <!-- dateTime or time; else '' -->
+ time : <xsl:value-of select="date:time(@date)"/>
+ <!-- dateTime or time; else NaN -->
+ hour-in-day : <xsl:value-of select="date:hour-in-day(@date)"/>
+ <!-- dateTime or time; else NaN -->
+ minute-in-hour : <xsl:value-of select="date:minute-in-hour(@date)"/>
+ <!-- dateTime or time; else NaN -->
+ second-in-minute : <xsl:value-of select="date:second-in-minute(@date)"/>
+</xsl:template>
+
+</xsl:stylesheet>
+
diff --git a/libxslt/tests/exslt/date/datetime.2.out b/libxslt/tests/exslt/date/datetime.2.out new file mode 100644 index 0000000..7f76ed8 --- /dev/null +++ b/libxslt/tests/exslt/date/datetime.2.out @@ -0,0 +1,309 @@ + + + + Test Date : 2001-02-2810:31:07 + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : 2001-02-2810:31:07Z + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : 2001-02-28t10:31:07 + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : 2001-02-28T10:31:07z + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : 02001-02-28T10-31-07 + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : 2001-02-2810:31:07-6:00 + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : 2001-02-2810:31:07-06:00Z + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : 01-02-28T10:31:07 + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : 02001-02-28T10:31:07 + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : -001-02-28T10:31:07Z + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : 2001-2-28T10:31:07-06:00 + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : 2001-02-2T10:31:07-06:00 + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : 2001-02-28T1:31:07-06:00 + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : 2001-02-28T10:1:07-06:00 + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : 2001-02-28T10:31:7-06:00 + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : 2001-02-28T10:31:07-06 + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + + Test Date : 2001-02-29T10:31:07Z + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN diff --git a/libxslt/tests/exslt/date/datetime.2.xml b/libxslt/tests/exslt/date/datetime.2.xml new file mode 100644 index 0000000..abf2752 --- /dev/null +++ b/libxslt/tests/exslt/date/datetime.2.xml @@ -0,0 +1,22 @@ +<?xml version="1.0"?>
+<page>
+ <!-- invalid xs:dateTime syntax -->
+ <date date="2001-02-2810:31:07"/>
+ <date date="2001-02-2810:31:07Z"/>
+ <date date="2001-02-28t10:31:07"/>
+ <date date="2001-02-28T10:31:07z"/>
+ <date date="02001-02-28T10-31-07"/>
+ <date date="2001-02-2810:31:07-6:00"/>
+ <date date="2001-02-2810:31:07-06:00Z"/>
+ <date date="01-02-28T10:31:07"/>
+ <date date="02001-02-28T10:31:07"/>
+ <date date="-001-02-28T10:31:07Z"/>
+ <date date="2001-2-28T10:31:07-06:00"/>
+ <date date="2001-02-2T10:31:07-06:00"/>
+ <date date="2001-02-28T1:31:07-06:00"/>
+ <date date="2001-02-28T10:1:07-06:00"/>
+ <date date="2001-02-28T10:31:7-06:00"/>
+ <date date="2001-02-28T10:31:07-06"/>
+ <!-- invalid xs:dateTime values -->
+ <date date="2001-02-29T10:31:07Z"/>
+</page>
diff --git a/libxslt/tests/exslt/date/datetime.2.xsl b/libxslt/tests/exslt/date/datetime.2.xsl new file mode 100644 index 0000000..06ffd8d --- /dev/null +++ b/libxslt/tests/exslt/date/datetime.2.xsl @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="ISO-8859-1"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:date="http://exslt.org/dates-and-times"
+ extension-element-prefixes="date">
+
+<xsl:output method="text"/>
+
+<xsl:template match="date">
+ Test Date : <xsl:value-of select="@date"/>
+ <!-- dateTime, date, gYearMonth or gYear; else NaN -->
+ year : <xsl:value-of select="date:year(@date)"/>
+ <!-- dateTime, date, gYearMonth or gYear; else NaN -->
+ leap-year : <xsl:value-of select="date:leap-year(@date)"/>
+ <!-- dateTime, date, gYearMonth, gMonth or gMonthDay; else NaN -->
+ month-in-year : <xsl:value-of select="date:month-in-year(@date)"/>
+ <!-- dateTime, date, gYearMonth or gMonth; else '' -->
+ month-name : <xsl:value-of select="date:month-name(@date)"/>
+ <!-- dateTime, date, gYearMonth or gMonth; else '' -->
+ month-abbreviation : <xsl:value-of select="date:month-abbreviation(@date)"/>
+ <!-- dateTime or date; else NaN -->
+ week-in-year : <xsl:value-of select="date:week-in-year(@date)"/>
+ <!-- dateTime, date; else NaN -->
+ day-in-year : <xsl:value-of select="date:day-in-year(@date)"/>
+ <!-- dateTime, date, gMonthDay or gDay; else NaN -->
+ day-in-month : <xsl:value-of select="date:day-in-month(@date)"/>
+ <!-- dateTime, date; else NaN -->
+ day-of-week-in-month : <xsl:value-of select="date:day-of-week-in-month(@date)"/>
+ <!-- dateTime, date; else NaN -->
+ day-in-week : <xsl:value-of select="date:day-in-week(@date)"/>
+ <!-- dateTime or date; else NaN -->
+ day-name : <xsl:value-of select="date:day-name(@date)"/>
+ <!-- dateTime or date; else NaN -->
+ day-abbreviation : <xsl:value-of select="date:day-abbreviation(@date)"/>
+ <!-- dateTime or time; else '' -->
+ time : <xsl:value-of select="date:time(@date)"/>
+ <!-- dateTime or time; else NaN -->
+ hour-in-day : <xsl:value-of select="date:hour-in-day(@date)"/>
+ <!-- dateTime or time; else NaN -->
+ minute-in-hour : <xsl:value-of select="date:minute-in-hour(@date)"/>
+ <!-- dateTime or time; else NaN -->
+ second-in-minute : <xsl:value-of select="date:second-in-minute(@date)"/>
+</xsl:template>
+
+</xsl:stylesheet>
+
diff --git a/libxslt/tests/exslt/date/difference.1.out b/libxslt/tests/exslt/date/difference.1.out new file mode 100644 index 0000000..bcafa2b --- /dev/null +++ b/libxslt/tests/exslt/date/difference.1.out @@ -0,0 +1,37 @@ + +difference : 2000 - 1999 +result : -P1Y +difference : 2000-01 - 1999-12 +result : -P1M +difference : 1999-12 - 2000-01 +result : P1M +difference : 1999-12-31 - 2000-01-01 +result : P1D +difference : 1999 - 2000-01 +result : P1Y +difference : 0002-01-05 - 0001-01-04 +result : -P366D +difference : 0002-05-05 - 0001-01 +result : -P1Y4M +difference : -0002-01-05 - 0001-01-04 +result : P729D +difference : 1970-01-01T05:04:03 - 1970-01-01T04:03:02 +result : -PT1H1M1S +difference : 2000-01-01T05:00:03 - 2000-01-01T04:03:02 +result : -PT57M1S +difference : 2000-01-01T05:00:03 - 1980-01-01T04:03:02 +result : -P7305DT57M1S +difference : 1970-01-01T04:03:02 - 1970-01-01T05:04:03 +result : PT1H1M1S +difference : 2000-01-01T04:03:02 - 2000-01-01T05:00:03 +result : PT57M1S +difference : 1980-01-01T04:03:02 - 2000-01-01T05:00:03 +result : P7305DT57M1S +difference : 2002-05-02T23:59:59 - 2002-05-03T00:00:01 +result : PT2S +difference : 2002-05-03T00:00:01 - 2002-05-02T23:59:59 +result : -PT2S +difference : 2000-01-02T05:00:03 - 2000-01-01T04:03:02 +result : -P1DT57M1S +difference : 2016-04-28T17:59:30+02:00 - 2016-04-28T17:59:30+04:00 +result : -PT2H
\ No newline at end of file diff --git a/libxslt/tests/exslt/date/difference.1.xml b/libxslt/tests/exslt/date/difference.1.xml new file mode 100644 index 0000000..ca897c0 --- /dev/null +++ b/libxslt/tests/exslt/date/difference.1.xml @@ -0,0 +1,27 @@ +<?xml version="1.0"?> +<page> + <!-- valid date/times --> + <date date1='2000' date2='1999'/> + <date date1='2000-01' date2='1999-12'/> + <date date1='1999-12' date2='2000-01'/> + <date date1='1999-12-31' date2='2000-01-01'/> + <date date1='1999' date2='2000-01'/> + <date date1='0002-01-05' date2='0001-01-04'/> + <date date1='0002-05-05' date2='0001-01'/> + <date date1='-0002-01-05' date2='0001-01-04'/> + <date date1='1970-01-01T05:04:03' date2='1970-01-01T04:03:02'/> + <date date1='2000-01-01T05:00:03' date2='2000-01-01T04:03:02'/> + <date date1='2000-01-01T05:00:03' date2='1980-01-01T04:03:02'/> + <!-- from bug #93444 --> + <date date2='1970-01-01T05:04:03' date1='1970-01-01T04:03:02'/> + <date date2='2000-01-01T05:00:03' date1='2000-01-01T04:03:02'/> + <date date2='2000-01-01T05:00:03' date1='1980-01-01T04:03:02'/> + <!-- from bug #92818 --> + <date date1='2002-05-02T23:59:59' date2='2002-05-03T00:00:01'/> + <date date2='2002-05-02T23:59:59' date1='2002-05-03T00:00:01'/> + <!-- result should be negative --> + <date date1='2000-01-02T05:00:03' date2='2000-01-01T04:03:02'/> + <!-- with timezone --> + <date date1='2016-04-28T17:59:30+02:00' date2='2016-04-28T17:59:30+04:00'/> +</page> + diff --git a/libxslt/tests/exslt/date/difference.1.xsl b/libxslt/tests/exslt/date/difference.1.xsl new file mode 100644 index 0000000..f0d0f48 --- /dev/null +++ b/libxslt/tests/exslt/date/difference.1.xsl @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:date="http://exslt.org/dates-and-times" + extension-element-prefixes="date"> + +<xsl:output method="text"/> +<xsl:strip-space elements="*"/> + +<xsl:template match="date"> +difference : <xsl:value-of select="@date1"/> - <xsl:value-of select="@date2"/> +result : <xsl:value-of select="date:difference(@date1,@date2)"/> +</xsl:template> + +</xsl:stylesheet> + diff --git a/libxslt/tests/exslt/date/difference.2.out b/libxslt/tests/exslt/date/difference.2.out new file mode 100644 index 0000000..343cd3d --- /dev/null +++ b/libxslt/tests/exslt/date/difference.2.out @@ -0,0 +1,9 @@ + +difference : 2000-01-01T05:00:03 - ---01 +result : +difference : 0002-01-05 - --01-04 +result : +difference : 1970-01-01T05:04:03 - 04:03:02 +result : +difference : 2000 - +result :
\ No newline at end of file diff --git a/libxslt/tests/exslt/date/difference.2.xml b/libxslt/tests/exslt/date/difference.2.xml new file mode 100644 index 0000000..de58d26 --- /dev/null +++ b/libxslt/tests/exslt/date/difference.2.xml @@ -0,0 +1,9 @@ +<?xml version="1.0"?> +<page> + <!-- invalid date/time types --> + <date date1='2000-01-01T05:00:03' date2='---01'/> + <date date1='0002-01-05' date2='--01-04'/> + <date date1='1970-01-01T05:04:03' date2='04:03:02'/> + <date date1='2000' date2=''/> +</page> + diff --git a/libxslt/tests/exslt/date/difference.2.xsl b/libxslt/tests/exslt/date/difference.2.xsl new file mode 100644 index 0000000..f0d0f48 --- /dev/null +++ b/libxslt/tests/exslt/date/difference.2.xsl @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:date="http://exslt.org/dates-and-times" + extension-element-prefixes="date"> + +<xsl:output method="text"/> +<xsl:strip-space elements="*"/> + +<xsl:template match="date"> +difference : <xsl:value-of select="@date1"/> - <xsl:value-of select="@date2"/> +result : <xsl:value-of select="date:difference(@date1,@date2)"/> +</xsl:template> + +</xsl:stylesheet> + diff --git a/libxslt/tests/exslt/date/duration.1.out b/libxslt/tests/exslt/date/duration.1.out new file mode 100644 index 0000000..2424c96 --- /dev/null +++ b/libxslt/tests/exslt/date/duration.1.out @@ -0,0 +1,29 @@ + +duration : 60 +result : PT1M +duration : 360 +result : PT6M +duration : 3600 +result : PT1H +duration : 86400 +result : P1D +duration : 86400.5 +result : P1DT0.5S +duration : 3660 +result : PT1H1M +duration : 61 +result : PT1M1S +duration : 90061 +result : P1DT1H1M1S +duration : 0.5 +result : PT0.5S +duration : 0.05 +result : PT0.05S +duration : 990.005 +result : PT16M30.005S +duration : -60 +result : -PT1M +duration : 9999999999999 +result : P115740740DT17H46M39S +duration : -2999999999 +result : -P34722DT5H19M59S
\ No newline at end of file diff --git a/libxslt/tests/exslt/date/duration.1.xml b/libxslt/tests/exslt/date/duration.1.xml new file mode 100644 index 0000000..dd35845 --- /dev/null +++ b/libxslt/tests/exslt/date/duration.1.xml @@ -0,0 +1,18 @@ +<?xml version="1.0"?> +<page> + <date seconds="60"/> + <date seconds="360"/> + <date seconds="3600"/> + <date seconds="86400"/> + <date seconds="86400.5"/> + <date seconds="3660"/> + <date seconds="61"/> + <date seconds="90061"/> + <date seconds="0.5"/> + <date seconds="0.05"/> + <date seconds="990.005"/> + <date seconds="-60"/> + <date seconds="9999999999999"/> + <date seconds="-2999999999"/> +</page> + diff --git a/libxslt/tests/exslt/date/duration.1.xsl b/libxslt/tests/exslt/date/duration.1.xsl new file mode 100644 index 0000000..a481b1f --- /dev/null +++ b/libxslt/tests/exslt/date/duration.1.xsl @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:date="http://exslt.org/dates-and-times" + extension-element-prefixes="date"> + +<xsl:output method="text"/> +<xsl:strip-space elements="*"/> + +<xsl:template match="date"> +duration : <xsl:value-of select="@seconds"/> +result : <xsl:value-of select="date:duration(@seconds)"/> +</xsl:template> + +</xsl:stylesheet> + diff --git a/libxslt/tests/exslt/date/duration.2.out b/libxslt/tests/exslt/date/duration.2.out new file mode 100644 index 0000000..688b176 --- /dev/null +++ b/libxslt/tests/exslt/date/duration.2.out @@ -0,0 +1,15 @@ + +duration : P10Y20M100DT +result : +duration : P-10Y +result : +duration : P10YM100D +result : +duration : P10Y100D10M +result : +duration : P10Y10H +result : +duration : P10Y10Y +result : +duration : P10.0Y +result :
\ No newline at end of file diff --git a/libxslt/tests/exslt/date/duration.2.xml b/libxslt/tests/exslt/date/duration.2.xml new file mode 100644 index 0000000..5bc250e --- /dev/null +++ b/libxslt/tests/exslt/date/duration.2.xml @@ -0,0 +1,12 @@ +<?xml version="1.0"?> +<page> + <!-- errors --> + <date seconds="P10Y20M100DT"/> + <date seconds="P-10Y"/> + <date seconds="P10YM100D"/> + <date seconds="P10Y100D10M"/> + <date seconds="P10Y10H"/> + <date seconds="P10Y10Y"/> + <date seconds="P10.0Y"/> +</page> + diff --git a/libxslt/tests/exslt/date/duration.2.xsl b/libxslt/tests/exslt/date/duration.2.xsl new file mode 100644 index 0000000..a481b1f --- /dev/null +++ b/libxslt/tests/exslt/date/duration.2.xsl @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:date="http://exslt.org/dates-and-times" + extension-element-prefixes="date"> + +<xsl:output method="text"/> +<xsl:strip-space elements="*"/> + +<xsl:template match="date"> +duration : <xsl:value-of select="@seconds"/> +result : <xsl:value-of select="date:duration(@seconds)"/> +</xsl:template> + +</xsl:stylesheet> + diff --git a/libxslt/tests/exslt/date/gday.1.out b/libxslt/tests/exslt/date/gday.1.out new file mode 100644 index 0000000..ccb5340 --- /dev/null +++ b/libxslt/tests/exslt/date/gday.1.out @@ -0,0 +1,74 @@ + + + + Test Date : ---11 + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : 11 + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : ---31 + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : 31 + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : ---01 + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : 1 + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : ---25 + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : 25 + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN diff --git a/libxslt/tests/exslt/date/gday.1.xml b/libxslt/tests/exslt/date/gday.1.xml new file mode 100644 index 0000000..e8308e7 --- /dev/null +++ b/libxslt/tests/exslt/date/gday.1.xml @@ -0,0 +1,9 @@ +<?xml version="1.0"?>
+<page>
+ <!-- valid xs:gDay -->
+ <date date="---11"/>
+ <date date="---31"/>
+ <date date="---01"/>
+ <date date="---25"/>
+</page>
+
diff --git a/libxslt/tests/exslt/date/gday.1.xsl b/libxslt/tests/exslt/date/gday.1.xsl new file mode 100644 index 0000000..06ffd8d --- /dev/null +++ b/libxslt/tests/exslt/date/gday.1.xsl @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="ISO-8859-1"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:date="http://exslt.org/dates-and-times"
+ extension-element-prefixes="date">
+
+<xsl:output method="text"/>
+
+<xsl:template match="date">
+ Test Date : <xsl:value-of select="@date"/>
+ <!-- dateTime, date, gYearMonth or gYear; else NaN -->
+ year : <xsl:value-of select="date:year(@date)"/>
+ <!-- dateTime, date, gYearMonth or gYear; else NaN -->
+ leap-year : <xsl:value-of select="date:leap-year(@date)"/>
+ <!-- dateTime, date, gYearMonth, gMonth or gMonthDay; else NaN -->
+ month-in-year : <xsl:value-of select="date:month-in-year(@date)"/>
+ <!-- dateTime, date, gYearMonth or gMonth; else '' -->
+ month-name : <xsl:value-of select="date:month-name(@date)"/>
+ <!-- dateTime, date, gYearMonth or gMonth; else '' -->
+ month-abbreviation : <xsl:value-of select="date:month-abbreviation(@date)"/>
+ <!-- dateTime or date; else NaN -->
+ week-in-year : <xsl:value-of select="date:week-in-year(@date)"/>
+ <!-- dateTime, date; else NaN -->
+ day-in-year : <xsl:value-of select="date:day-in-year(@date)"/>
+ <!-- dateTime, date, gMonthDay or gDay; else NaN -->
+ day-in-month : <xsl:value-of select="date:day-in-month(@date)"/>
+ <!-- dateTime, date; else NaN -->
+ day-of-week-in-month : <xsl:value-of select="date:day-of-week-in-month(@date)"/>
+ <!-- dateTime, date; else NaN -->
+ day-in-week : <xsl:value-of select="date:day-in-week(@date)"/>
+ <!-- dateTime or date; else NaN -->
+ day-name : <xsl:value-of select="date:day-name(@date)"/>
+ <!-- dateTime or date; else NaN -->
+ day-abbreviation : <xsl:value-of select="date:day-abbreviation(@date)"/>
+ <!-- dateTime or time; else '' -->
+ time : <xsl:value-of select="date:time(@date)"/>
+ <!-- dateTime or time; else NaN -->
+ hour-in-day : <xsl:value-of select="date:hour-in-day(@date)"/>
+ <!-- dateTime or time; else NaN -->
+ minute-in-hour : <xsl:value-of select="date:minute-in-hour(@date)"/>
+ <!-- dateTime or time; else NaN -->
+ second-in-minute : <xsl:value-of select="date:second-in-minute(@date)"/>
+</xsl:template>
+
+</xsl:stylesheet>
+
diff --git a/libxslt/tests/exslt/date/gday.2.out b/libxslt/tests/exslt/date/gday.2.out new file mode 100644 index 0000000..c9a3fef --- /dev/null +++ b/libxslt/tests/exslt/date/gday.2.out @@ -0,0 +1,75 @@ + + + + Test Date : --09- + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : ---9 + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + + Test Date : ---32 + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : ---00 + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN diff --git a/libxslt/tests/exslt/date/gday.2.xml b/libxslt/tests/exslt/date/gday.2.xml new file mode 100644 index 0000000..5ea2896 --- /dev/null +++ b/libxslt/tests/exslt/date/gday.2.xml @@ -0,0 +1,10 @@ +<?xml version="1.0"?>
+<page>
+ <!-- invalid xs:gDay syntax -->
+ <date date="--09-"/>
+ <date date="---9"/>
+ <!-- invalid xs:gDay values -->
+ <date date="---32"/>
+ <date date="---00"/>
+</page>
+
diff --git a/libxslt/tests/exslt/date/gday.2.xsl b/libxslt/tests/exslt/date/gday.2.xsl new file mode 100644 index 0000000..06ffd8d --- /dev/null +++ b/libxslt/tests/exslt/date/gday.2.xsl @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="ISO-8859-1"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:date="http://exslt.org/dates-and-times"
+ extension-element-prefixes="date">
+
+<xsl:output method="text"/>
+
+<xsl:template match="date">
+ Test Date : <xsl:value-of select="@date"/>
+ <!-- dateTime, date, gYearMonth or gYear; else NaN -->
+ year : <xsl:value-of select="date:year(@date)"/>
+ <!-- dateTime, date, gYearMonth or gYear; else NaN -->
+ leap-year : <xsl:value-of select="date:leap-year(@date)"/>
+ <!-- dateTime, date, gYearMonth, gMonth or gMonthDay; else NaN -->
+ month-in-year : <xsl:value-of select="date:month-in-year(@date)"/>
+ <!-- dateTime, date, gYearMonth or gMonth; else '' -->
+ month-name : <xsl:value-of select="date:month-name(@date)"/>
+ <!-- dateTime, date, gYearMonth or gMonth; else '' -->
+ month-abbreviation : <xsl:value-of select="date:month-abbreviation(@date)"/>
+ <!-- dateTime or date; else NaN -->
+ week-in-year : <xsl:value-of select="date:week-in-year(@date)"/>
+ <!-- dateTime, date; else NaN -->
+ day-in-year : <xsl:value-of select="date:day-in-year(@date)"/>
+ <!-- dateTime, date, gMonthDay or gDay; else NaN -->
+ day-in-month : <xsl:value-of select="date:day-in-month(@date)"/>
+ <!-- dateTime, date; else NaN -->
+ day-of-week-in-month : <xsl:value-of select="date:day-of-week-in-month(@date)"/>
+ <!-- dateTime, date; else NaN -->
+ day-in-week : <xsl:value-of select="date:day-in-week(@date)"/>
+ <!-- dateTime or date; else NaN -->
+ day-name : <xsl:value-of select="date:day-name(@date)"/>
+ <!-- dateTime or date; else NaN -->
+ day-abbreviation : <xsl:value-of select="date:day-abbreviation(@date)"/>
+ <!-- dateTime or time; else '' -->
+ time : <xsl:value-of select="date:time(@date)"/>
+ <!-- dateTime or time; else NaN -->
+ hour-in-day : <xsl:value-of select="date:hour-in-day(@date)"/>
+ <!-- dateTime or time; else NaN -->
+ minute-in-hour : <xsl:value-of select="date:minute-in-hour(@date)"/>
+ <!-- dateTime or time; else NaN -->
+ second-in-minute : <xsl:value-of select="date:second-in-minute(@date)"/>
+</xsl:template>
+
+</xsl:stylesheet>
+
diff --git a/libxslt/tests/exslt/date/gmonth.1.out b/libxslt/tests/exslt/date/gmonth.1.out new file mode 100644 index 0000000..621f799 --- /dev/null +++ b/libxslt/tests/exslt/date/gmonth.1.out @@ -0,0 +1,74 @@ + + + + Test Date : --12-- + year : NaN + leap-year : NaN + month-in-year : 12 + month-name : December + month-abbreviation : Dec + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : --06-- + year : NaN + leap-year : NaN + month-in-year : 6 + month-name : June + month-abbreviation : Jun + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : --02-- + year : NaN + leap-year : NaN + month-in-year : 2 + month-name : February + month-abbreviation : Feb + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : --11-- + year : NaN + leap-year : NaN + month-in-year : 11 + month-name : November + month-abbreviation : Nov + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN diff --git a/libxslt/tests/exslt/date/gmonth.1.xml b/libxslt/tests/exslt/date/gmonth.1.xml new file mode 100644 index 0000000..495b88e --- /dev/null +++ b/libxslt/tests/exslt/date/gmonth.1.xml @@ -0,0 +1,9 @@ +<?xml version="1.0"?>
+<page>
+ <!-- valid xs:gMonth -->
+ <date date="--12--"/>
+ <date date="--06--"/>
+ <date date="--02--"/>
+ <date date="--11--"/>
+</page>
+
diff --git a/libxslt/tests/exslt/date/gmonth.1.xsl b/libxslt/tests/exslt/date/gmonth.1.xsl new file mode 100644 index 0000000..06ffd8d --- /dev/null +++ b/libxslt/tests/exslt/date/gmonth.1.xsl @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="ISO-8859-1"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:date="http://exslt.org/dates-and-times"
+ extension-element-prefixes="date">
+
+<xsl:output method="text"/>
+
+<xsl:template match="date">
+ Test Date : <xsl:value-of select="@date"/>
+ <!-- dateTime, date, gYearMonth or gYear; else NaN -->
+ year : <xsl:value-of select="date:year(@date)"/>
+ <!-- dateTime, date, gYearMonth or gYear; else NaN -->
+ leap-year : <xsl:value-of select="date:leap-year(@date)"/>
+ <!-- dateTime, date, gYearMonth, gMonth or gMonthDay; else NaN -->
+ month-in-year : <xsl:value-of select="date:month-in-year(@date)"/>
+ <!-- dateTime, date, gYearMonth or gMonth; else '' -->
+ month-name : <xsl:value-of select="date:month-name(@date)"/>
+ <!-- dateTime, date, gYearMonth or gMonth; else '' -->
+ month-abbreviation : <xsl:value-of select="date:month-abbreviation(@date)"/>
+ <!-- dateTime or date; else NaN -->
+ week-in-year : <xsl:value-of select="date:week-in-year(@date)"/>
+ <!-- dateTime, date; else NaN -->
+ day-in-year : <xsl:value-of select="date:day-in-year(@date)"/>
+ <!-- dateTime, date, gMonthDay or gDay; else NaN -->
+ day-in-month : <xsl:value-of select="date:day-in-month(@date)"/>
+ <!-- dateTime, date; else NaN -->
+ day-of-week-in-month : <xsl:value-of select="date:day-of-week-in-month(@date)"/>
+ <!-- dateTime, date; else NaN -->
+ day-in-week : <xsl:value-of select="date:day-in-week(@date)"/>
+ <!-- dateTime or date; else NaN -->
+ day-name : <xsl:value-of select="date:day-name(@date)"/>
+ <!-- dateTime or date; else NaN -->
+ day-abbreviation : <xsl:value-of select="date:day-abbreviation(@date)"/>
+ <!-- dateTime or time; else '' -->
+ time : <xsl:value-of select="date:time(@date)"/>
+ <!-- dateTime or time; else NaN -->
+ hour-in-day : <xsl:value-of select="date:hour-in-day(@date)"/>
+ <!-- dateTime or time; else NaN -->
+ minute-in-hour : <xsl:value-of select="date:minute-in-hour(@date)"/>
+ <!-- dateTime or time; else NaN -->
+ second-in-minute : <xsl:value-of select="date:second-in-minute(@date)"/>
+</xsl:template>
+
+</xsl:stylesheet>
+
diff --git a/libxslt/tests/exslt/date/gmonth.2.out b/libxslt/tests/exslt/date/gmonth.2.out new file mode 100644 index 0000000..6aa8dbb --- /dev/null +++ b/libxslt/tests/exslt/date/gmonth.2.out @@ -0,0 +1,57 @@ + + + + Test Date : --09- + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + + Test Date : --00 + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : --13 + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN diff --git a/libxslt/tests/exslt/date/gmonth.2.xml b/libxslt/tests/exslt/date/gmonth.2.xml new file mode 100644 index 0000000..aa24e95 --- /dev/null +++ b/libxslt/tests/exslt/date/gmonth.2.xml @@ -0,0 +1,9 @@ +<?xml version="1.0"?>
+<page>
+ <!-- invalid xs:gMonth syntax -->
+ <date date="--09-"/>
+ <!-- invalid xs:gMonth values -->
+ <date date="--00"/>
+ <date date="--13"/>
+</page>
+
diff --git a/libxslt/tests/exslt/date/gmonth.2.xsl b/libxslt/tests/exslt/date/gmonth.2.xsl new file mode 100644 index 0000000..06ffd8d --- /dev/null +++ b/libxslt/tests/exslt/date/gmonth.2.xsl @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="ISO-8859-1"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:date="http://exslt.org/dates-and-times"
+ extension-element-prefixes="date">
+
+<xsl:output method="text"/>
+
+<xsl:template match="date">
+ Test Date : <xsl:value-of select="@date"/>
+ <!-- dateTime, date, gYearMonth or gYear; else NaN -->
+ year : <xsl:value-of select="date:year(@date)"/>
+ <!-- dateTime, date, gYearMonth or gYear; else NaN -->
+ leap-year : <xsl:value-of select="date:leap-year(@date)"/>
+ <!-- dateTime, date, gYearMonth, gMonth or gMonthDay; else NaN -->
+ month-in-year : <xsl:value-of select="date:month-in-year(@date)"/>
+ <!-- dateTime, date, gYearMonth or gMonth; else '' -->
+ month-name : <xsl:value-of select="date:month-name(@date)"/>
+ <!-- dateTime, date, gYearMonth or gMonth; else '' -->
+ month-abbreviation : <xsl:value-of select="date:month-abbreviation(@date)"/>
+ <!-- dateTime or date; else NaN -->
+ week-in-year : <xsl:value-of select="date:week-in-year(@date)"/>
+ <!-- dateTime, date; else NaN -->
+ day-in-year : <xsl:value-of select="date:day-in-year(@date)"/>
+ <!-- dateTime, date, gMonthDay or gDay; else NaN -->
+ day-in-month : <xsl:value-of select="date:day-in-month(@date)"/>
+ <!-- dateTime, date; else NaN -->
+ day-of-week-in-month : <xsl:value-of select="date:day-of-week-in-month(@date)"/>
+ <!-- dateTime, date; else NaN -->
+ day-in-week : <xsl:value-of select="date:day-in-week(@date)"/>
+ <!-- dateTime or date; else NaN -->
+ day-name : <xsl:value-of select="date:day-name(@date)"/>
+ <!-- dateTime or date; else NaN -->
+ day-abbreviation : <xsl:value-of select="date:day-abbreviation(@date)"/>
+ <!-- dateTime or time; else '' -->
+ time : <xsl:value-of select="date:time(@date)"/>
+ <!-- dateTime or time; else NaN -->
+ hour-in-day : <xsl:value-of select="date:hour-in-day(@date)"/>
+ <!-- dateTime or time; else NaN -->
+ minute-in-hour : <xsl:value-of select="date:minute-in-hour(@date)"/>
+ <!-- dateTime or time; else NaN -->
+ second-in-minute : <xsl:value-of select="date:second-in-minute(@date)"/>
+</xsl:template>
+
+</xsl:stylesheet>
+
diff --git a/libxslt/tests/exslt/date/gmonthday.1.out b/libxslt/tests/exslt/date/gmonthday.1.out new file mode 100644 index 0000000..24ef4d6 --- /dev/null +++ b/libxslt/tests/exslt/date/gmonthday.1.out @@ -0,0 +1,110 @@ + + + + Test Date : --01-01 + year : NaN + leap-year : NaN + month-in-year : 1 + month-name : January + month-abbreviation : Jan + week-in-year : NaN + day-in-year : NaN + day-in-month : 1 + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : --02-28 + year : NaN + leap-year : NaN + month-in-year : 2 + month-name : February + month-abbreviation : Feb + week-in-year : NaN + day-in-year : NaN + day-in-month : 28 + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : --06-04 + year : NaN + leap-year : NaN + month-in-year : 6 + month-name : June + month-abbreviation : Jun + week-in-year : NaN + day-in-year : NaN + day-in-month : 4 + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : --09-01 + year : NaN + leap-year : NaN + month-in-year : 9 + month-name : September + month-abbreviation : Sep + week-in-year : NaN + day-in-year : NaN + day-in-month : 1 + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : --10-31 + year : NaN + leap-year : NaN + month-in-year : 10 + month-name : October + month-abbreviation : Oct + week-in-year : NaN + day-in-year : NaN + day-in-month : 31 + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : --12-31 + year : NaN + leap-year : NaN + month-in-year : 12 + month-name : December + month-abbreviation : Dec + week-in-year : NaN + day-in-year : NaN + day-in-month : 31 + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN diff --git a/libxslt/tests/exslt/date/gmonthday.1.xml b/libxslt/tests/exslt/date/gmonthday.1.xml new file mode 100644 index 0000000..25d2474 --- /dev/null +++ b/libxslt/tests/exslt/date/gmonthday.1.xml @@ -0,0 +1,11 @@ +<?xml version="1.0"?>
+<page>
+ <!-- valid xs:gMonthDay -->
+ <date date="--01-01"/>
+ <date date="--02-28"/>
+ <date date="--06-04"/>
+ <date date="--09-01"/>
+ <date date="--10-31"/>
+ <date date="--12-31"/>
+</page>
+
diff --git a/libxslt/tests/exslt/date/gmonthday.1.xsl b/libxslt/tests/exslt/date/gmonthday.1.xsl new file mode 100644 index 0000000..06ffd8d --- /dev/null +++ b/libxslt/tests/exslt/date/gmonthday.1.xsl @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="ISO-8859-1"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:date="http://exslt.org/dates-and-times"
+ extension-element-prefixes="date">
+
+<xsl:output method="text"/>
+
+<xsl:template match="date">
+ Test Date : <xsl:value-of select="@date"/>
+ <!-- dateTime, date, gYearMonth or gYear; else NaN -->
+ year : <xsl:value-of select="date:year(@date)"/>
+ <!-- dateTime, date, gYearMonth or gYear; else NaN -->
+ leap-year : <xsl:value-of select="date:leap-year(@date)"/>
+ <!-- dateTime, date, gYearMonth, gMonth or gMonthDay; else NaN -->
+ month-in-year : <xsl:value-of select="date:month-in-year(@date)"/>
+ <!-- dateTime, date, gYearMonth or gMonth; else '' -->
+ month-name : <xsl:value-of select="date:month-name(@date)"/>
+ <!-- dateTime, date, gYearMonth or gMonth; else '' -->
+ month-abbreviation : <xsl:value-of select="date:month-abbreviation(@date)"/>
+ <!-- dateTime or date; else NaN -->
+ week-in-year : <xsl:value-of select="date:week-in-year(@date)"/>
+ <!-- dateTime, date; else NaN -->
+ day-in-year : <xsl:value-of select="date:day-in-year(@date)"/>
+ <!-- dateTime, date, gMonthDay or gDay; else NaN -->
+ day-in-month : <xsl:value-of select="date:day-in-month(@date)"/>
+ <!-- dateTime, date; else NaN -->
+ day-of-week-in-month : <xsl:value-of select="date:day-of-week-in-month(@date)"/>
+ <!-- dateTime, date; else NaN -->
+ day-in-week : <xsl:value-of select="date:day-in-week(@date)"/>
+ <!-- dateTime or date; else NaN -->
+ day-name : <xsl:value-of select="date:day-name(@date)"/>
+ <!-- dateTime or date; else NaN -->
+ day-abbreviation : <xsl:value-of select="date:day-abbreviation(@date)"/>
+ <!-- dateTime or time; else '' -->
+ time : <xsl:value-of select="date:time(@date)"/>
+ <!-- dateTime or time; else NaN -->
+ hour-in-day : <xsl:value-of select="date:hour-in-day(@date)"/>
+ <!-- dateTime or time; else NaN -->
+ minute-in-hour : <xsl:value-of select="date:minute-in-hour(@date)"/>
+ <!-- dateTime or time; else NaN -->
+ second-in-minute : <xsl:value-of select="date:second-in-minute(@date)"/>
+</xsl:template>
+
+</xsl:stylesheet>
+
diff --git a/libxslt/tests/exslt/date/gmonthday.2.out b/libxslt/tests/exslt/date/gmonthday.2.out new file mode 100644 index 0000000..c562336 --- /dev/null +++ b/libxslt/tests/exslt/date/gmonthday.2.out @@ -0,0 +1,57 @@ + + + + Test Date : ---09-01 + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : --09-01- + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + + Test Date : --01-00 + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN diff --git a/libxslt/tests/exslt/date/gmonthday.2.xml b/libxslt/tests/exslt/date/gmonthday.2.xml new file mode 100644 index 0000000..23c6f40 --- /dev/null +++ b/libxslt/tests/exslt/date/gmonthday.2.xml @@ -0,0 +1,9 @@ +<?xml version="1.0"?>
+<page>
+ <!-- invalid xs:gMonthDay syntax -->
+ <date date="---09-01"/>
+ <date date="--09-01-"/>
+ <!-- invalid xs:gMonthDay values -->
+ <date date="--01-00"/>
+</page>
+
diff --git a/libxslt/tests/exslt/date/gmonthday.2.xsl b/libxslt/tests/exslt/date/gmonthday.2.xsl new file mode 100644 index 0000000..06ffd8d --- /dev/null +++ b/libxslt/tests/exslt/date/gmonthday.2.xsl @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="ISO-8859-1"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:date="http://exslt.org/dates-and-times"
+ extension-element-prefixes="date">
+
+<xsl:output method="text"/>
+
+<xsl:template match="date">
+ Test Date : <xsl:value-of select="@date"/>
+ <!-- dateTime, date, gYearMonth or gYear; else NaN -->
+ year : <xsl:value-of select="date:year(@date)"/>
+ <!-- dateTime, date, gYearMonth or gYear; else NaN -->
+ leap-year : <xsl:value-of select="date:leap-year(@date)"/>
+ <!-- dateTime, date, gYearMonth, gMonth or gMonthDay; else NaN -->
+ month-in-year : <xsl:value-of select="date:month-in-year(@date)"/>
+ <!-- dateTime, date, gYearMonth or gMonth; else '' -->
+ month-name : <xsl:value-of select="date:month-name(@date)"/>
+ <!-- dateTime, date, gYearMonth or gMonth; else '' -->
+ month-abbreviation : <xsl:value-of select="date:month-abbreviation(@date)"/>
+ <!-- dateTime or date; else NaN -->
+ week-in-year : <xsl:value-of select="date:week-in-year(@date)"/>
+ <!-- dateTime, date; else NaN -->
+ day-in-year : <xsl:value-of select="date:day-in-year(@date)"/>
+ <!-- dateTime, date, gMonthDay or gDay; else NaN -->
+ day-in-month : <xsl:value-of select="date:day-in-month(@date)"/>
+ <!-- dateTime, date; else NaN -->
+ day-of-week-in-month : <xsl:value-of select="date:day-of-week-in-month(@date)"/>
+ <!-- dateTime, date; else NaN -->
+ day-in-week : <xsl:value-of select="date:day-in-week(@date)"/>
+ <!-- dateTime or date; else NaN -->
+ day-name : <xsl:value-of select="date:day-name(@date)"/>
+ <!-- dateTime or date; else NaN -->
+ day-abbreviation : <xsl:value-of select="date:day-abbreviation(@date)"/>
+ <!-- dateTime or time; else '' -->
+ time : <xsl:value-of select="date:time(@date)"/>
+ <!-- dateTime or time; else NaN -->
+ hour-in-day : <xsl:value-of select="date:hour-in-day(@date)"/>
+ <!-- dateTime or time; else NaN -->
+ minute-in-hour : <xsl:value-of select="date:minute-in-hour(@date)"/>
+ <!-- dateTime or time; else NaN -->
+ second-in-minute : <xsl:value-of select="date:second-in-minute(@date)"/>
+</xsl:template>
+
+</xsl:stylesheet>
+
diff --git a/libxslt/tests/exslt/date/gyear.1.out b/libxslt/tests/exslt/date/gyear.1.out new file mode 100644 index 0000000..9a7b291 --- /dev/null +++ b/libxslt/tests/exslt/date/gyear.1.out @@ -0,0 +1,92 @@ + + + + Test Date : 0001 + year : 1 + leap-year : false + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : 3000 + year : 3000 + leap-year : false + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : 2000 + year : 2000 + leap-year : true + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : 9990001 + year : 9990001 + leap-year : false + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : -0004 + year : -4 + leap-year : true + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN diff --git a/libxslt/tests/exslt/date/gyear.1.xml b/libxslt/tests/exslt/date/gyear.1.xml new file mode 100644 index 0000000..95d776b --- /dev/null +++ b/libxslt/tests/exslt/date/gyear.1.xml @@ -0,0 +1,10 @@ +<?xml version="1.0"?>
+<page>
+ <!-- valid xs:gYear -->
+ <date date="0001"/>
+ <date date="3000"/>
+ <date date="2000"/>
+ <date date="9990001"/>
+ <date date="-0004"/>
+</page>
+
diff --git a/libxslt/tests/exslt/date/gyear.1.xsl b/libxslt/tests/exslt/date/gyear.1.xsl new file mode 100644 index 0000000..06ffd8d --- /dev/null +++ b/libxslt/tests/exslt/date/gyear.1.xsl @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="ISO-8859-1"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:date="http://exslt.org/dates-and-times"
+ extension-element-prefixes="date">
+
+<xsl:output method="text"/>
+
+<xsl:template match="date">
+ Test Date : <xsl:value-of select="@date"/>
+ <!-- dateTime, date, gYearMonth or gYear; else NaN -->
+ year : <xsl:value-of select="date:year(@date)"/>
+ <!-- dateTime, date, gYearMonth or gYear; else NaN -->
+ leap-year : <xsl:value-of select="date:leap-year(@date)"/>
+ <!-- dateTime, date, gYearMonth, gMonth or gMonthDay; else NaN -->
+ month-in-year : <xsl:value-of select="date:month-in-year(@date)"/>
+ <!-- dateTime, date, gYearMonth or gMonth; else '' -->
+ month-name : <xsl:value-of select="date:month-name(@date)"/>
+ <!-- dateTime, date, gYearMonth or gMonth; else '' -->
+ month-abbreviation : <xsl:value-of select="date:month-abbreviation(@date)"/>
+ <!-- dateTime or date; else NaN -->
+ week-in-year : <xsl:value-of select="date:week-in-year(@date)"/>
+ <!-- dateTime, date; else NaN -->
+ day-in-year : <xsl:value-of select="date:day-in-year(@date)"/>
+ <!-- dateTime, date, gMonthDay or gDay; else NaN -->
+ day-in-month : <xsl:value-of select="date:day-in-month(@date)"/>
+ <!-- dateTime, date; else NaN -->
+ day-of-week-in-month : <xsl:value-of select="date:day-of-week-in-month(@date)"/>
+ <!-- dateTime, date; else NaN -->
+ day-in-week : <xsl:value-of select="date:day-in-week(@date)"/>
+ <!-- dateTime or date; else NaN -->
+ day-name : <xsl:value-of select="date:day-name(@date)"/>
+ <!-- dateTime or date; else NaN -->
+ day-abbreviation : <xsl:value-of select="date:day-abbreviation(@date)"/>
+ <!-- dateTime or time; else '' -->
+ time : <xsl:value-of select="date:time(@date)"/>
+ <!-- dateTime or time; else NaN -->
+ hour-in-day : <xsl:value-of select="date:hour-in-day(@date)"/>
+ <!-- dateTime or time; else NaN -->
+ minute-in-hour : <xsl:value-of select="date:minute-in-hour(@date)"/>
+ <!-- dateTime or time; else NaN -->
+ second-in-minute : <xsl:value-of select="date:second-in-minute(@date)"/>
+</xsl:template>
+
+</xsl:stylesheet>
+
diff --git a/libxslt/tests/exslt/date/gyear.2.out b/libxslt/tests/exslt/date/gyear.2.out new file mode 100644 index 0000000..801bfe0 --- /dev/null +++ b/libxslt/tests/exslt/date/gyear.2.out @@ -0,0 +1,39 @@ + + + + Test Date : 00010 + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + + Test Date : 0000 + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN diff --git a/libxslt/tests/exslt/date/gyear.2.xml b/libxslt/tests/exslt/date/gyear.2.xml new file mode 100644 index 0000000..9c57182 --- /dev/null +++ b/libxslt/tests/exslt/date/gyear.2.xml @@ -0,0 +1,8 @@ +<?xml version="1.0"?>
+<page>
+ <!-- invalid xs:gYear syntax -->
+ <date date="00010"/>
+ <!-- invalid xs:gYear values -->
+ <date date="0000"/>
+</page>
+
diff --git a/libxslt/tests/exslt/date/gyear.2.xsl b/libxslt/tests/exslt/date/gyear.2.xsl new file mode 100644 index 0000000..06ffd8d --- /dev/null +++ b/libxslt/tests/exslt/date/gyear.2.xsl @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="ISO-8859-1"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:date="http://exslt.org/dates-and-times"
+ extension-element-prefixes="date">
+
+<xsl:output method="text"/>
+
+<xsl:template match="date">
+ Test Date : <xsl:value-of select="@date"/>
+ <!-- dateTime, date, gYearMonth or gYear; else NaN -->
+ year : <xsl:value-of select="date:year(@date)"/>
+ <!-- dateTime, date, gYearMonth or gYear; else NaN -->
+ leap-year : <xsl:value-of select="date:leap-year(@date)"/>
+ <!-- dateTime, date, gYearMonth, gMonth or gMonthDay; else NaN -->
+ month-in-year : <xsl:value-of select="date:month-in-year(@date)"/>
+ <!-- dateTime, date, gYearMonth or gMonth; else '' -->
+ month-name : <xsl:value-of select="date:month-name(@date)"/>
+ <!-- dateTime, date, gYearMonth or gMonth; else '' -->
+ month-abbreviation : <xsl:value-of select="date:month-abbreviation(@date)"/>
+ <!-- dateTime or date; else NaN -->
+ week-in-year : <xsl:value-of select="date:week-in-year(@date)"/>
+ <!-- dateTime, date; else NaN -->
+ day-in-year : <xsl:value-of select="date:day-in-year(@date)"/>
+ <!-- dateTime, date, gMonthDay or gDay; else NaN -->
+ day-in-month : <xsl:value-of select="date:day-in-month(@date)"/>
+ <!-- dateTime, date; else NaN -->
+ day-of-week-in-month : <xsl:value-of select="date:day-of-week-in-month(@date)"/>
+ <!-- dateTime, date; else NaN -->
+ day-in-week : <xsl:value-of select="date:day-in-week(@date)"/>
+ <!-- dateTime or date; else NaN -->
+ day-name : <xsl:value-of select="date:day-name(@date)"/>
+ <!-- dateTime or date; else NaN -->
+ day-abbreviation : <xsl:value-of select="date:day-abbreviation(@date)"/>
+ <!-- dateTime or time; else '' -->
+ time : <xsl:value-of select="date:time(@date)"/>
+ <!-- dateTime or time; else NaN -->
+ hour-in-day : <xsl:value-of select="date:hour-in-day(@date)"/>
+ <!-- dateTime or time; else NaN -->
+ minute-in-hour : <xsl:value-of select="date:minute-in-hour(@date)"/>
+ <!-- dateTime or time; else NaN -->
+ second-in-minute : <xsl:value-of select="date:second-in-minute(@date)"/>
+</xsl:template>
+
+</xsl:stylesheet>
+
diff --git a/libxslt/tests/exslt/date/gyearmonth.1.out b/libxslt/tests/exslt/date/gyearmonth.1.out new file mode 100644 index 0000000..57580c7 --- /dev/null +++ b/libxslt/tests/exslt/date/gyearmonth.1.out @@ -0,0 +1,92 @@ + + + + Test Date : 0001-12 + year : 1 + leap-year : false + month-in-year : 12 + month-name : December + month-abbreviation : Dec + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : 3000-01 + year : 3000 + leap-year : false + month-in-year : 1 + month-name : January + month-abbreviation : Jan + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : 2000-02 + year : 2000 + leap-year : true + month-in-year : 2 + month-name : February + month-abbreviation : Feb + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : 9990001-12 + year : 9990001 + leap-year : false + month-in-year : 12 + month-name : December + month-abbreviation : Dec + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : -0004-02 + year : -4 + leap-year : true + month-in-year : 2 + month-name : February + month-abbreviation : Feb + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN diff --git a/libxslt/tests/exslt/date/gyearmonth.1.xml b/libxslt/tests/exslt/date/gyearmonth.1.xml new file mode 100644 index 0000000..08a7d29 --- /dev/null +++ b/libxslt/tests/exslt/date/gyearmonth.1.xml @@ -0,0 +1,10 @@ +<?xml version="1.0"?>
+<page>
+ <!-- valid xs:gYearMonth -->
+ <date date="0001-12"/>
+ <date date="3000-01"/>
+ <date date="2000-02"/>
+ <date date="9990001-12"/>
+ <date date="-0004-02"/>
+</page>
+
diff --git a/libxslt/tests/exslt/date/gyearmonth.1.xsl b/libxslt/tests/exslt/date/gyearmonth.1.xsl new file mode 100644 index 0000000..06ffd8d --- /dev/null +++ b/libxslt/tests/exslt/date/gyearmonth.1.xsl @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="ISO-8859-1"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:date="http://exslt.org/dates-and-times"
+ extension-element-prefixes="date">
+
+<xsl:output method="text"/>
+
+<xsl:template match="date">
+ Test Date : <xsl:value-of select="@date"/>
+ <!-- dateTime, date, gYearMonth or gYear; else NaN -->
+ year : <xsl:value-of select="date:year(@date)"/>
+ <!-- dateTime, date, gYearMonth or gYear; else NaN -->
+ leap-year : <xsl:value-of select="date:leap-year(@date)"/>
+ <!-- dateTime, date, gYearMonth, gMonth or gMonthDay; else NaN -->
+ month-in-year : <xsl:value-of select="date:month-in-year(@date)"/>
+ <!-- dateTime, date, gYearMonth or gMonth; else '' -->
+ month-name : <xsl:value-of select="date:month-name(@date)"/>
+ <!-- dateTime, date, gYearMonth or gMonth; else '' -->
+ month-abbreviation : <xsl:value-of select="date:month-abbreviation(@date)"/>
+ <!-- dateTime or date; else NaN -->
+ week-in-year : <xsl:value-of select="date:week-in-year(@date)"/>
+ <!-- dateTime, date; else NaN -->
+ day-in-year : <xsl:value-of select="date:day-in-year(@date)"/>
+ <!-- dateTime, date, gMonthDay or gDay; else NaN -->
+ day-in-month : <xsl:value-of select="date:day-in-month(@date)"/>
+ <!-- dateTime, date; else NaN -->
+ day-of-week-in-month : <xsl:value-of select="date:day-of-week-in-month(@date)"/>
+ <!-- dateTime, date; else NaN -->
+ day-in-week : <xsl:value-of select="date:day-in-week(@date)"/>
+ <!-- dateTime or date; else NaN -->
+ day-name : <xsl:value-of select="date:day-name(@date)"/>
+ <!-- dateTime or date; else NaN -->
+ day-abbreviation : <xsl:value-of select="date:day-abbreviation(@date)"/>
+ <!-- dateTime or time; else '' -->
+ time : <xsl:value-of select="date:time(@date)"/>
+ <!-- dateTime or time; else NaN -->
+ hour-in-day : <xsl:value-of select="date:hour-in-day(@date)"/>
+ <!-- dateTime or time; else NaN -->
+ minute-in-hour : <xsl:value-of select="date:minute-in-hour(@date)"/>
+ <!-- dateTime or time; else NaN -->
+ second-in-minute : <xsl:value-of select="date:second-in-minute(@date)"/>
+</xsl:template>
+
+</xsl:stylesheet>
+
diff --git a/libxslt/tests/exslt/date/gyearmonth.2.out b/libxslt/tests/exslt/date/gyearmonth.2.out new file mode 100644 index 0000000..9cf3c5f --- /dev/null +++ b/libxslt/tests/exslt/date/gyearmonth.2.out @@ -0,0 +1,39 @@ + + + + Test Date : 0010-8 + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + + Test Date : 0001-13 + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN diff --git a/libxslt/tests/exslt/date/gyearmonth.2.xml b/libxslt/tests/exslt/date/gyearmonth.2.xml new file mode 100644 index 0000000..99cb5b7 --- /dev/null +++ b/libxslt/tests/exslt/date/gyearmonth.2.xml @@ -0,0 +1,8 @@ +<?xml version="1.0"?>
+<page>
+ <!-- invalid xs:gYearMonth syntax -->
+ <date date="0010-8"/>
+ <!-- invalid xs:gYearMonth values -->
+ <date date="0001-13"/>
+</page>
+
diff --git a/libxslt/tests/exslt/date/gyearmonth.2.xsl b/libxslt/tests/exslt/date/gyearmonth.2.xsl new file mode 100644 index 0000000..06ffd8d --- /dev/null +++ b/libxslt/tests/exslt/date/gyearmonth.2.xsl @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="ISO-8859-1"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:date="http://exslt.org/dates-and-times"
+ extension-element-prefixes="date">
+
+<xsl:output method="text"/>
+
+<xsl:template match="date">
+ Test Date : <xsl:value-of select="@date"/>
+ <!-- dateTime, date, gYearMonth or gYear; else NaN -->
+ year : <xsl:value-of select="date:year(@date)"/>
+ <!-- dateTime, date, gYearMonth or gYear; else NaN -->
+ leap-year : <xsl:value-of select="date:leap-year(@date)"/>
+ <!-- dateTime, date, gYearMonth, gMonth or gMonthDay; else NaN -->
+ month-in-year : <xsl:value-of select="date:month-in-year(@date)"/>
+ <!-- dateTime, date, gYearMonth or gMonth; else '' -->
+ month-name : <xsl:value-of select="date:month-name(@date)"/>
+ <!-- dateTime, date, gYearMonth or gMonth; else '' -->
+ month-abbreviation : <xsl:value-of select="date:month-abbreviation(@date)"/>
+ <!-- dateTime or date; else NaN -->
+ week-in-year : <xsl:value-of select="date:week-in-year(@date)"/>
+ <!-- dateTime, date; else NaN -->
+ day-in-year : <xsl:value-of select="date:day-in-year(@date)"/>
+ <!-- dateTime, date, gMonthDay or gDay; else NaN -->
+ day-in-month : <xsl:value-of select="date:day-in-month(@date)"/>
+ <!-- dateTime, date; else NaN -->
+ day-of-week-in-month : <xsl:value-of select="date:day-of-week-in-month(@date)"/>
+ <!-- dateTime, date; else NaN -->
+ day-in-week : <xsl:value-of select="date:day-in-week(@date)"/>
+ <!-- dateTime or date; else NaN -->
+ day-name : <xsl:value-of select="date:day-name(@date)"/>
+ <!-- dateTime or date; else NaN -->
+ day-abbreviation : <xsl:value-of select="date:day-abbreviation(@date)"/>
+ <!-- dateTime or time; else '' -->
+ time : <xsl:value-of select="date:time(@date)"/>
+ <!-- dateTime or time; else NaN -->
+ hour-in-day : <xsl:value-of select="date:hour-in-day(@date)"/>
+ <!-- dateTime or time; else NaN -->
+ minute-in-hour : <xsl:value-of select="date:minute-in-hour(@date)"/>
+ <!-- dateTime or time; else NaN -->
+ second-in-minute : <xsl:value-of select="date:second-in-minute(@date)"/>
+</xsl:template>
+
+</xsl:stylesheet>
+
diff --git a/libxslt/tests/exslt/date/seconds.1.out b/libxslt/tests/exslt/date/seconds.1.out new file mode 100644 index 0000000..c0eb72c --- /dev/null +++ b/libxslt/tests/exslt/date/seconds.1.out @@ -0,0 +1,53 @@ + +seconds : PT10M +result : 600 +seconds : -P10D +result : -864000 +seconds : PT10H +result : 36000 +seconds : PT10H10M10.5S +result : 36610.5 +seconds : PT0.00001S +result : 0.00001 +seconds : PT49.00001S +result : 49.00001 +seconds : P0Y0M31DT10H10M10.09S +result : 2715010.09 +seconds : -P0Y0M31DT10H10M10.09S +result : -2715010.09 +seconds : PT100H100M100.001S +result : 366100.001 +seconds : 2001 +result : 978307200 +seconds : 2001-10-29T10:31:07 +result : 1004351467 +seconds : 1970-01-01T00:00:00 +result : 0 +seconds : 1970-01-01T00:00:01 +result : 1 +seconds : 1969-12-31T23:59:59 +result : -1 +seconds : 1969-01-01T00:00:00 +result : -31536000 +seconds : 1971-01-01T00:00:00 +result : 31536000 +seconds : 0001-01-01T00:00:00 +result : -6.21355968e+10 +seconds : -0001-01-01T00:00:00 +result : -6.21671328e+10 +seconds : 1970-01-01 +result : 0 +seconds : 1970-01-01Z +result : 0 +seconds : 1970-01-01-11:00 +result : 39600 +seconds : 1970-01-01+11:00 +result : -39600 +seconds : 1970-01-01-12:00 +result : 43200 +seconds : 1970-01-01+12:00 +result : -43200 +seconds : 1970-01-01-13:00 +result : 46800 +seconds : 1970-01-01+13:00 +result : -46800 diff --git a/libxslt/tests/exslt/date/seconds.1.xml b/libxslt/tests/exslt/date/seconds.1.xml new file mode 100644 index 0000000..24d58fb --- /dev/null +++ b/libxslt/tests/exslt/date/seconds.1.xml @@ -0,0 +1,33 @@ +<?xml version="1.0"?> +<page> + <!-- valid durations --> + <date duration="PT10M"/> + <date duration="-P10D"/> + <date duration="PT10H"/> + <date duration="PT10H10M10.5S"/> + <date duration="PT0.00001S"/> + <date duration="PT49.00001S"/> + <date duration="P0Y0M31DT10H10M10.09S"/> + <date duration="-P0Y0M31DT10H10M10.09S"/> + <date duration="PT100H100M100.001S"/> + <!-- date/times --> + <date duration="2001"/> + <date duration="2001-10-29T10:31:07"/> + <date duration="1970-01-01T00:00:00"/> + <date duration="1970-01-01T00:00:01"/> + <date duration="1969-12-31T23:59:59"/> + <date duration="1969-01-01T00:00:00"/> + <date duration="1971-01-01T00:00:00"/> + <date duration="0001-01-01T00:00:00"/> + <date duration="-0001-01-01T00:00:00"/> + <!-- timezones --> + <date duration="1970-01-01" /> + <date duration="1970-01-01Z" /> + <date duration="1970-01-01-11:00" /> + <date duration="1970-01-01+11:00" /> + <date duration="1970-01-01-12:00" /> + <date duration="1970-01-01+12:00" /> + <date duration="1970-01-01-13:00" /> + <date duration="1970-01-01+13:00" /> +</page> + diff --git a/libxslt/tests/exslt/date/seconds.1.xsl b/libxslt/tests/exslt/date/seconds.1.xsl new file mode 100644 index 0000000..a806942 --- /dev/null +++ b/libxslt/tests/exslt/date/seconds.1.xsl @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:date="http://exslt.org/dates-and-times" + extension-element-prefixes="date"> + +<xsl:output method="html"/> +<xsl:strip-space elements="*"/> + +<xsl:template match="date"> +seconds : <xsl:value-of select="@duration"/> +result : <xsl:value-of select="date:seconds(@duration)"/> +</xsl:template> + +</xsl:stylesheet> + diff --git a/libxslt/tests/exslt/date/seconds.2.out b/libxslt/tests/exslt/date/seconds.2.out new file mode 100644 index 0000000..e804d94 --- /dev/null +++ b/libxslt/tests/exslt/date/seconds.2.out @@ -0,0 +1,27 @@ + +seconds : P10H +result : NaN +seconds : P-T10D +result : NaN +seconds : PT-10D +result : NaN +seconds : --PT10H +result : NaN +seconds : PT10H10M.5S +result : NaN +seconds : PYT0.00001S +result : NaN +seconds : PT49.00001 +result : NaN +seconds : P0Y0MDT10H10M10.09S +result : NaN +seconds : --10-29 +result : NaN +seconds : ---29 +result : NaN +seconds : 10:31:07 +result : NaN +seconds : P10Y20M100DT40H61M100S +result : NaN +seconds : P10000Y +result : NaN diff --git a/libxslt/tests/exslt/date/seconds.2.xml b/libxslt/tests/exslt/date/seconds.2.xml new file mode 100644 index 0000000..276baef --- /dev/null +++ b/libxslt/tests/exslt/date/seconds.2.xml @@ -0,0 +1,21 @@ +<?xml version="1.0"?> +<page> + <!-- invalid duration syntax --> + <date duration="P10H"/> + <date duration="P-T10D"/> + <date duration="PT-10D"/> + <date duration="--PT10H"/> + <date duration="PT10H10M.5S"/> + <date duration="PYT0.00001S"/> + <date duration="PT49.00001"/> + <date duration="P0Y0MDT10H10M10.09S"/> + <!-- invalid date/time type --> + <date duration="--10-29"/> + <date duration="---29"/> + <date duration="10:31:07"/> + <!-- invalid duration values for date:seconds --> + <!-- years and months are not handled by date:seconds() --> + <date duration="P10Y20M100DT40H61M100S"/> + <date duration="P10000Y"/> +</page> + diff --git a/libxslt/tests/exslt/date/seconds.2.xsl b/libxslt/tests/exslt/date/seconds.2.xsl new file mode 100644 index 0000000..a806942 --- /dev/null +++ b/libxslt/tests/exslt/date/seconds.2.xsl @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:date="http://exslt.org/dates-and-times" + extension-element-prefixes="date"> + +<xsl:output method="html"/> +<xsl:strip-space elements="*"/> + +<xsl:template match="date"> +seconds : <xsl:value-of select="@duration"/> +result : <xsl:value-of select="date:seconds(@duration)"/> +</xsl:template> + +</xsl:stylesheet> + diff --git a/libxslt/tests/exslt/date/sum.1.out b/libxslt/tests/exslt/date/sum.1.out new file mode 100644 index 0000000..2397866 --- /dev/null +++ b/libxslt/tests/exslt/date/sum.1.out @@ -0,0 +1,21 @@ + +sum : PT1M + PT2M +result : PT3M +sum : P1DT2H + PT3M + PT4S +result : P1DT2H3M4S +sum : PT20M + PT20M + PT20M +result : PT1H +sum : PT01S + PT02S + PT04S + PT8S + PT16S + PT32S +result : PT1M3S +sum : P1M +result : P1M +sum : PT70M +result : PT1H10M +sum : PT70M + P13M +result : P1Y1MT1H10M +sum : PT70M + -PT30M +result : PT40M +sum : PT1H10M + -PT30M + -PT30S +result : PT39M30S +sum : PT1M + -PT1M +result : P0D
\ No newline at end of file diff --git a/libxslt/tests/exslt/date/sum.1.xml b/libxslt/tests/exslt/date/sum.1.xml new file mode 100644 index 0000000..1004a7d --- /dev/null +++ b/libxslt/tests/exslt/date/sum.1.xml @@ -0,0 +1,63 @@ +<?xml version="1.0"?> +<page> + <!-- valid date/times --> + <sum> + <date dur='PT1M'/> + <date dur='PT2M'/> + </sum> + + <sum> + <date dur='P1DT2H'/> + <date dur='PT3M'/> + <date dur='PT4S'/> + </sum> + + <sum> + <date dur='PT20M'/> + <date dur='PT20M'/> + <date dur='PT20M'/> + </sum> + + <sum> + <date dur='PT01S'/> + <date dur='PT02S'/> + <date dur='PT04S'/> + <date dur='PT8S'/> + <date dur='PT16S'/> + <date dur='PT32S'/> + </sum> + + <!-- Base case: sum of 1 node --> + <sum> + <date dur='P1M'/> + </sum> + + <!-- Non-normalized input --> + <sum> + <date dur='PT70M'/> + </sum> + + <sum> + <date dur='PT70M'/> + <date dur='P13M'/> + </sum> + + <!-- Negative durations --> + <sum> + <date dur='PT70M'/> + <date dur='-PT30M'/> + </sum> + + <sum> + <date dur='PT1H10M'/> + <date dur='-PT30M'/> + <date dur='-PT30S'/> + </sum> + + <!-- Zero sum --> + <sum> + <date dur='PT1M'/> + <date dur='-PT1M'/> + </sum> + +</page> diff --git a/libxslt/tests/exslt/date/sum.1.xsl b/libxslt/tests/exslt/date/sum.1.xsl new file mode 100644 index 0000000..642fafe --- /dev/null +++ b/libxslt/tests/exslt/date/sum.1.xsl @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:date="http://exslt.org/dates-and-times" + extension-element-prefixes="date"> + +<xsl:output method="text"/> +<xsl:strip-space elements="*"/> + +<xsl:template match="sum"> +sum : <xsl:apply-templates select="date"/> +result : <xsl:value-of select="date:sum(date/@dur)"/> +</xsl:template> + +<xsl:template match="date"> + <xsl:if test="position() != 1"> + </xsl:if> + <xsl:value-of select="@dur"/> +</xsl:template> + +</xsl:stylesheet> diff --git a/libxslt/tests/exslt/date/sum.2.err b/libxslt/tests/exslt/date/sum.2.err new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/libxslt/tests/exslt/date/sum.2.err diff --git a/libxslt/tests/exslt/date/sum.2.out b/libxslt/tests/exslt/date/sum.2.out new file mode 100644 index 0000000..8c9cdda --- /dev/null +++ b/libxslt/tests/exslt/date/sum.2.out @@ -0,0 +1,21 @@ + +sum : +result : +sum : P1M + -P1D +result : +sum : P1M + -P1D + P1D +result : +sum : P1M + P1D + -P1D +result : P1M +sum : +result : +sum : + P45S +result : +sum : 2004-09-20 +result : +sum : 1H +result : +sum : 2004-09-22 + P1D +result : +sum : P2D + --P1D +result :
\ No newline at end of file diff --git a/libxslt/tests/exslt/date/sum.2.xml b/libxslt/tests/exslt/date/sum.2.xml new file mode 100644 index 0000000..f5f77fe --- /dev/null +++ b/libxslt/tests/exslt/date/sum.2.xml @@ -0,0 +1,55 @@ +<?xml version="1.0"?> +<page> + <!-- sum of empty node-set --> + <sum/> + + <!-- According to http://exslt.org/date/functions/add-duration/ + add-duration should fail when a sum involving negative durations + involve borrowing --> + <sum> + <date dur='P1M'/> + <date dur='-P1D'/> + </sum> + + <sum> + <date dur='P1M'/> + <date dur='-P1D'/> + <date dur='P1D'/> + </sum> + + <!-- ... but switching the order should make it work --> + <sum> + <date dur='P1M'/> + <date dur='P1D'/> + <date dur='-P1D'/> + </sum> + + <!-- Empty durations --> + <sum> + <date dur=''/> + </sum> + + <sum> + <date dur=''/> + <date dur='P45S'/> + </sum> + + <!-- Invalid durations --> + <sum> + <date dur='2004-09-20'/> + </sum> + + <sum> + <date dur='1H'/> + </sum> + + <sum> + <date dur='2004-09-22'/> + <date dur='P1D'/> + </sum> + + <sum> + <date dur='P2D'/> + <date dur='--P1D'/> + </sum> +</page> diff --git a/libxslt/tests/exslt/date/sum.2.xsl b/libxslt/tests/exslt/date/sum.2.xsl new file mode 100644 index 0000000..642fafe --- /dev/null +++ b/libxslt/tests/exslt/date/sum.2.xsl @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:date="http://exslt.org/dates-and-times" + extension-element-prefixes="date"> + +<xsl:output method="text"/> +<xsl:strip-space elements="*"/> + +<xsl:template match="sum"> +sum : <xsl:apply-templates select="date"/> +result : <xsl:value-of select="date:sum(date/@dur)"/> +</xsl:template> + +<xsl:template match="date"> + <xsl:if test="position() != 1"> + </xsl:if> + <xsl:value-of select="@dur"/> +</xsl:template> + +</xsl:stylesheet> diff --git a/libxslt/tests/exslt/date/time.1.out b/libxslt/tests/exslt/date/time.1.out new file mode 100644 index 0000000..8151b0a --- /dev/null +++ b/libxslt/tests/exslt/date/time.1.out @@ -0,0 +1,128 @@ + + + + Test Date : 00:00:00 + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : 00:00:00 + hour-in-day : 0 + minute-in-hour : 0 + second-in-minute : 0 + + Test Date : 23:59:59 + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : 23:59:59 + hour-in-day : 23 + minute-in-hour : 59 + second-in-minute : 59 + + Test Date : 11:11:11 + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : 11:11:11 + hour-in-day : 11 + minute-in-hour : 11 + second-in-minute : 11 + + Test Date : 22:22:22 + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : 22:22:22 + hour-in-day : 22 + minute-in-hour : 22 + second-in-minute : 22 + + Test Date : 23:33:33 + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : 23:33:33 + hour-in-day : 23 + minute-in-hour : 33 + second-in-minute : 33 + + Test Date : 14:44:44 + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : 14:44:44 + hour-in-day : 14 + minute-in-hour : 44 + second-in-minute : 44 + + Test Date : 15:55:55 + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : 15:55:55 + hour-in-day : 15 + minute-in-hour : 55 + second-in-minute : 55 diff --git a/libxslt/tests/exslt/date/time.1.xml b/libxslt/tests/exslt/date/time.1.xml new file mode 100644 index 0000000..2776760 --- /dev/null +++ b/libxslt/tests/exslt/date/time.1.xml @@ -0,0 +1,12 @@ +<?xml version="1.0"?>
+<page>
+ <!-- valid xs:time -->
+ <date date="00:00:00"/>
+ <date date="23:59:59"/>
+ <date date="11:11:11"/>
+ <date date="22:22:22"/>
+ <date date="23:33:33"/>
+ <date date="14:44:44"/>
+ <date date="15:55:55"/>
+</page>
+
diff --git a/libxslt/tests/exslt/date/time.1.xsl b/libxslt/tests/exslt/date/time.1.xsl new file mode 100644 index 0000000..06ffd8d --- /dev/null +++ b/libxslt/tests/exslt/date/time.1.xsl @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="ISO-8859-1"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:date="http://exslt.org/dates-and-times"
+ extension-element-prefixes="date">
+
+<xsl:output method="text"/>
+
+<xsl:template match="date">
+ Test Date : <xsl:value-of select="@date"/>
+ <!-- dateTime, date, gYearMonth or gYear; else NaN -->
+ year : <xsl:value-of select="date:year(@date)"/>
+ <!-- dateTime, date, gYearMonth or gYear; else NaN -->
+ leap-year : <xsl:value-of select="date:leap-year(@date)"/>
+ <!-- dateTime, date, gYearMonth, gMonth or gMonthDay; else NaN -->
+ month-in-year : <xsl:value-of select="date:month-in-year(@date)"/>
+ <!-- dateTime, date, gYearMonth or gMonth; else '' -->
+ month-name : <xsl:value-of select="date:month-name(@date)"/>
+ <!-- dateTime, date, gYearMonth or gMonth; else '' -->
+ month-abbreviation : <xsl:value-of select="date:month-abbreviation(@date)"/>
+ <!-- dateTime or date; else NaN -->
+ week-in-year : <xsl:value-of select="date:week-in-year(@date)"/>
+ <!-- dateTime, date; else NaN -->
+ day-in-year : <xsl:value-of select="date:day-in-year(@date)"/>
+ <!-- dateTime, date, gMonthDay or gDay; else NaN -->
+ day-in-month : <xsl:value-of select="date:day-in-month(@date)"/>
+ <!-- dateTime, date; else NaN -->
+ day-of-week-in-month : <xsl:value-of select="date:day-of-week-in-month(@date)"/>
+ <!-- dateTime, date; else NaN -->
+ day-in-week : <xsl:value-of select="date:day-in-week(@date)"/>
+ <!-- dateTime or date; else NaN -->
+ day-name : <xsl:value-of select="date:day-name(@date)"/>
+ <!-- dateTime or date; else NaN -->
+ day-abbreviation : <xsl:value-of select="date:day-abbreviation(@date)"/>
+ <!-- dateTime or time; else '' -->
+ time : <xsl:value-of select="date:time(@date)"/>
+ <!-- dateTime or time; else NaN -->
+ hour-in-day : <xsl:value-of select="date:hour-in-day(@date)"/>
+ <!-- dateTime or time; else NaN -->
+ minute-in-hour : <xsl:value-of select="date:minute-in-hour(@date)"/>
+ <!-- dateTime or time; else NaN -->
+ second-in-minute : <xsl:value-of select="date:second-in-minute(@date)"/>
+</xsl:template>
+
+</xsl:stylesheet>
+
diff --git a/libxslt/tests/exslt/date/time.2.out b/libxslt/tests/exslt/date/time.2.out new file mode 100644 index 0000000..e14b6f8 --- /dev/null +++ b/libxslt/tests/exslt/date/time.2.out @@ -0,0 +1,219 @@ + + + + Test Date : 10:31:07z + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : T10:31:07 + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : 10:31-07 + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : 10:31:07-6:00 + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : 10:31:07-06:00Z + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + + Test Date : 00:00:00+24:00 + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : 24:00:00 + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : 00:60:00 + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : 00:00:60 + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : 99:00:00 + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : 00:99:00 + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : 00:00:99 + year : NaN + leap-year : NaN + month-in-year : NaN + month-name : + month-abbreviation : + week-in-year : NaN + day-in-year : NaN + day-in-month : NaN + day-of-week-in-month : NaN + day-in-week : NaN + day-name : + day-abbreviation : + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN diff --git a/libxslt/tests/exslt/date/time.2.xml b/libxslt/tests/exslt/date/time.2.xml new file mode 100644 index 0000000..d6f19ef --- /dev/null +++ b/libxslt/tests/exslt/date/time.2.xml @@ -0,0 +1,18 @@ +<?xml version="1.0"?>
+<page>
+ <!-- invalid xs:time syntax -->
+ <date date="10:31:07z"/>
+ <date date="T10:31:07"/>
+ <date date="10:31-07"/>
+ <date date="10:31:07-6:00"/>
+ <date date="10:31:07-06:00Z"/>
+ <!-- invalid xs:time values -->
+ <date date="00:00:00+24:00"/>
+ <date date="24:00:00"/>
+ <date date="00:60:00"/>
+ <date date="00:00:60"/>
+ <date date="99:00:00"/>
+ <date date="00:99:00"/>
+ <date date="00:00:99"/>
+</page>
+
diff --git a/libxslt/tests/exslt/date/time.2.xsl b/libxslt/tests/exslt/date/time.2.xsl new file mode 100644 index 0000000..06ffd8d --- /dev/null +++ b/libxslt/tests/exslt/date/time.2.xsl @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="ISO-8859-1"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:date="http://exslt.org/dates-and-times"
+ extension-element-prefixes="date">
+
+<xsl:output method="text"/>
+
+<xsl:template match="date">
+ Test Date : <xsl:value-of select="@date"/>
+ <!-- dateTime, date, gYearMonth or gYear; else NaN -->
+ year : <xsl:value-of select="date:year(@date)"/>
+ <!-- dateTime, date, gYearMonth or gYear; else NaN -->
+ leap-year : <xsl:value-of select="date:leap-year(@date)"/>
+ <!-- dateTime, date, gYearMonth, gMonth or gMonthDay; else NaN -->
+ month-in-year : <xsl:value-of select="date:month-in-year(@date)"/>
+ <!-- dateTime, date, gYearMonth or gMonth; else '' -->
+ month-name : <xsl:value-of select="date:month-name(@date)"/>
+ <!-- dateTime, date, gYearMonth or gMonth; else '' -->
+ month-abbreviation : <xsl:value-of select="date:month-abbreviation(@date)"/>
+ <!-- dateTime or date; else NaN -->
+ week-in-year : <xsl:value-of select="date:week-in-year(@date)"/>
+ <!-- dateTime, date; else NaN -->
+ day-in-year : <xsl:value-of select="date:day-in-year(@date)"/>
+ <!-- dateTime, date, gMonthDay or gDay; else NaN -->
+ day-in-month : <xsl:value-of select="date:day-in-month(@date)"/>
+ <!-- dateTime, date; else NaN -->
+ day-of-week-in-month : <xsl:value-of select="date:day-of-week-in-month(@date)"/>
+ <!-- dateTime, date; else NaN -->
+ day-in-week : <xsl:value-of select="date:day-in-week(@date)"/>
+ <!-- dateTime or date; else NaN -->
+ day-name : <xsl:value-of select="date:day-name(@date)"/>
+ <!-- dateTime or date; else NaN -->
+ day-abbreviation : <xsl:value-of select="date:day-abbreviation(@date)"/>
+ <!-- dateTime or time; else '' -->
+ time : <xsl:value-of select="date:time(@date)"/>
+ <!-- dateTime or time; else NaN -->
+ hour-in-day : <xsl:value-of select="date:hour-in-day(@date)"/>
+ <!-- dateTime or time; else NaN -->
+ minute-in-hour : <xsl:value-of select="date:minute-in-hour(@date)"/>
+ <!-- dateTime or time; else NaN -->
+ second-in-minute : <xsl:value-of select="date:second-in-minute(@date)"/>
+</xsl:template>
+
+</xsl:stylesheet>
+
|