April 25, 2004

PHP中应用XSLT转换XML的问题

Categories:  ItTech

今天测试PHP中对XSLT的支持,试验下面的代码:

<?php
$xmlfile = realpath("order.xml");
$xslfile = realpath("order.xsl");
$engine = xslt_create();
$output = xslt_process($engine, $xmlfile, $xslfile);
print $output;
xslt_free($engine);
?>

执行出现这个错误:

Warning: Sablotron error on line 1: XML parser error 4: not well-formed (invalid token) in c:\inetpub\wwwroot\test\order.php on line 5.

可是下面的ASP代码却正常运行:


<%@LANGUAGE="JScript"%>
<%

var xmlDoc = Server.CreateObject("Microsoft.XMLDOM");
xmlDoc.async = false;
xmlDoc.load(Server.MapPath("order.xml"));

var xsltDoc = Server.CreateObject("Microsoft.XMLDOM");
xsltDoc.async = false;
xsltDoc.load(Server.MapPath("order.xsl"));
	
Response.write(xmlDoc.transformNode(xsltDoc));

%>

研究了很久,也没有找到问题所在。奇怪……

Posted by dumm at April 25, 2004 10:17 PM
Comments
Post a comment









Remember personal info?




  
Please enter the code as seen in the image above to post your comment.