Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 6th, 2003, 02:30 PM
Registered User
 
Join Date: Jun 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to save html output of xslt to file

Afraid I'm fairly new to xml, xslt and java. Need some [hopefully] quick advice.

I'm using the DOM method transformNodeToObject (MSXML 4.0) within a jscript to create some html output. Everything works fine within the script for loading the xml and xsl documents, performing the transform and seeing a WScript.Echo of the results. My final html looks just the way I want it.

[u]Problem</u>: I can't figure out how to save this html output to file on my local C:\ drive. I've tried the DOM save method but this is for saving xml files; and my html doesn't make it through the parser as well-formed data. I'm thinking this has got to be something already figured out...

As a novice I appreciate your advice.
 
Old August 7th, 2003, 12:42 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

If, as you say, the transform is successful then into what object did you transform into. If your results are not xml then you will have to do one of two things, either use the transformNode object to return a string which you can write to a text file using the "Scripting.FileSystemObject" which can then be saved or using a different class for the second argument to the transformNodeToObject. You will need one that implements IStream and the easiest to use in a COM scenario is "Adodb.Stream", available with Adodb versions 2.5 and above.
Once you have created an instance of the stream and output to it then you can save the results to a file. For details of all its methods and examples consult MSDN online.

--

Joe
 
Old August 15th, 2003, 09:14 PM
Registered User
 
Join Date: Aug 2003
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Saving the output of the transform as XML from the DOM will work if you create XHTML (HTML obeying XML rules) in your XSLT.

The rules are simple:
- always use end tags or the special no-content form (<img />)
- always quote attribute values
- always give an attribute a value






Similar Threads
Thread Thread Starter Forum Replies Last Post
how to save a output as .MPP file using SP premnaath SQL Server 2000 1 July 12th, 2007 08:09 AM
Sql query output to XML or HTML file miamikk SQL Language 4 June 6th, 2007 03:58 AM
Save (output to) multiple files from single click moo_desanta Classic ASP Basics 2 June 23rd, 2006 02:00 AM
XSLT Looks right, but no output Alderian72 XSLT 1 June 9th, 2005 08:47 AM
How to save string value as html file? android66 Javascript 0 September 3rd, 2004 12:00 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.