xsl transform

S

suzy

i have a method which is return xml from a dataset using the dataset.GetXml
method.

can someone please post some example code of how i can transform this xml
using an xsl stylesheet?

i am only interested in the c# part of the code, not the xsl.

please note that my xml is coming from a method, not from a xml file.

thanks.
 
S

suzy

Hi Nicholas...

Thanks for your help... but any change of some sample code? I am new to
..net and have been looking for a working solution on the net but I just
can't get it to work... its so annoying!

when i try it, either there is a problem about xmlresolver, or im trying to
create an abstract class, or something or another... im having nothing but
problems.

:-(


Nicholas Paldino said:
Suzy,

If you have the XML in a string, then you can wrap that in a
StringReader class instance and then pass that XML to an XML document
instance. Also, you can load your transformation into an instance of the
XslTransform class. Once you have that, you can call one of the various
Transform overloads and pass your XmlDocument instance to it, transforming
it.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

suzy said:
i have a method which is return xml from a dataset using the dataset.GetXml
method.

can someone please post some example code of how i can transform this xml
using an xsl stylesheet?

i am only interested in the c# part of the code, not the xsl.

please note that my xml is coming from a method, not from a xml file.

thanks.
 
N

Nicholas Paldino [.NET/C# MVP]

Suzy,

Check out the section of the .NET framework documentation titled "XSLT
Transformations with the XslTransform Class", located at (watch for line
wrap):

http://msdn.microsoft.com/library/d...nxslttransformationswithxsltransformclass.asp


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

suzy said:
Hi Nicholas...

Thanks for your help... but any change of some sample code? I am new to
.net and have been looking for a working solution on the net but I just
can't get it to work... its so annoying!

when i try it, either there is a problem about xmlresolver, or im trying to
create an abstract class, or something or another... im having nothing but
problems.

:-(


in message news:[email protected]...
Suzy,

If you have the XML in a string, then you can wrap that in a
StringReader class instance and then pass that XML to an XML document
instance. Also, you can load your transformation into an instance of the
XslTransform class. Once you have that, you can call one of the various
Transform overloads and pass your XmlDocument instance to it, transforming
it.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

suzy said:
i have a method which is return xml from a dataset using the dataset.GetXml
method.

can someone please post some example code of how i can transform this xml
using an xsl stylesheet?

i am only interested in the c# part of the code, not the xsl.

please note that my xml is coming from a method, not from a xml file.

thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top