ASP XML编程objXML.async = False第1/2页(2)


response.write(HTMLCode)
set source = nothing
%>
</BODY>
</HTML>
contacts.xml
<?xml version="1.0" ?>
<CONTACT_INFO>
<CONTACT>
<NAME>JOHN</NAME>
<PHONE>111-1111-111</PHONE>
</CONTACT>
<CONTACT>
<NAME>SMITH</NAME>
<PHONE>222-2222-222</PHONE>
</CONTACT>
<CONTACT>
<NAME>MIKE</NAME>
<PHONE>333-3333-333</PHONE>
</CONTACT>
</CONTACT_INFO>
经XSL格式化的XML数据
styleContact.asp
<HTML>
<BODY>
<%
sourceFile = server.mapPath("contact.xml")
styleFile = server.mapPath("contact.xsl")
set source = Server.CreateObject("Microsoft.XMLDOM")
source.async = False
source.load(sourceFile)
set style = Server.CreateObject("Microsoft.XMLDOM")
style.async = False
style.load(styleFile)
response.write(source.transformNode(style))
%>
</BODY>
</HTML>
contact.xml
<?xml version="1.0" ?>
<?xml-stylesheet type="text/xsl" href="contact.xsl" ?>
<CONTACT_INFO>
<CONTACT>
<NAME>ZHOU.ZF</NAME>
<PHONE>11111111111</PHONE>
</CONTACT>
<CONTACT>
<NAME>LISTEN</NAME>
<PHONE>22222222222</PHONE>
</CONTACT>
<CONTACT>
<NAME>BUBU</NAME>
<PHONE>33333333333</PHONE>
</CONTACT>
</CONTACT_INFO>
contact.xsl
<?xml version="1.0" ?>
<xsl:template xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<HTML>
<BODY>
<xsl:for-each select="CONTACT_INFO/CONTACT">
<DIV>
<xsl:value-of select="NAME"/>
</DIV>
</xsl:for-each>
</BODY>
</HTML>
</xsl:template>
12下一页阅读全文

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/2823.html