但是,在 XSLT 中使用 PHP 函数时,很多人会遇到如下两种错误:
(1) Warning: XSLTProcessor::transformToXml(): xmlXPathCompiledEval: 1 objects left o
n the stack.
(2)PHP Warning: XSLTProcessor::transformToXml(): xmlXPathCompOpEval: function func
tion bound to undefined prefix php in ….
| 代码如下 | 复制代码 | |
|
<?php Users
EOB; $xmldoc = DOMDocument::loadXML($xml); $xsldoc = DOMDocument::loadXML($xsl); $proc = new XSLTProcessor(); $proc->registerPHPFunctions(); $proc->importStyleSheet($xsldoc); echo $proc->transformToXML($xmldoc); ?> |
||
其实,出现这种错误,是因为我们没有定义 PHP namespace ,只需要在
| 代码如下 | 复制代码 |
|
xmlns:xsl="http://www.***w3.org/1999/XSL/Transform"> |
|
中增加 xmlns:php="http://php*.net**/xsl" 就能解决此问题, 即
| 代码如下 | 复制代码 |
|
xmlns:xsl="http://www.***w3.org/1999/XSL/Transform" |
|
GitHub仓库权限更改方式实用指南
gitlab项目实现方式添加新成员实用指南
Git中没有commit直接pull,导致自己代码被干掉的解决过程实用指南
tplink5620千兆版有没有itv功能(tplink5620千兆版有itv功能吗)
tplink5620易展版和标准版区别详解(tplink5620易展版和标准版区别是什么)
tplink5620怎么设置无线桥接(tplink5620无线桥接设置方法)