1--TEST-- 2Test 11: php:function Support 3--EXTENSIONS-- 4xsl 5--FILE-- 6<?php 7print "Test 11: php:function Support\n"; 8 9$dom = new domDocument(); 10$dom->load(__DIR__."/xslt011.xsl"); 11$proc = new xsltprocessor; 12$xsl = $proc->importStylesheet($dom); 13 14$xml = new DomDocument(); 15$xml->load(__DIR__."/xslt011.xml"); 16$proc->registerPHPFunctions(); 17print $proc->transformToXml($xml); 18 19function foobar($id, $secondArg = "" ) { 20 if (is_array($id)) { 21 return $id[0]->value . " - " . $secondArg; 22 } else { 23 return $id . " - " . $secondArg; 24 } 25} 26function nodeSet($id = null) { 27 if ($id and is_array($id)) { 28 return $id[0]; 29 } else { 30 $dom = new domdocument; 31 $dom->loadXML("<root>this is from an external DomDocument</root>"); 32 return $dom->documentElement; 33 } 34} 35 36class aClass { 37 static function aStaticFunction($id) { 38 return $id; 39 } 40} 41?> 42--EXPECTF-- 43Test 11: php:function Support 44<?xml version="1.0"?> 45foobar - secondArg 46foobar - 47this is from an external DomDocument 48from the Input Document 49static 50