K
kamil.nowicki
Hi there,
I want to create flat txt file from my data stored in my dataset.
I do xslt transformation and i've got sth like that:
(where ds - is my dataset, output.txt - is my result
---------------------------------------------------------------
//Create a new XslTransform object.
XslTransform xslt = new XslTransform();
//Load the stylesheet.
xslt.Load(Application.StartupPath + @"\Temp\xsltFile.xsl");
//Create a new XPathDocument and load the XML data to be transformed.
ds.WriteXml(Application.StartupPath + @"\Temp\officedata.xml");
XPathDocument mydata = new XPathDocument(Application.StartupPath +
@"\Temp\officedata.xml");
//Create an XmlTextWriter
XmlWriter writer = new XmlTextWriter(Application.StartupPath +
@"\Outbox\output.txt" , System.Text.Encoding.ASCII);
//Transform the data.
xslt.Transform(mydata,null,writer, null);
writer.Flush();
writer.Close();
-----------------------------------------------------
How do the same thing without creating temp file officedata.xml?
(create XpathDocument directly from ds.)
and how load xslt file from string instead of xsltFile.xsl?
Does anyone have an idea?
Many thanks,
Kamil
I want to create flat txt file from my data stored in my dataset.
I do xslt transformation and i've got sth like that:
(where ds - is my dataset, output.txt - is my result
---------------------------------------------------------------
//Create a new XslTransform object.
XslTransform xslt = new XslTransform();
//Load the stylesheet.
xslt.Load(Application.StartupPath + @"\Temp\xsltFile.xsl");
//Create a new XPathDocument and load the XML data to be transformed.
ds.WriteXml(Application.StartupPath + @"\Temp\officedata.xml");
XPathDocument mydata = new XPathDocument(Application.StartupPath +
@"\Temp\officedata.xml");
//Create an XmlTextWriter
XmlWriter writer = new XmlTextWriter(Application.StartupPath +
@"\Outbox\output.txt" , System.Text.Encoding.ASCII);
//Transform the data.
xslt.Transform(mydata,null,writer, null);
writer.Flush();
writer.Close();
-----------------------------------------------------
How do the same thing without creating temp file officedata.xml?
(create XpathDocument directly from ds.)
and how load xslt file from string instead of xsltFile.xsl?
Does anyone have an idea?
Many thanks,
Kamil