]> granicus.if.org Git - php/commitdiff
fixed wrong check
authorChristian Stocker <chregu@php.net>
Sat, 29 Nov 2003 13:01:19 +0000 (13:01 +0000)
committerChristian Stocker <chregu@php.net>
Sat, 29 Nov 2003 13:01:19 +0000 (13:01 +0000)
ext/xsl/tests/prepare.inc
ext/xsl/tests/xslt.xsl
ext/xsl/tests/xslt011.phpt
ext/xsl/tests/xslt011.xml
ext/xsl/tests/xslt011.xsl

index c2e76fd4b3f22b472ed4458a9f1a87f8eacf766b..bd5bbee40cbc88777f9bb448cffa1a0954d15fb7 100644 (file)
@@ -12,7 +12,7 @@ if(!$xsl) {
   exit;
 }
 $proc = new xsltprocessor;
-if(!$xsl) {
+if(!$proc) {
   echo "Error while making xsltprocessor object\n";
   exit;
 }
index 6248a28580bddd1b6117134cd5659ba4428ad497..8331ccc2b56fe2492629c0de94d94f5a69006a80 100644 (file)
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Id: xslt.xsl,v 1.1 2003-10-27 08:46:55 chregu Exp $ -->
+<!-- $Id: xslt.xsl,v 1.2 2003-11-29 13:01:19 chregu Exp $ -->
 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
+
     <xsl:output  method="xml" encoding="iso-8859-1" indent="no"/>
     <xsl:param name="foo" select="'bar'"/>
     <xsl:template match="/">
index a9b9f5767c42244934b723efc29bb3fe203b1b1b..ead84e1d93118cda030606934a99a833af1d8731 100644 (file)
@@ -5,6 +5,10 @@ Test 11: php:function Support
 --FILE--
 <?php
 print "Test 11: php:function Support\n";
+  Class foo {
+       function foo() {}
+       function __toString() { return "not a DomNode object";}
+  }
 
 $dom = new domDocument();
   $dom->load(dirname(__FILE__)."/xslt011.xsl");
@@ -13,7 +17,6 @@ $dom = new domDocument();
   
   $xml = new DomDocument();
   $xml->load(dirname(__FILE__)."/xslt011.xml");
-  
   print $proc->transformToXml($xml);
   function foobar($id ) {
     if (is_array($id)) {
@@ -22,8 +25,23 @@ $dom = new domDocument();
         return $id;
     }
   }
+  function nodeSet($id = null) {
+      if ($id and is_array($id)) {
+          return $id[0];
+      } else {
+          $dom = new domdocument;
+          $dom->loadXML("<root>this is from an external DomDocument</root>");
+          return $dom->documentElement  ;
+      }
+  }
+  function nonDomNode() {
+    return  new foo();
+  }
 --EXPECT--
 Test 11: php:function Support
 <?xml version="1.0"?>
 foobar
 foobar
+this is from an external DomDocument
+from the Input Document
+not a DomNode object
index 134efd02c0d7725106facdc0cd048526dad34f67..f40500b0f5ad0c099bc62693086bfa48d919bfd2 100644 (file)
@@ -1 +1 @@
-<doc id="foobar"></doc>
+<doc id="foobar">This is <i>from the Input Document</i></doc>
index f6da07b266a2cb7b3b7500f1ce0dbc433e47bc49..2d5773f962efd00919fee00e888f28cf342aae6b 100644 (file)
@@ -8,5 +8,14 @@
 <xsl:text>
 </xsl:text>
 <xsl:value-of select="php:function('foobar', /doc/@id)"/>
+<xsl:text>
+</xsl:text>
+<xsl:value-of select="php:function('nodeSet')"/>
+<xsl:text>
+</xsl:text>
+<xsl:value-of select="php:function('nodeSet',/doc)/i"/>
+<xsl:text>
+</xsl:text>
+<xsl:value-of select="php:function('nonDomNode')"/>
 </xsl:template>
 </xsl:stylesheet>