Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > msxml scripts and xstlArgumentList entension objects. Can I combinethem?

Reply
Thread Tools

msxml scripts and xstlArgumentList entension objects. Can I combinethem?

 
 
steve_h
Guest
Posts: n/a
 
      11-01-2003
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.

 
Reply With Quote
 
 
 
 
John Doe
Guest
Posts: n/a
 
      11-03-2003
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 <(E-Mail Removed)> wrote in message news:<bo12ps$j1j$(E-Mail Removed)-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.

 
Reply With Quote
 
 
 
 
steve_h
Guest
Posts: n/a
 
      11-04-2003


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 <(E-Mail Removed)> wrote in message news:<bo12ps$j1j$(E-Mail Removed)-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.


 
Reply With Quote
 
Kirk Allen Evans [MVP]
Guest
Posts: n/a
 
      11-05-2003
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...b;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" <(E-Mail Removed)> wrote in message
news:bo8ns1$6p7$(E-Mail Removed)-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 <(E-Mail Removed)> wrote in message

news:<bo12ps$j1j$(E-Mail Removed)-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.

>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Python Scripts with IIS - ASP or Python-based CGI scripts withIIS - which makes more sense? davidj411 Python 0 06-27-2008 04:38 PM
How can I find out the current version and SP of MSXML under WinXP ? Harry Zoroc XML 0 12-09-2007 11:27 PM
What is required for perl scripts to run correct when launched from rc scripts on HPUX 11? deanjones7@gmail.com Perl Misc 13 09-10-2007 11:58 AM
Stupid question: Making scripts python-scripts Jan Danielsson Python 8 07-22-2005 12:20 AM
Re: Stupid question: Making scripts python-scripts Jp Calderone Python 0 07-21-2005 02:38 PM



Advertisments