473,320 Members | 1,876 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,320 software developers and data experts.

xml transform using c#

i have a method which is return xml from a dataset.

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.
Nov 11 '05 #1
2 14241
What is it returning from the method? A string, a stream, and XmlDocument,
and XmlNode, an XmlReader?

Supposing that the method returns a string:

string xml = MyMethod();
System.IO.StringReader reader = newStringReader(xml);
System.Xml.XPath.XPathDocument doc = new XPathDocument(reader);

System.Xml.Xsl.XslTransform trans = new XslTransform();
trans.Load(Server.MapPath("myxslt.xslt"));
trans.Transform(doc,null,Response.OutputStream,new XmlUrlResolver());

--
Kirk Allen Evans
www.xmlandasp.net
Read my web log at http://weblogs.asp.net/kaevans


"suzy" <me@nospam.com> wrote in message
news:#P**************@TK2MSFTNGP10.phx.gbl...
i have a method which is return xml from a dataset.

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.

Nov 11 '05 #2
See the MSDN docs [1] for more information on the XmlUrlResolver and its
role in the transformation process.

[1]
http://msdn.microsoft.com/library/en...asp?frame=true
--
Kirk Allen Evans
www.xmlandasp.net
Read my web log at http://weblogs.asp.net/kaevans

"suzy" <me@nospam.com> wrote in message
news:#Y**************@TK2MSFTNGP12.phx.gbl...
Kirk, it worked!

thanks so much.. if you were here I'd kiss you!!! lol

I don't really understand that code though... (ie: the xmlurlresolver
stuff).
That does work, but when I view my source of my HTML page, the
"Kirk Allen Evans" <ka*****@nospamxmlandasp.net> wrote in message
news:O2**************@tk2msftngp13.phx.gbl...
What is it returning from the method? A string, a stream, and

XmlDocument,
and XmlNode, an XmlReader?

Supposing that the method returns a string:

string xml = MyMethod();
System.IO.StringReader reader = newStringReader(xml);
System.Xml.XPath.XPathDocument doc = new XPathDocument(reader);

System.Xml.Xsl.XslTransform trans = new XslTransform();
trans.Load(Server.MapPath("myxslt.xslt"));
trans.Transform(doc,null,Response.OutputStream,new XmlUrlResolver());

--
Kirk Allen Evans
www.xmlandasp.net
Read my web log at http://weblogs.asp.net/kaevans


"suzy" <me@nospam.com> wrote in message
news:#P**************@TK2MSFTNGP10.phx.gbl...
i have a method which is return xml from a dataset.

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.



Nov 11 '05 #3

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

Similar topics

0
by: Xiaolei Li | last post by:
first off, i'm a total newbie at this stuff so excuse any wrong usage of terminology or whatever else. i have a XSL to transform a Document such that all "text" nodes will have a "SPAN" inserted...
2
by: John Lehmann | last post by:
I have an interesting problem. I am performing an XSL transform using the System.Xml.Xsl.Transform class. I have a database that contains the XSL style sheet string. And it seems to work pretty...
1
by: Brian McGuinness | last post by:
I have a question about using the STL transform algorithm in a function. What I want to do is define a group of array classes to represent APL-style arrays (arrays in which the number of...
5
by: KathyB | last post by:
If someone could just explain this to me...I just don't get it! I have an aspx page where I retrieve several session variables and use xmlDocument to transform xml file with xsl file into an...
3
by: Jason S | last post by:
Hello Group, I am just about tearing my hair out with this one and thought someone may have some insight. I have a transform that wasn't working so I grabbed the nearest debugger (xselerator)...
4
by: schneider | last post by:
Anyone know if there is a way to dynamicly create a Xslt template/s and use them as an xml transform with-out use files for the Xslt? All the methods I see use files. I want to create a Xslt...
6
by: tcdevelopment | last post by:
I have a XSLT file that gives expected results when I transform using MSXML V4.0 in a simple vbs file. However when using XslTransform in dotnet, I do not get the same results. The part of the...
4
by: Dean Card | last post by:
Okay, so here is the situation. I have need to do some on-the-fly image creation. I have everything working great except for the last part of it, applying a perspective type transform to the...
12
by: InvalidLastName | last post by:
We have been used XslTransform. .NET 1.1, for transform XML document, Dataset with xsl to HTML. Some of these html contents contain javascript and links. For example: // javascript if (a &gt; b)...
3
KevinADC
by: KevinADC | last post by:
If you are entirely unfamiliar with using Perl to sort data, read the "Sorting Data with Perl - Part One and Two" articles before reading this article. Beginning Perl coders may find this article...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
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...
1
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
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.