XSLT is a very convenient tool for XML conversion. it is implemented through javastprocessor in PHP. XSLT has many built-in useful functions. at the same time, you only need to call the r... XSLT is a very convenient tool for XML conversion. it is implemented through XSLTProcessor in PHP. XSLT has many built-in useful functions. at the same time, you only need to call the registerPHPFunctions method of the XSLTProcessor instance, we can directly use PHP functions in XSLT, which greatly enhances the processing capability of XSLT.
However, when using PHP functions in XSLT, many people encounter the following two errors:
(1), Warning: effectprocessor: transformToXml (): xmlXPathCompiledEval: 1 objects left on the stack.
(2), PHP Warning: effectprocessor: transformToXml (): xmlXPathCompOpEval: function bound to undefined prefix php in ....
bob
joe
EOB; $xsl = <<
Users
EOB; $xmldoc = DOMDocument::loadXML($xml); $xsldoc = DOMDocument::loadXML($xsl); $proc = new XSLTProcessor(); $proc->registerPHPFunctions(); $proc->importStyleSheet($xsldoc); echo $proc->transformToXML($xmldoc);
In fact, this error occurs because we have not defined the PHP namespace.
Add xmlns: php = "http://php.net/xsl" to solve this problem, that is
Tutorial address:
Reprinted! But please include the article address ^