首页  >  文章  >  后端开发  >  详细介绍(javascript+asp)XML、XSL转换输出HTML的示例代码

详细介绍(javascript+asp)XML、XSL转换输出HTML的示例代码

黄舟
黄舟原创
2017-03-15 17:00:371565浏览

详细介绍(javascript+asp)XML、XSL转换输出HTML的示例代码

代码如下:

<html> 
<body> 
<script language="javascript"> 
// Load XML 
var xml = new ActiveXObject("Microsoft.XMLDOM") 
xml.async = false 
xml.load("cd_catalog.xml") 
// Load the XSL 
var xsl = new ActiveXObject("Microsoft.XMLDOM") 
xsl.async = false 
xsl.load("cd_catalog.xsl") 
// Transform 
document.write(xml.transformNode(xsl)) 
</script> 
</body> 
</html>

Asp服务端转换

代码如下:

<% 
&#39;Load the XML 
set xml = Server.CreateObject("Microsoft.XMLDOM") 
xml.async = false 
xml.load(Server.MapPath("cd_catalog.xml")) 
&#39;Load the XSL 
set xsl = Server.CreateObject("Microsoft.XMLDOM") 
xsl.async = false 
xsl.load(Server.MapPath("cd_catalog.xsl")) 
&#39;Transform the file 
Response.Write(xml.transformNode(xsl)) 
%>


以上是详细介绍(javascript+asp)XML、XSL转换输出HTML的示例代码的详细内容。更多信息请关注PHP中文网其他相关文章!

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn