msxml scripts and xstlArgumentList entension objects. Can I combinethem?

Discussion in 'ASP .Net' started by steve_h, Nov 1, 2003.

  1. steve_h

    steve_h Guest

    I think the subject says it all, but just in case:

    I know that I can call my own methods during an XSL transformation
    using

    <xsl:value-of select="myObject.someMethod(arg1)" />

    having done something like:

    dim xslTrans as System.Xml.Xsl.Xsltransform
    dim xsltArg as new System.Xml.XsltArgumentList()
    xsltArg.AddExtensionObject("urn:my-object")
    ....
    dim navigator as System.Xml.Xpath.XPathNavigator = ..

    xslTrans.transform(navigator, xslArg, myWriter, Nothing)

    ....
    public function someMethod( arg as string) as String
    ...
    end function


    and I also know that I can define functions in a script inside
    the xsl file using:

    <msxsl:script language="VisualBasic" implements-prefix="user">
    function myFunc (xx)
    ...
    end function
    </msxsl:script>

    <xsl-value-of select="user:myFunc( elm/@value ) />


    Is there an easy way to combine the two ideas so that my msxml:script
    function calls the method of my extension object ?

    <msxsl:script language="VisualBasic" implements-prefix="user">
    <![CDATA[
    function myFunc (xx)
    myFunc = myObject.someMethod()
    end function
    ]]>
    </msxsl:script>


    Steve.
     
    steve_h, Nov 1, 2003
    #1
    1. Advertising

  2. steve_h

    John Doe Guest

    Re: msxml scripts and xstlArgumentList entension objects. Can I combine them?

    Like you, I would also like an answer to this question...

    Also, does the VS debugger work for you with the contents of the msxsl:script tag ?


    steve_h <> wrote in message news:<bo12ps$j1j$-plus.net>...
    > I think the subject says it all, but just in case:
    >
    > I know that I can call my own methods during an XSL transformation
    > using
    >
    > <xsl:value-of select="myObject.someMethod(arg1)" />
    >
    > having done something like:
    >
    > dim xslTrans as System.Xml.Xsl.Xsltransform
    > dim xsltArg as new System.Xml.XsltArgumentList()
    > xsltArg.AddExtensionObject("urn:my-object")
    > ....
    > dim navigator as System.Xml.Xpath.XPathNavigator = ..
    >
    > xslTrans.transform(navigator, xslArg, myWriter, Nothing)
    >
    > ...
    > public function someMethod( arg as string) as String
    > ...
    > end function
    >
    >
    > and I also know that I can define functions in a script inside
    > the xsl file using:
    >
    > <msxsl:script language="VisualBasic" implements-prefix="user">
    > function myFunc (xx)
    > ...
    > end function
    > </msxsl:script>
    >
    > <xsl-value-of select="user:myFunc( elm/@value ) />
    >
    >
    > Is there an easy way to combine the two ideas so that my msxml:script
    > function calls the method of my extension object ?
    >
    > <msxsl:script language="VisualBasic" implements-prefix="user">
    > <![CDATA[
    > function myFunc (xx)
    > myFunc = myObject.someMethod()
    > end function
    > ]]>
    > </msxsl:script>
    >
    >
    > Steve.
     
    John Doe, Nov 3, 2003
    #2
    1. Advertising

  3. steve_h

    steve_h Guest

    John Doe wrote:
    > Like you, I would also like an answer to this question...
    >
    > Also, does the VS debugger work for you with the contents of the msxsl:script tag ?
    >



    I had't tried it until just now. The only way I could think of doing
    this was using 'step into' xsltTrans.transform(....)', but that doesn't
    work. The callbacks to myObject.someMethod can be debugged if I place a
    breakpoint there, but I can't place break points inside the
    msxsl function because it's only a string inside a data file afa
    devStudio is concerned.




    > steve_h <> wrote in message news:<bo12ps$j1j$-plus.net>...
    >
    >>I think the subject says it all, but just in case:
    >>
    >>I know that I can call my own methods during an XSL transformation
    >>using
    >>
    >><xsl:value-of select="myObject.someMethod(arg1)" />
    >>
    >>having done something like:
    >>
    >> dim xslTrans as System.Xml.Xsl.Xsltransform
    >> dim xsltArg as new System.Xml.XsltArgumentList()
    >> xsltArg.AddExtensionObject("urn:my-object")
    >> ....
    >> dim navigator as System.Xml.Xpath.XPathNavigator = ..
    >>
    >> xslTrans.transform(navigator, xslArg, myWriter, Nothing)
    >>
    >>...
    >> public function someMethod( arg as string) as String
    >> ...
    >> end function
    >>
    >>
    >>and I also know that I can define functions in a script inside
    >>the xsl file using:
    >>
    >> <msxsl:script language="VisualBasic" implements-prefix="user">
    >> function myFunc (xx)
    >> ...
    >> end function
    >> </msxsl:script>
    >>
    >> <xsl-value-of select="user:myFunc( elm/@value ) />
    >>
    >>
    >>Is there an easy way to combine the two ideas so that my msxml:script
    >>function calls the method of my extension object ?
    >>
    >> <msxsl:script language="VisualBasic" implements-prefix="user">
    >> <![CDATA[
    >> function myFunc (xx)
    >> myFunc = myObject.someMethod()
    >> end function
    >> ]]>
    >> </msxsl:script>
    >>
    >>
    >>Steve.
     
    steve_h, Nov 4, 2003
    #3
  4. Re: msxml scripts and xstlArgumentList entension objects. Can I combine them?

    Here is the same reply I put on the microsoft.public.xsl list:

    They are processed very differently by the .NET framework, and you should
    refrain from using msxsl:script elements within XSLT parsed by managed code.
    See Q316775 [1], the assembly cannot be unloaded correctly and may lead to a
    memory leak. There are several design patterns that you can use to mitigate
    the changes, including dynamically loading an assembly that contains your
    extension objects.

    Not that it is impossible to do, but I have not seen any vendors that
    support script debugging in their XSLT products. For example, Marrowsoft's
    Xselerator is one of the best XSLT IDEs and it does not support script
    debugging. I have not seen ActiveState's newest release of their XSLT
    debugger for .NET, but I have not heard about it being able to debug inlined
    script, either.

    Your best bet is to simply use extension objects if you are using .NET.

    [1] http://support.microsoft.com/default.aspx?scid=kb;EN-US;316775

    --
    Kirk Allen Evans
    Microsoft MVP, ASP.NET
    XmlInsider
    www.xmlandasp.net
    Read my web log at http://weblogs.asp.net/kaevans

    "steve_h" <> wrote in message
    news:bo8ns1$6p7$-plus.net...
    >
    >
    > John Doe wrote:
    > > Like you, I would also like an answer to this question...
    > >
    > > Also, does the VS debugger work for you with the contents of the

    msxsl:script tag ?
    > >

    >
    >
    > I had't tried it until just now. The only way I could think of doing
    > this was using 'step into' xsltTrans.transform(....)', but that doesn't
    > work. The callbacks to myObject.someMethod can be debugged if I place a
    > breakpoint there, but I can't place break points inside the
    > msxsl function because it's only a string inside a data file afa
    > devStudio is concerned.
    >
    >
    >
    >
    > > steve_h <> wrote in message

    news:<bo12ps$j1j$-plus.net>...
    > >
    > >>I think the subject says it all, but just in case:
    > >>
    > >>I know that I can call my own methods during an XSL transformation
    > >>using
    > >>
    > >><xsl:value-of select="myObject.someMethod(arg1)" />
    > >>
    > >>having done something like:
    > >>
    > >> dim xslTrans as System.Xml.Xsl.Xsltransform
    > >> dim xsltArg as new System.Xml.XsltArgumentList()
    > >> xsltArg.AddExtensionObject("urn:my-object")
    > >> ....
    > >> dim navigator as System.Xml.Xpath.XPathNavigator = ..
    > >>
    > >> xslTrans.transform(navigator, xslArg, myWriter, Nothing)
    > >>
    > >>...
    > >> public function someMethod( arg as string) as String
    > >> ...
    > >> end function
    > >>
    > >>
    > >>and I also know that I can define functions in a script inside
    > >>the xsl file using:
    > >>
    > >> <msxsl:script language="VisualBasic" implements-prefix="user">
    > >> function myFunc (xx)
    > >> ...
    > >> end function
    > >> </msxsl:script>
    > >>
    > >> <xsl-value-of select="user:myFunc( elm/@value ) />
    > >>
    > >>
    > >>Is there an easy way to combine the two ideas so that my msxml:script
    > >>function calls the method of my extension object ?
    > >>
    > >> <msxsl:script language="VisualBasic" implements-prefix="user">
    > >> <![CDATA[
    > >> function myFunc (xx)
    > >> myFunc = myObject.someMethod()
    > >> end function
    > >> ]]>
    > >> </msxsl:script>
    > >>
    > >>
    > >>Steve.

    >
     
    Kirk Allen Evans [MVP], Nov 5, 2003
    #4
    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. Jan Danielsson
    Replies:
    8
    Views:
    669
    Mike Meyer
    Jul 22, 2005
  2. Jp Calderone
    Replies:
    0
    Views:
    483
    Jp Calderone
    Jul 21, 2005
  3. Harry Zoroc
    Replies:
    0
    Views:
    507
    Harry Zoroc
    Dec 9, 2007
  4. davidj411
    Replies:
    0
    Views:
    584
    davidj411
    Jun 27, 2008
  5. Replies:
    13
    Views:
    581
    Anno Siegel
    Sep 10, 2007
Loading...

Share This Page