Subject:Calling .Net classes from XSL during a transformation Author:DL Birch Date:01 Aug 2008 11:07 AM
Hello,
A couple softballs from the newbie on the block:
I need to tranform a file ... using the ss mapper how do I:
1) Translate a code value that comes in .. let's say its a string containing "US" representing a 'Country' and in my system I need to translate that to "USA" ...
2) How do I call my own .net classes from within the XSL during a transformation?
Subject:Calling .Net classes from XSL during a transformation Author:(Deleted User) Date:04 Aug 2008 06:54 AM
Hi,
Mapper only supports registering Java extension functions; in order to use .NET extensions functions you need to use the MS .NET processor and follow its documentation (e.g. here http://msdn.microsoft.com/en-us/library/system.xml.xsl.xsltargumentlist.addextensionobject(VS.80).aspx) to invoke the processor from within your .Net code specifying the extension object that the XSLT will use.
As for doing lookup in Mapper, it's doable but it requires a lot of instructions blocks; it's faster to directly write in the text view a compact predicate expression like $allCountries[@id=$thisCountry] (assuming you have a global variable named allCountried containing nodes with an 'id' attribute with the short version and a child text node with the expanded version)
Subject:Calling .Net classes from XSL during a transformation Author:DL Birch Date:04 Aug 2008 12:39 PM
My only question then is (now that I can call my own .net assembly straight from the XSL) is how I can get this to work in the Preview mode of the XSL Mapper tool.
When I run the XSL from my VB.Net app, everything works swell. It just would be nice to be able to test it all right from Stylus Studio ...
Subject:Calling .Net classes from XSL during a transformation Author:DL Birch Date:04 Aug 2008 12:59 PM
My only question then is (now that I can call my own .net assembly straight from the XSL) is how I can get this to work in the Preview mode of the XSL Mapper tool.
When I run the XSL from my VB.Net app, everything works swell. It just would be nice to be able to test it all right from Stylus Studio ...
Subject:Calling .Net classes from XSL during a transformation Author:(Deleted User) Date:05 Aug 2008 04:16 AM
Hi,
as you can see, the extensibility model for the .NET processor requires a that the code that invokes the XSLT processor knows the extension classes, so Mapper cannot do it in a generic way. Your only option is to compile your VB.NET app into an executable and use the "custom processor" entry in the Processor tab of the XSLT scenario to run it.