Transforming XML with XSL to String

Discussion in 'ASP .Net' started by Krista Lemieux, Aug 10, 2004.

  1. Hello,

    I am trying to transform XML with XSL to a string
    in .NET. Currently I am using XSLTransform class, but all
    the Transform() methods write to a file. How can I
    Transform it straight to a string without writing to a
    file and then reading back from the file (not to lose out
    on performance).

    Thank you for your help in advance.

    Merci,
    Krista Lemieux
    Krista Lemieux, Aug 10, 2004
    #1
    1. Advertising

  2. Try something like this, the StringWriter is passed into the transform method and returns the transformed xml as a string

    Dim xslt As XslTransform

    Dim writer As New System.IO.StringWriter

    Dim rdr As New IO.StringReader(xml)

    Dim xmlDoc As New xml.XPath.XPathDocument(rdr)

    xslt.Load(YourXSLTFile)

    xslt.Transform(xmlDoc.CreateNavigator, xslArg, writer, Nothing)

    Return writer.ToString



    "Krista Lemieux" <> wrote in message news:334c01c47edf$5260aa10$...
    > Hello,
    >
    > I am trying to transform XML with XSL to a string
    > in .NET. Currently I am using XSLTransform class, but all
    > the Transform() methods write to a file. How can I
    > Transform it straight to a string without writing to a
    > file and then reading back from the file (not to lose out
    > on performance).
    >
    > Thank you for your help in advance.
    >
    > Merci,
    > Krista Lemieux
    Steve Flitcroft, Aug 10, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. dwhitford
    Replies:
    0
    Views:
    369
    dwhitford
    May 14, 2004
  2. Xamalaek
    Replies:
    0
    Views:
    383
    Xamalaek
    May 14, 2004
  3. Xamalaek
    Replies:
    1
    Views:
    447
    Patrick TJ McPhee
    May 19, 2004
  4. OKI
    Replies:
    1
    Views:
    536
    Rolf Magnus
    Jun 14, 2004
  5. OKI
    Replies:
    0
    Views:
    387
Loading...

Share This Page