Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8050943
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:11:44+00:00 2026-06-05T07:11:44+00:00

I want to convert one xml file into another xml file using xslt.here, i

  • 0

I want to convert one xml file into another xml file using xslt.here, i can able to pass the input document to the XPathDocument and also save the output file in disk by passing outfile into XmlTextWriter.

But now my problem is… i have my input is in string format and i also want output as a string.Instead of passing the location of the input file, i want to pass string that contains the xml data.

so i have to pass string object into xpathDoccument in someway and also get the resultant xml file as a string.Instead of save the output as a file,i want output as a string.

            XPathDocument xpathDoc = new XPathDocument("C:\\InputXml.xml");
            XslCompiledTransform xslt = new XslCompiledTransform();

            string xsltFile = "C:\\conversion.xslt";
            xslt.Load(xsltFile);

            string outputFile = "C:\\myHtml.html";
            XmlTextWriter writer = new XmlTextWriter(outputFile, null);
            xslt.Transform(xpathDoc, null, writer);
            writer.Close();

Please guide me to get out of this issue…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T07:11:46+00:00Added an answer on June 5, 2026 at 7:11 am

    XPathDocument accepts TextReader. You can give a stream as new XPathDocument(new StringReader(xmlstring)). Similarly XmlTextWriter accepts TextWriter. So you can pass a StringWriter.

    –edit–

    var sw = new StringWriter();
    XmlTextWriter writer = new XmlTextWriter(sw);
    xslt.Transform(xpathDoc, null, writer);
    var str= sw.ToString();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In an XSLT, I want to convert an XML document to another one. The
I have an HTML file and i want to convert to XML only using
I want to be able to convert from one currency to another, I found
I'm using FOP to convert XML into a PDF. One of the fields that
I have an HTML file and i want to convert to XML document only
I have three lists that I want to convert into one list. When I
I want to convert this linear loop into a concurrent one: for(Item item :
I want to convert a binary file into an array of ascii charcters .
I want to start jquery slide show on click, using xml file, please anyone
I'm using php to take xml files and convert them into single line tab

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.