虚位以待(AD)
虚位以待(AD)
首页 > 网页特效 > XML/XSLT > (javascript+asp)XML、XSL转换输出HTML

(javascript+asp)XML、XSL转换输出HTML
类别:XML/XSLT   作者:码皇   来源:互联网   点击:

Javascript客户端转换 [code]<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
Javascript客户端转换

复制代码
代码如下:

<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服务端转换

复制代码
代码如下:

<%
'Load the XML
set xml = Server.CreateObject("Microsoft.XMLDOM")
xml.async = false
xml.load(Server.MapPath("cd_catalog.xml"))
'Load the XSL
set xsl = Server.CreateObject("Microsoft.XMLDOM")
xsl.async = false
xsl.load(Server.MapPath("cd_catalog.xsl"))
'Transform the file
Response.Write(xml.transformNode(xsl))
%>
相关热词搜索: