xml+asp+xsl实现wap1.2和html页面输出

来源:百度文库 编辑:神马文学网 时间:2024/04/29 14:37:53
xml的资源文件
catalog.xml



bicyle
loveChina,我爱你中国。
中国
Columbia
10.90
1982


bicyle
loveChina,我爱你中国。
中国
Columbia
10.90
1982


catalog_html.xsl














TitleArtist





catalog_wap.xsl










中国,我爱你

bicyle.126.com






index.asp
<%
liulanqi=request.ServerVariables("HTTP_User-Agent")
if Instr(liulanqi,"Mozilla")<>0 then
xls_use="catalog_html.xsl"
else
xls_use="catalog_wap.xsl"
Response.ContentType = "text/vnd.wap.wml"
response.Write("")
response.Write("http://www.wapforum.org/DTD/wml_1.1.xml‘>")
end if
‘Load the XML
set xml = Server.CreateObject("Microsoft.XMLDOM")
xml.async = false
xml.load(Server.MapPath("catalog.xml"))
‘Load the XSL
set xsl = Server.CreateObject("Microsoft.XMLDOM")
xsl.async = false
xsl.load(Server.MapPath(xls_use))
‘Transform the file
Response.Write(xml.transformNode(xsl))
%>
以上文件为以前学习xml后,学着编写的适合ie浏览器和手机、wap模拟器访问演示的程序代码,根据不同的设备生成两种代码。