本文整理汇总了PHP中XSLTProcessor::transformToUri方法的典型用法代码示例。如果您正苦于以下问题:PHP XSLTProcessor::transformToUri方法的具体用法?PHP XSLTProcessor::transformToUri怎么用?PHP XSLTProcessor::transformToUri使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XSLTProcessor
的用法示例。
在下文中一共展示了XSLTProcessor::transformToUri方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: xsl
/**
* Transformation xsl
*/
static function xsl($xslFile, $dom, $dest = null, $pars = null)
{
$xsl = new DOMDocument("1.0", "UTF-8");
$xsl->load($xslFile);
$proc = new XSLTProcessor();
$proc->importStyleSheet($xsl);
// transpose params
if ($pars && count($pars)) {
foreach ($pars as $key => $value) {
$proc->setParameter('', $key, $value);
}
}
// we should have no errors here
if ($dest) {
$proc->transformToUri($dom, $dest);
} else {
return $proc->transformToXML($dom);
}
}
示例2: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
echo "generate frontend";
echo "\n";
/**
* cvmanager build
*
* take the xml data
* take the xslt
* build index.html
*/
$xslFile = getcwd() . "/mycv.xslt";
$xmlFile = getcwd() . "/data.xml";
$xslDoc = new \DOMDocument();
$xslDoc->load($xslFile);
$xmlDoc = new \DOMDocument();
$xmlDoc->load($xmlFile);
$proc = new \XSLTProcessor();
$proc->importStylesheet($xslDoc);
$proc->transformToUri($xmlDoc, 'file://' . getcwd() . '/frontend/mycv/index.html');
}
示例3: testTransformToUri
public function testTransformToUri()
{
$xslDoc = new DOMDocument();
$xslDoc->load('Stubs/collection.xsl');
$xmlDoc = new DOMDocument();
$xmlDoc->load('Stubs/collection.xml');
$native = new \XSLTProcessor();
$native->importStylesheet($xslDoc);
$native->transformToUri($xmlDoc, 'php://temp');
$nativeResult = file_get_contents('php://temp');
$transpiler = new XsltProcessor();
$transpiler->importStylesheet($xslDoc);
$transpiler->transformToUri($xmlDoc, 'php://temp');
$transpilerResult = file_get_contents('php://temp');
$this->assertEquals($nativeResult, $transpilerResult);
}
示例4: transformToUri
/**
* @param DOMDocument|SimpleXMLElement $doc
* @param string $uri
* @return int
*/
public function transformToUri($doc, $uri)
{
$styleSheet = $this->styleSheetToDomDocument();
$transpiler = $this->createTranspiler($styleSheet);
parent::importStylesheet($this->getTranspiledStyleSheet($transpiler, $styleSheet));
return $transpiler->transform(function () use($doc, $uri) {
return parent::transformToUri($doc, $uri);
});
}
示例5: Getopt
$opts = new Getopt($rules);
$opts->parse();
} catch (Console\Exception\RuntimeException $e) {
exitWithMessage($e->getMessage(), $e->getUsageMessage(), 1);
}
if ($opts->getOption('h')) {
exitWithMessage('tdconv <testdox.html.file.name> <output.file.name>', $opts->getUsageMessage(), 0);
}
$title = false;
$args = $opts->getArguments();
if ($opts->getOption('t')) {
$title = $opts->getOption('t');
unset($args['title']);
}
if (count($args) !== 2) {
exitWithMessage('Expected exactly two arguments, got ' . count($args), $opts->getUsageMessage(), 1000);
}
$testdoxFile = $args[0];
$outputFile = $args[1];
//get the xml translation
$xsldoc = new \DOMDocument();
$xsldoc->load(dirname(__FILE__) . '/xsl/tdconv.xsl');
$xmldoc = new \DOMDocument();
$xmldoc->loadHTMLFile($testdoxFile);
$xsl = new \XSLTProcessor();
$xsl->importStyleSheet($xsldoc);
if ($title !== false) {
$xsl->setParameter('', 'title', $title);
}
$xsl->transformToUri($xmldoc, $outputFile);