[請益] 利用php處理XML+XSLT
我要利用PHP讓處理XML+XSL,因為要讓他自動呈現不用自動轉換,所以在網路上找到以下
的程式碼來處理,可是一直會有錯誤Parse error: syntax error, unexpected T_VARIABLE
$xmlfile = file_get_contents("C:\\xampp\\htdocs\\xml_search.xml");
$xslfile = file_get_contents("C:\\xampp\\htdocs\\xml_search.xsl");
$arguments=array("/_xml"=>$xmlfile,"/_xsl"=>$xslfile) ;
$xh = xslt_create();
$result=xslt_process($xh,"arg:/_xml","arg:/_xsl",NULL,$arguments);
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);
我手動轉換是可以正確顯示的,但是想要自動轉換就有問題了
不過我看了超久實在看不出哪裡有問題,麻煩各位幫我看一下 謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.137.56
→
01/16 02:47, , 1F
01/16 02:47, 1F
→
01/16 02:48, , 2F
01/16 02:48, 2F