Using XSL in VB.net

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Rob

    Using XSL in VB.net

    All I want to do is execute a simple transformation in VB.net.... I know
    this has to be simple.

    I tried the following as suggested by a web page I found....

    Dim xslt as New XslTransform()

    xslt.Load("File name")
    xslt.Transform( "InFile", "ResultFile ")

    This appears to be very straightforward to me.

    However, this causes an error saying the code is obsolete... (I thought the
    whole Framework version concept meant backwards compatability, but I guess
    not.) it further says "You should pass XmlResolver to Transform() method"

    Can anyone tell me how / where / why to add the XmlResolver ?

    Thanks !


  • Martin Honnen

    #2
    Re: Using XSL in VB.net

    Rob wrote:
    All I want to do is execute a simple transformation in VB.net.... I know
    this has to be simple.
    >
    I tried the following as suggested by a web page I found....
    >
    Dim xslt as New XslTransform()
    >
    xslt.Load("File name")
    xslt.Transform( "InFile", "ResultFile ")
    >
    This appears to be very straightforward to me.
    >
    However, this causes an error saying the code is obsolete... (I thought the
    whole Framework version concept meant backwards compatability, but I guess
    not.) it further says "You should pass XmlResolver to Transform() method"
    >
    Can anyone tell me how / where / why to add the XmlResolver ?
    The method overload you use (Transform(Stri ng, String)) is obsolete in
    ..NET 1.x. For security reasons you should use the overload
    Transform(Strin g, String, XmlResolver)
    <http://msdn.microsoft. com/library/default.asp?url =/library/en-us/cpref/html/frlrfSystemXmlX slXslTransformC lassTransformTo pic8.asp>
    that allows you to pass in a third argument, an XmlResolver, to have the
    XSLT document function enabled, or Nothing, to have the XSLT document
    function disabled. So the overload with two arguments has been obsoleted
    in .NET 1.x to allow for better control by your code whether the XSLT
    stylesheet is allowd to use the XSLT document function or not.

    So use e.g.
    xslt.Transform( "InFile", "ResultFile ", New XmlUrlResolver( ))
    to allow the stylesheet to use the XSLT document function or use
    xslt.Transform( "InFile", "ResultFile ", Nothing)
    to disallow it.


    --

    Martin Honnen --- MVP XML

    Comment

    • Rob

      #3
      Re: Using XSL in VB.net

      Thanks Martin...

      "Martin Honnen" <mahotrash@yaho o.dewrote in message
      news:%23Wv7LqxC HHA.3620@TK2MSF TNGP02.phx.gbl. ..
      Rob wrote:
      >All I want to do is execute a simple transformation in VB.net.... I know
      >this has to be simple.
      >>
      >I tried the following as suggested by a web page I found....
      >>
      >Dim xslt as New XslTransform()
      >>
      >xslt.Load("Fil ename")
      >xslt.Transform ("InFile", "ResultFile ")
      >>
      >This appears to be very straightforward to me.
      >>
      >However, this causes an error saying the code is obsolete... (I thought
      >the whole Framework version concept meant backwards compatability, but I
      >guess not.) it further says "You should pass XmlResolver to Transform()
      >method"
      >>
      >Can anyone tell me how / where / why to add the XmlResolver ?
      >
      The method overload you use (Transform(Stri ng, String)) is obsolete in
      .NET 1.x. For security reasons you should use the overload
      Transform(Strin g, String, XmlResolver)
      <http://msdn.microsoft. com/library/default.asp?url =/library/en-us/cpref/html/frlrfSystemXmlX slXslTransformC lassTransformTo pic8.asp>
      that allows you to pass in a third argument, an XmlResolver, to have the
      XSLT document function enabled, or Nothing, to have the XSLT document
      function disabled. So the overload with two arguments has been obsoleted
      in .NET 1.x to allow for better control by your code whether the XSLT
      stylesheet is allowd to use the XSLT document function or not.
      >
      So use e.g.
      xslt.Transform( "InFile", "ResultFile ", New XmlUrlResolver( ))
      to allow the stylesheet to use the XSLT document function or use
      xslt.Transform( "InFile", "ResultFile ", Nothing)
      to disallow it.
      >
      >
      --
      >
      Martin Honnen --- MVP XML
      http://JavaScript.FAQTs.com/

      Comment

      • Martin Honnen

        #4
        Re: Using XSL in VB.net

        Martin Honnen wrote:
        The method overload you use (Transform(Stri ng, String)) is obsolete in
        .NET 1.x.
        Should be "is obsolete in .NET 1.1".

        --

        Martin Honnen --- MVP XML

        Comment

        Working...