[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] How to save output of XSLT to file


Subject: RE: [xsl] How to save output of XSLT to file
From: Pieter Reint Siegers Kort <pieter.siegers@xxxxxxxxxxx>
Date: Wed, 26 Jan 2005 10:11:48 -0600

Hi Thadthong,

Following is an example I used on ASP.NET 1.x, with the XML Web server
control which is capable o doing transformations XSLT 1.0. First, an xml
source is loaded into an XmlDocument using a SQL Query Template, which
executes a SQL query and returns the data in xml format. Then, the snippet
that starts with XmlTextWriter shows how to persist the output to disk in
ASP.NET. Finally, the XML Web Server contol is used to perform the
transformation and show the output on the screen.

string strUrlXmlTemplateArticle = "http://" +
System.Configuration.ConfigurationSettings.AppSettings["strLocalHost"] +
"/docnet2/templates/tmpl.xml";
XmlDocument doc = new XmlDocument();
doc.Load(strUrlXmlTemplateArticle);
			
XmlTextWriter writer = new
XmlTextWriter(Server.MapPath("/docnet/xml/tmpl.xml"),
System.Text.Encoding.UTF8);
writer.Formatting = Formatting.Indented;
writer.Indentation = 2;
doc.Save(writer);
writer.Close();
				
XmlOD.Document = doc;
XmlOD.Transform = (XslTransform)Cache["aplXslTransform"];

HTH,
<prs/>

-----Original Message-----
From: Thadthong Bhrammanee [mailto:st018570@xxxxxxxxx] 
Sent: Wednesday, January 26, 2005 6:58 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] How to save output of XSLT to file 



Hi,

I'm using asp.net (let's say "tran.aspx") for displaying the transformation
outputs (one in text and one in html, according to <xsl:output
method="..">).

Please advice the way I can save those transformation outputs to new files
(e.g., saved.txt).

I appreciate your advice.

J.



----------------------------------------------------------
This mail sent through AIT WebMail : http://www.ait.ac.th/


Current Thread
Keywords