summaryrefslogtreecommitdiff
path: root/ext/xsl/tests
diff options
context:
space:
mode:
authorChristian Stocker <chregu@php.net>2003-11-21 12:22:48 +0000
committerChristian Stocker <chregu@php.net>2003-11-21 12:22:48 +0000
commit6f8746a14d0753a817ab409c695a189adcc7cbe3 (patch)
tree148bec63aaaf300a1a4abd10ea2bace2f7ea625d /ext/xsl/tests
parent44ae81871bff86524758b38e7fe326750158695e (diff)
downloadphp-git-6f8746a14d0753a817ab409c695a189adcc7cbe3.tar.gz
added test for exslt support
Diffstat (limited to 'ext/xsl/tests')
-rw-r--r--ext/xsl/tests/exslt.xml10
-rw-r--r--ext/xsl/tests/exslt.xsl46
-rw-r--r--ext/xsl/tests/xslt010.phpt112
3 files changed, 168 insertions, 0 deletions
diff --git a/ext/xsl/tests/exslt.xml b/ext/xsl/tests/exslt.xml
new file mode 100644
index 0000000000..0d9c8eb75b
--- /dev/null
+++ b/ext/xsl/tests/exslt.xml
@@ -0,0 +1,10 @@
+<?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"/>
+</page>
+
diff --git a/ext/xsl/tests/exslt.xsl b/ext/xsl/tests/exslt.xsl
new file mode 100644
index 0000000000..06ffd8d60d
--- /dev/null
+++ b/ext/xsl/tests/exslt.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/ext/xsl/tests/xslt010.phpt b/ext/xsl/tests/xslt010.phpt
new file mode 100644
index 0000000000..7c46d030f4
--- /dev/null
+++ b/ext/xsl/tests/xslt010.phpt
@@ -0,0 +1,112 @@
+--TEST--
+Test 10: EXSLT Support
+--SKIPIF--
+<?php require_once('skipif.inc');
+$proc = new xsltprocessor;
+if (!$proc->hasExsltSupport()) die('skip EXSLT support not available');?>
+--FILE--
+<?php
+echo "Test 10: EXSLT Support";
+
+$dom = new domDocument();
+ $dom->load(dirname(__FILE__)."/exslt.xsl");
+ $proc = new xsltprocessor;
+ $xsl = $proc->importStylesheet($dom);
+
+ $xml = new DomDocument();
+ $xml->load(dirname(__FILE__)."/exslt.xml");
+
+ print $proc->transformToXml($xml);
+--EXPECT--
+Test 10: EXSLT Support
+
+
+ Test Date : 0001-12-31Z
+ year : 1
+ leap-year : false
+ month-in-year : 12
+ month-name : December
+ month-abbreviation : Dec
+ week-in-year : 53
+ 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 : 8
+ 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 : 53
+ 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