Subject: RE: [xsl] Rendering XML Server Side without using ASP From: "Stuart Celarier" <stuart@xxxxxxxxxxx> Date: Tue, 29 Jan 2002 15:17:16 -0800 |
Brian, I think that you are not clear on all the concepts. A standard HTTP server receives a request for URL, and replies with the file associated with that resource. So it gets a request for an HTML file, and ships that file out. The server does no processing, just send the file. If you want the server to perform processing based on the URL, you need a dynamic HTTP server technology along the lines of ASP. Putting script inside of the HTML files will do nothing on the server side. If you don't have a server that can perform work based on each URL request, then you are, how they say, up the effluent waterway without a means of locomotion. Since you are not in control of the client's configuration, you correctly conclude that you cannot rely on client-side XSLT processing to produce consistent results across browsers and platforms. With ASP (and similar), the file sent to the client is pure HTML. As far as the client is concerned, she can't tell and doesn't care if the HTML page are created dynamically on demand, pulled from a cache of recently generated pages, or if the whole site was generated in batch mode from some other kind of source file. If an ASP-style technology is out of the question, then you need to look at batch generating your site, e.g., using XSLT to transform source XML documents into HTML and uploading them to the server. I have a modest web site that I regenerate every time I edit any part of it. It is not at all "tedious" as you say. Every XML file in the source directory gets transformed into an HTML file in the result directory, then the result directory is ftp'ed up to my server. I can regenerate my site from a single command, and it takes under a minute to produce the files and a little over a minute to upload the files across the network. It runs unattended, so there is no tedium involved. If you are doing the transformation processing on your actual web server, then you can omit step two and just transform the result directly to the correct server directory. Cheers, Stuart -----Original Message----- From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Magick, Brian Sent: Tuesday, January 29, 2002 11:37 To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: [xsl] Rendering XML Server Side without using ASP Hi all: I'm currently looking at alternatives that will speed up the development of a web site for which the information is currently stored in XML. Right now our plans are to use style sheets to render the html pages and load static html pages to our server. Looking at the advantages a dynamic XML solution could provide (i.e. custom queries, not having to transform the XML every time a change occurs, etc...) we would like to load the XML files and render the pages dynamically. Our current solution is restricted because we CANNOT use ASP. We have to work within the confines of simple .html pages. I've found the following JavaScript code that works GREAT for rendering these dynamic pages. I simply change one variable that I pass to the style sheet and the XML renders just fine....IF the user is on IE 5.5 or higher and has at least version 3 of MSXML. Obviously I cannot police this restriction and we have to make sure the site works on BOTH IE and Netscape, and works for users without the version 3 of MSXML. The solution, render the XML server side (our server has MSXML 3+ and can handle the transformation). Does anyone know some snippet of JavaScript code that can handle the server side loading of XML and render it to the client as html without requiring the use of asp or that the client has the right version of MSXML??? If this cannot be done without ASP we might have to resort to a new plan or resign ourselves to tedious XML transformations and loading html pages to the server EVERY time a change occurs within our data. I've seen a few web resources that seem to indicate we can do this, but I have yet to see a concrete example of how to do it. Thanks!!! Brian Magick Here is the current working code I've found on the web for doing all of the above on the client side: <script type="text/javascript"> // Load your XSL var objXSLT = new ActiveXObject("MSXML2.FreeThreadedDomDocument") objXSLT.async = false objXSLT.load("DomainStyleSheet.xslt") // create a compiled XSL-object var objCompiled = new ActiveXObject("MSXML2.XSLTemplate") objCompiled.stylesheet = objXSLT.documentElement // create XSL-processor var objXSLProc = objCompiled.createProcessor() // Load your XML var objXML = new ActiveXObject("MSXML2.FreeThreadedDomDocument") objXML.async = false objXML.load("domains.xml") // input for XSL-processor objXSLProc.input = objXML objXSLProc.addParameter("domain", "Domain1") // etc. // transform objXSLProc.transform() // display document.write(objXSLProc.output) </script> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Rendering XML Server Side, Michael Kay | Thread | RE: [xsl] Rendering XML Server Side, Bryan Rasmussen |
RE: [xsl] Using XSLT Component, Stuart Celarier | Date | Re: [xsl] Getting All Keys In A Key, W. Eliot Kimber |
Month |