Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 6th, 2003, 02:30 PM
Registered User
Join Date: Jun 2003
Location: , , .
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.
Reply With Quote
  #2 (permalink)  
Old August 7th, 2003, 12:42 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts

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.


Reply With Quote
  #3 (permalink)  
Old August 15th, 2003, 09:14 PM
Registered User
Join Date: Aug 2003
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts

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

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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

All times are GMT -4. The time now is 11:23 AM.

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