Re: .net 2 and C# - how to show results of xslt as web page?
- From: "John Saunders" <john.saunders at trizetto.com>
- Date: Wed, 23 Aug 2006 12:51:13 -0400
"imissphp" <imissphp@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:E9299933-B544-4A1C-A25A-A8D4A61A10AD@xxxxxxxxxxxxxxxx
I am using Visual Studio 2005 .NET 2.0. and C#.
Has anybody transformed xml using xsl and shown the results as a web page?
It should be a simple task.... but I can't find a way through the maze of
deprecated or incompatible classes in .NET
I have a dataset object (which has a GetXml() method which returns rows as
a
xml string) that I want to transform using an xsl file. Then I want the
results in my web page. What is the best way to do this? When I copy
examples
I find, I can't build because various classes are deprecated. So I replace
them with recommended alternatives and then they are incompatible.
I have tried using many different classes to do this with no success. This
is my latest attempt:
XmlDocument x = new XmlDocument();
x.LoadXml(ds.GetXml()); //ds is a Dataset object
// can't use XslTransform anymore, have to use XslCompiledTransform
XslCompiledTransform myXslTransform = new XslCompiledTransform();
myXslTransform.Load("questions.xsl");
StringWriter stringWriter = new StringWriter();
myXslTransform.Transform(x, null, stringWriter);
outputLabel.Text = stringWriter.ToString();
The ouputLabel is set to the raw xml data with the xml tags stripped and
with no transformation... not what I want. The transformation works fine
when
done browser side in IE.
This sounds like your transform didn't work. Have you tried debugging it?
You can set breakpoints and everything. Just open it in VS.NET 2005, set
breakpoints, attach to aspnet_wp (or w3wp) and go.
John
.
- Prev by Date: does this xpath query work in .Net 2.0?
- Next by Date: Re: Replace All XML Data
- Previous by thread: Re: .net 2 and C# - how to show results of xslt as web page?
- Next by thread: Re: .net 2 and C# - how to show results of xslt as web page?
- Index(es):
Relevant Pages
|