<?xml version="1.0" encoding="gb2312"?> <xsl:stylesheet xmlns:xsl="‘ target=_blank>http://www.w3.org/TR/WD-xsl"> <xsl:template match="/"> <wml> <card id="one" title="This is a first card"> <p align="center"> <xsl:value-of select="CATALOG/CD/TITLE"/><br/> <xsl:value-of select="CATALOG/CD/ARTIST"/><br/> 中國(guó),我愛(ài)你<br/> bicyle.126.com<br/> </p> </card> </wml> </xsl:template> </xsl:stylesheet>
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("<?xml version=‘1.0‘ encoding=‘gb2312‘?>") response.Write("<!DOCTYPE wml PUBLIC ‘-//WAPFORUM//DTD WML 1.1//EN‘ ‘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)) %>