Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / XML / February 2007

Tip: Looking for answers? Try searching our database.

XML and XSL translation

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
David - 24 Feb 2007 15:05 GMT
Hi,

I am trying to do an XML translation. I have not done much with XML apart
from generating a few RSS feeds or saving from datasets.

I have found numerous example on the net about it, all of them very similar.
However, when I use them, they go into response.output rather than a label
or literal. I am trying to drop the output into a literal.

Here is the code I have...

  try
  {
   XPathDocument _SourceXml = new
XPathDocument("http://www.nationalgrid.com/uk/Interconnectors/France/Results/Weekend+Auctions/r
ss.htm
");

   // Load the XSL stylesheet
   XslTransform _Transform = new XslTransform();
   _Transform.Load("http://www.nationalgrid.com/static/xsl/ngcomrss.xsl");

   // Write output to the screen.

   //TextReader tr = new TextReader();
   //StreamReader sr = new StreamReader();
   _Transform.Transform(_SourceXml, null, Response.Output);
   //_Transform.Transform(_SourceXml, null, tr);

   //XMLDisplay.Text = tr.ReadToEnd();

  }
  catch(Exception ex)
  {
   Response.Write(ex.Message);
  }

As you can see, I have tried setting up a stream to drop the output into,
but the compiler is complaining at the "new" word.

As it is, it drops the text at the top of the page. I want to control where
it sits, so I want to drop it in a literal instead. How can I do that?

Thanks.

Signature

Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available

Martin Honnen - 25 Feb 2007 16:56 GMT
> I am trying to do an XML translation. I have not done much with XML apart
> from generating a few RSS feeds or saving from datasets.
>
> I have found numerous example on the net about it, all of them very similar.
> However, when I use them, they go into response.output rather than a label
> or literal. I am trying to drop the output into a literal.

Do you want to use XSLT in an ASP.NET page? Then consider using the Xml
control
<http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.xml.aspx>
For ASP.NET 2.0 there is the eXml control which uses XslCompiledTransform:
<http://www.xmllab.net/Products/eXml/tabid/174/Default.aspx>

Signature

    Martin Honnen --- MVP XML
    http://JavaScript.FAQTs.com/

David - 25 Feb 2007 22:45 GMT
Hi,

Thank you.

This works excellent, plus I also have a fix someone else supplied for my
existing code as well. I have both options available to me now. :-)

Signature

Best regards,
Dave Colliver.
http://www.AberdeenFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available

>> I am trying to do an XML translation. I have not done much with XML apart
>> from generating a few RSS feeds or saving from datasets.
[quoted text clipped - 10 lines]
> For ASP.NET 2.0 there is the eXml control which uses XslCompiledTransform:
> <http://www.xmllab.net/Products/eXml/tabid/174/Default.aspx>

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.