[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Using ASP/IIS to dynamically process XML/XSL (was Re: how to
At 04:04 PM 9/13/99 , Mark Stemp wrote:
>Please post some examples! Ok, here is a very simple example. Please note that this requires ASP to be running on an IIS or PWS server. Only HTML is returned, so any client web browser can be used. Place both these files (match.htm and sxml.asp) in a directory on your Web server together with your XML and XSL files. Set permissions for script. Serve match.htm to your browser. *** match.htm *** [HTML and BODY tags deleted] <!-- pass the values by querystring to sxml.asp --> <FORM method="get" action="sxml.asp"> <!-- xmldoc* are the filenames of the XML documents --> <SELECT name="xml"> <OPTION selected value="xmldoc1">XML Doc #1 <OPTION value="xmldoc2">XML Doc #1 <OPTION value="xmldoc3">XML Doc #1 </SELECT> <!-- xsldoc* are the filenames of the XSL stylesheets --> <SELECT name="xsl"> <OPTION selected value="xsldoc1">XSL Doc #1 <OPTION value="xsldoc2">XSL Doc #2 <OPTION value="xsldoc3">XSL Doc #3 </SELECT> <INPUT type="submit" value="Match XML with XSL"> </FORM> [HTML and BODY tags deleted] *** sxml.asp *** [HTML and BODY tags deleted] <!-- debugging starts here, can be deleted --> The XML file is <% =Request.QueryString("xml") %>. <BR> The XSL file is <% =Request.QueryString("xsl") %>. <P><HR><P> <!-- debugging ends here --> <% ' Note that IE5 must be installed on the server for this to work ' Load the XML document, appending .xml to the filename Set objXML = Server.CreateObject("Microsoft.XMLDOM") objXML.async = False objXML.Load(Server.MapPath(Request.QueryString("xml") + ".xml")) If objXML.parseError.errorcode <> 0 Then Response.write("<error/>") End If ' Load the XSL stylesheet, appending .xsl to the filename Set domstyle = Server.CreateObject("Microsoft.XMLDOM") domstyle.async = False domStyle.Load(Server.MapPath(Request.QueryString("xsl") + ".xsl")) If domStyle.parseError.errorcode <> 0 Then Response.write("<error/>") End If ' Dynamically process the XSL against the XML ' only HTML is returned, allowing any web client to be used Response.Write(objXML.transformNode(domStyle)) %> [HTML and BODY tags deleted] James Garriss | The MITRE Corporation | jgarriss @ mitre.org XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|