Maison  >  Article  >  développement back-end  >  详细介绍(javascript+asp)XML、XSL转换输出HTML的示例代码

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

黄舟
黄舟original
2017-03-15 17:00:371565parcourir

详细介绍(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)) 
%>


Ce qui précède est le contenu détaillé de. pour plus d'informations, suivez d'autres articles connexes sur le site Web de PHP en chinois!

Déclaration:
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn