我想使用 xslt 将 xml 文件作为 HTML 嵌套列表打印出来,据我所知代码是正确的,但是我收到了这个错误
致命错误:调用未定义函数 xslt_create()
我认为这意味着 xslt 功能尚未启用。如何在 PHP 中启用这些功能?是否有我需要包含的 php 文件(如 Javascript 库的工作方式)还是更复杂?我在 MediaTemple 托管。
这是我正在使用的 php 代码:
<?php
// Allocate a new XSLT processor
$xh = xslt_create();
// Process the document, returning the result into the $result variable
$result = xslt_process($xh, 'armstrong.xml', 'familyToNestedList.xsl');
if ($result) {
print "SUCCESS, sample.xml was transformed by sample.xsl into the \$result";
print " variable, the \$result variable has the following contents\n<br>\n";
print "<pre>\n";
print $result;
print "</pre>\n";
}
else {
print "Sorry, sample.xml could not be transformed by sample.xsl into";
print " the \$result variable the reason is that " . xslt_error($xh) .
print " and the error code is " . xslt_errno($xh);
}
xslt_free($xh);
?>
提前致谢!