【发布时间】:2014-09-13 18:17:08
【问题描述】:
我想将当前页面 URL 作为属性传递给 XSL 模板。据我了解,它应该作为参数传递,然后用作属性。
我使用 PHP 加载 XML & XSL 文件:
<?php
$xml = new DOMDocument;
$xml->load('main.xml');
$xsl = new DOMDocument;
$xsl->load('blocks/common.xsl');
$proc = new XSLTProcessor;
$proc->importStyleSheet($xsl);
echo $proc->transformToXML($xml);
?>
例如,如何更改此代码以将 URL 作为名为“current-url”的参数传递?
我在这里看到了很多类似的问题,有不同的解决方案,但到目前为止没有一个对我有用。提前谢谢你。
【问题讨论】:
标签: php xml url xslt parameters