我想打印一個XML使用XSLT文件出來作爲一個HTML嵌套列表,而據我所知道的代碼是正確的,但我得到這個錯誤如何在PHP 5中啓用XSLT功能?
Fatal error: Call to undefined function 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);
?>
提前感謝!
http://www.php.net/manual/en/xslt.installation.php – DampeS8N 2010-12-15 14:43:55