SteveMurphy Posted March 16, 2007 Share Posted March 16, 2007 I want my XSLT to output results to a text file, so I'm using the text output method within my stylesheet. To invoke my transformation, I'm using the technique provided in the w3schools XSLT tutorial under the "XSLT - On the Client" Link. The tutorial provides the following invocation: <html><body><script type="text/javascript">// Load XML var xml = new ActiveXObject("Microsoft.XMLDOM")xml.async = falsexml.load("cdcatalog.xml")// Load XSLvar xsl = new ActiveXObject("Microsoft.XMLDOM")xsl.async = falsexsl.load("cdcatalog.xsl")// Transformdocument.write(xml.transformNode(xsl))</script></body></html> Is there a way to use this technique to direct the results to a file instead of to the browser?Thanks! Link to comment Share on other sites More sharing options...
jesh Posted March 16, 2007 Share Posted March 16, 2007 Since you are using ActiveX, I have to assume that you only want this to work in IE. If that's the case, check out the Scripting.FileSystemObject. You can use it to open, read from, and write to files.Use this to create the FSO: var fso;fso = new ActiveXObject("Scripting.FileSystemObject"); Then check out this page for what to do with it:http://www.w3schools.com/asp/asp_ref_filesystem.asp Link to comment Share on other sites More sharing options...
SteveMurphy Posted March 16, 2007 Author Share Posted March 16, 2007 Thanks, Jesh. That worked. Link to comment Share on other sites More sharing options...
jesh Posted March 16, 2007 Share Posted March 16, 2007 Thanks, Jesh. That worked.Hey, no problem. If you plan on making this available to the general public via the Internet, I would suggest moving away from ActiveX and towards a server-side solution like PHP, ASP.NET, etc.In the server-side solution, the user browser would send the XML to the server, the server would then create the file, and then send that file back to the browser as a download. This way it would work for any browser, not just IE. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now