Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. using .NET XslCompiledTransform?

using .NET XslCompiledTransform?

Scheduled Pinned Locked Moved XML / XSL
xmlquestioncsharphelptutorial
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    CherezZaboro
    wrote on last edited by
    #1

    Sorry for bumb nood question. I can't figure out how to transform an XML that I have in a string variable (not a file) using XSLT that is also in a string (not a file) and get the result as a string as well? All I see there is "Load" methods which take paths to files or XmlReader (which I'm not sure how force to use my strings) or some other wierd stuff. Please help!

    L 1 Reply Last reply
    0
    • C CherezZaboro

      Sorry for bumb nood question. I can't figure out how to transform an XML that I have in a string variable (not a file) using XSLT that is also in a string (not a file) and get the result as a string as well? All I see there is "Load" methods which take paths to files or XmlReader (which I'm not sure how force to use my strings) or some other wierd stuff. Please help!

      L Offline
      L Offline
      led mike
      wrote on last edited by
      #2

      inner wrote:

      XmlReader

      string sxml = "<test>testing this</test>";
      System.IO.StringReader reader = new StringReader(sxml);
      XslCompiledTransform transform = new XslCompiledTransform();
      transform.Load(XmlReader.Create(reader));

      "Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?"
      Colin Angus Mackay in the C# forum

      led mike

      3 1 Reply Last reply
      0
      • L led mike

        inner wrote:

        XmlReader

        string sxml = "<test>testing this</test>";
        System.IO.StringReader reader = new StringReader(sxml);
        XslCompiledTransform transform = new XslCompiledTransform();
        transform.Load(XmlReader.Create(reader));

        "Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?"
        Colin Angus Mackay in the C# forum

        led mike

        3 Offline
        3 Offline
        3nbar A7mad A
        wrote on last edited by
        #3

        I face the same problem... The point I have no solution to till now is making the XslCompiledTransform object put its output in a string variable... :confused: Any idea???

        D 1 Reply Last reply
        0
        • 3 3nbar A7mad A

          I face the same problem... The point I have no solution to till now is making the XslCompiledTransform object put its output in a string variable... :confused: Any idea???

          D Offline
          D Offline
          Dustin Metzgar
          wrote on last edited by
          #4

          Continuing from the previous example:

          string strXml = ...;
          string strXsl = ...;
          XslCompiledTransform trans = new XslCompiledTransform();
          trans.Load(XmlReader.Create(new StringReader(strXsl)));

          StringBuilder sb = new StringBuilder();
          trans.Transform(XmlReader.Create(new StringReader(strXml)), XmlWriter.Create(sb));
          string outXml = sb.ToString();


          Logifusion[^] If not entertaining, write your Congressman.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups