com php-src: added test for bug #53965: ext/xsl/tests/53965/collection.xml ext/xsl/tests/53965/collection.xsl ext/xsl/tests/53965/include.xsl
ext/xsl/tests/bug53965.phpt
| From: | Anatol Belski | Date: | Tue, 01 Apr 2014 08:08:08 +0000 |
| Subject: | com php-src: added test for bug #53965: ext/xsl/tests/53965/collection.xml ext/xsl/tests/53965/collection.xsl ext/xsl/tests/53965/include.xsl ext/xsl/tests/bug53965.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-76668@lists.php.net to get a copy of this message | ||
Commit: fca1501ed6ab2018cc114899fe8fc1f203befb6b
Author: Anatol Belski <ab@php.net> Tue, 1 Apr 2014 10:08:08 +0200
Parents: 3cb056f523d470a677a1c7fc186ce2720fece535
Branches: PHP-5.4 PHP-5.5 PHP-5.6 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=fca1501ed6ab2018cc114899fe8fc1f203befb6b
Log:
added test for bug #53965
Bugs:
https://bugs.php.net/53965
Changed paths:
A ext/xsl/tests/53965/collection.xml
A ext/xsl/tests/53965/collection.xsl
A ext/xsl/tests/53965/include.xsl
A ext/xsl/tests/bug53965.phpt
Diff:
diff --git a/ext/xsl/tests/53965/collection.xml b/ext/xsl/tests/53965/collection.xml
new file mode 100644
index 0000000..a3039cd
--- /dev/null
+++ b/ext/xsl/tests/53965/collection.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<collection>
+ <cd>
+ <title>Fight for your mind</title>
+ <artist>Ben Harper</artist>
+ <year>1995</year>
+ </cd>
+ <cd>
+ <title>Electric Ladyland</title>
+ <artist>Jimi Hendrix</artist>
+ <year>1997</year>
+ </cd>
+</collection>
\ No newline at end of file
diff --git a/ext/xsl/tests/53965/collection.xsl b/ext/xsl/tests/53965/collection.xsl
new file mode 100644
index 0000000...5474f86
--- /dev/null
+++ b/ext/xsl/tests/53965/collection.xsl
@@ -0,0 +1,11 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+ <xsl:include href="include.xsl"/>
+
+ <xsl:param name="owner" select="'Nicolas Eliaszewicz'"/>
+ <xsl:output method="html" encoding="iso-8859-1" indent="no"/>
+ <xsl:template match="collection">
+ Hey! Welcome to <xsl:value-of select="$owner"/>'s sweet CD collection!
+ <xsl:apply-templates/>
+ </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file
diff --git a/ext/xsl/tests/53965/include.xsl b/ext/xsl/tests/53965/include.xsl
new file mode 100644
index 0000000..4a01296
--- /dev/null
+++ b/ext/xsl/tests/53965/include.xsl
@@ -0,0 +1,7 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <xsl:template match="cd">
+ <h1><xsl:value-of select="title"/></h1>
+ <h2>by <xsl:value-of select="artist"/> - <xsl:value-of
select="year"/></h2>
+ <hr />
+ </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file
diff --git a/ext/xsl/tests/bug53965.phpt b/ext/xsl/tests/bug53965.phpt
new file mode 100644
index 0000000..8de777e
--- /dev/null
+++ b/ext/xsl/tests/bug53965.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Bug #53965 (<xsl:include> cannot find files with relative paths when loaded with
"file://")
+--SKIPIF--
+<?php
+if (!extension_loaded('xsl')) die("skip Extension XSL is required\n");
+?>
+--FILE--
+<?php
+
+$base = 'file://' . dirname(__FILE__) . DIRECTORY_SEPARATOR . '53965';
+
+$xml = new DOMDocument();
+$xml->load($base . DIRECTORY_SEPARATOR . 'collection.xml');
+
+$xsl = new DOMDocument();
+$xsl->load($base . DIRECTORY_SEPARATOR . 'collection.xsl');
+
+$proc = new XSLTProcessor;
+$proc->importStyleSheet($xsl);
+
+echo $proc->transformToXML($xml);
+?>
+--EXPECTF--
+Hey! Welcome to Nicolas Eliaszewicz's sweet CD collection!
+
+ <h1>Fight for your mind</h1><h2>by Ben Harper - 1995</h2><hr>
+ <h1>Electric Ladyland</h1><h2>by Jimi Hendrix - 1997</h2><hr>