473,241 Members | 1,608 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,241 software developers and data experts.

XSLT Dataset - need help by transform

Hi,

May some one could help me.

I want to transform data, coming from SQL Server and loaded to a dataset
wiuth xslt.

After that, I want convert it by a xslt style sheet, and store it back or in
a new dataset.

SqlXmlAdapter ad = new SqlXmlAdapter(cmd);

ad.Fill(dsXML);

XslTransform tf = new XstTransform();

tf.Load( @"..\..\MapServices.xsl" );

DataSet ds = new DataSet();

ds.ReadXml(tf.Transform(###What do need here###);

There is no output file or input file, is just in memory a string or a
dataset.

Thank you

Matthias


Nov 12 '05 #1
3 3175
"Matthias Marx" <ma**@matthiasmarx.com> wrote in message news:es**************@TK2MSFTNGP14.phx.gbl...
ad.Fill(dsXML);
XslTransform tf = new XstTransform();
tf.Load( @"..\..\MapServices.xsl" );
DataSet ds = new DataSet();
ds.ReadXml(tf.Transform(###What do need here###); : : There is no output file or input file, is just in memory a string or a
dataset.


XslTransform( ) returns void, so it needs to be on a separate line
from the ReadXml( ) call. One solution would use the StringReader
and StringWriter classes from the System.IO namespace, like this:

StringWriter sw = new StringWriter( );
tf.Transform( new XmlDataDocument( dsXML), null, new XmlTextWriter( sw));
ds.ReadXml( new StringReader( sw.ToString( )));
Derek Harmon
Nov 12 '05 #2
Derek Harmon wrote:
XslTransform( ) returns void, so it needs to be on a separate line
from the ReadXml( ) call. One solution would use the StringReader
and StringWriter classes from the System.IO namespace, like this:

StringWriter sw = new StringWriter( );
tf.Transform( new XmlDataDocument( dsXML), null, new XmlTextWriter( sw));
ds.ReadXml( new StringReader( sw.ToString( )));


Yes, but this requires an interim string buffer and
serializing/reparsing of the transformation result. Actually one can
avoid both using XslTransform.Transform() methods, which return
XmlReader. Then it's just

ds.ReadXml(tf.Transform(new XmlDataDocument(dsXML), null));

--
Oleg Tkachenko [XML MVP, MCP]
http://blog.tkachenko.com
Nov 12 '05 #3
"Oleg Tkachenko [MVP]" <oleg@no_!spam!_please!tkachenko.com> wrote in message news:%2****************@TK2MSFTNGP10.phx.gbl...
Derek Harmon wrote:
XslTransform( ) returns void, so it needs to be on a separate line
from the ReadXml( ) call. One solution would use the StringReader
: : Actually one can avoid both using XslTransform.Transform() methods, which
return XmlReader.


I stand corrected, there are in fact two overloads of Transform( ) in
1.0 which do return an XmlReader. My mistake, I hadn't noticed them
and took for granted all of its overloads returned void. Clearly, the
overload returning an XmlReader directly would perform much better. :-)
Derek Harmon
Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Wil | last post by:
I'm very new to developing in .NET and even newer to XML. The past few days have been pretty frustrating for me because I'm trying to perform a transform on data in a dataset and it's not working....
2
by: sam | last post by:
Hi, I've been buried in xsl and xslt articles for several days now, and am still unsure as to what I need to do... Basically, my vb.net app loads up an XML file from an external source...
2
by: Patrick J. Schouten | last post by:
I am trying to transfor an XML document prior to loading into a Dataset. My problem stems from the known bug in Visual Studio that prevents loading a well formed XML because of duplicate child...
0
by: Brendan Reynolds | last post by:
I have a web service that takes the XML representation of a dataset and uses XSLT to transform it to the format required to open a disconnected ADODB recordset on the XML, and returns the...
0
by: Rocio | last post by:
I have a dataset with 5 columns. The first 4 columns are simply string columns, but the last one is another dataset with 4 simple columns. The problem is that, the XSLT transform only reads data...
7
by: Doug Heeren | last post by:
I have the following section of VB.NET code that transforms a simple dataset into an Excel xml workbook. It works fine for < 50 rows or so, but I have about 8,000 rows I need to transform. Is there...
4
by: | last post by:
Hi Guys, I am using XSLT to render my XML dataset at the client side to HTML code. When I am trying to load the XslTransform with an Xslt file, it gives me the following error. >>>> The...
3
by: Ian Roddis | last post by:
Hello, I want to embed SQL type queries within an XML data record. The XML looks something like this: <DISPLAYPAGE> <FIELD NAME="SERVER" TYPE="DROPDOWN"> <OPTION>1<OPTION> <OPTION>2<OPTION>...
3
by: thomas.porschberg | last post by:
Hi, I want to read records from a database and export it in an arbitrary format. My idea was to feed a class with a String array fetched from the database and let this class fire SAX events as...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.