public function fileAsXslFileWithRelativeIncludeDoesNotWork() { $t = NULL; $proc = new DomXSLProcessor(); $style = new \DOMDocument(); $style->load('res://net/xp_framework/unittest/core/resourceprovider/two/IncludingStylesheet.xsl'); $proc->setXSLDoc($style); $proc->setXmlBuf('<document/>'); $proc->run(); $this->assertTrue(FALSE !== strpos($proc->output(), 'Include has been called.')); }
/** * Runs a transformation * * @param string xml * @param string callback * @param string[] arguments * @param string xslEncoding default 'utf-8' * @return string */ protected function runTransformation($xml, $callback, $arguments, $xslEncoding = 'utf-8') { sscanf($callback, '%[^:]::%s', $name, $method); $p = new DomXSLProcessor(); $p->registerInstance('this', $this); $p->setXMLBuf($xml); $p->setXSLBuf(sprintf('<?xml version="1.0" encoding="%s"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:php="http://php.net/xsl" > <xsl:output method="text"/> <xsl:template match="/"> <xsl:value-of select="php:function(\'XSLCallback::invoke\', \'%s\', \'%s\'%s)"/> </xsl:template> </xsl:stylesheet> ', $xslEncoding, $name, $method, $arguments ? ', ' . implode(', ', $arguments) : '')); $p->run(); return $p->output(); }