<%@ Language=VBScript %> <% Option Explicit Dim objWML, objXSL, objCards Dim sCardName, sURL, Temp, i sCardName = Request.QueryString("wml_url").Item sURL = Request.QueryString("url").Item 'For local files If Len(sURL) > 0 And InStr(sURL, "http://") = 0 _ And InStr(sURL, ":\") = 0 Then sURL = Server.MapPath(sURL) End If 'Picks out the Url/Card. If InStr(sURL, "#") Then sCardName = Mid(sUrl, InStr(sURL, "#") + 1) sUrl = Mid(sUrl, 1, InStr(sURL, "#") - 1) End If If Len(sURL) = 0 Then %> <HTML> <HEAD> <TITLE>WAP Emulator</TITLE> </HEAD> <BODY bgcolor=#b0c4de> <font face="Courier New, Courier" size=1> <FORM ACTION="./default.asp" METHOD="GET"> <B>WAP URL: </B> <INPUT SIZE=60 NAME="url" VALUE="./test.wml">&nbsp; <INPUT TYPE="SUBMIT" VALUE="GO!"> </FORM> <% Else Set objWML = Server.CreateObject("Microsoft.XMLDOM") Set objXSL = Server.CreateObject("Microsoft.XMLDOM") objWML.Async = False objWML.Load(sURL) 'Loads the WML document objXSL.Async = False objXSL.ValidateonParse = False objXSL.Load(Server.MapPath("./wml.xsl")) 'Loads the WML XSL. 'Goes through the cards in the WML deck and picks out the 'first (default) card if none has been specified. Set objCards = objWML.documentElement.childNodes For i = 0 To objCards.Length - 1 If (Len(sCardName) = 0 And i = 0) Or LCase(sCardName) = _ LCase(objCards.item(i).attributes.item(0).Text) Then Temp = objCards.Item(i).transformNode(objXSL.documentElement) %> <HTML> <HEAD> <TITLE><%=objCards.item(i).attributes.item(1).Text%></TITLE> </HEAD> <BODY bgcolor=#b0c4de> <font face="Courier New, Courier" size=2> <% Response.Write(Tweak(Temp)) End If Next 'Clean up XMLDOM objects. Set objCards = Nothing Set objXSL = Nothing Set objWML = Nothing End If '=================================================================== Private Function Tweak(sRaw) 'Normalizes the links. sRaw = Replace(sRaw, "HREF=""?wml_url=#", "HREF=""./default.asp?url=" & sURL & "&wml_url=") 'Replaces .wbmp extensons with .gif sRaw = Replace(sRaw, ".wbmp", ".gif") Tweak = sRaw End Function %> </FONT> <BR> <P ALIGN=CENTER> <A HREF="./default.asp"><B>Select a WAP URL</B></A> </P> </BODY> </HTML>