Project

Profile

Help

Example of calling .NET Instance-Level Method

Added by Anonymous over 13 years ago

Legacy ID: #9742105 Legacy Poster: Bruno Chatel (bcha)

Hi, I am trying to implement an extension function using an intance of an object that is passed as a global parameter of my XSLT stylesheet. I have followed the example provided on the wiki http://sourceforge.net/apps/mediawiki/saxon/index.php?title=CallingDotNet but the example is not complete. It only use a static call but never use the instance given as a parameter. For example : in the calling C# code :[code] FileExists.FileExists fs = new FileExists.FileExists(); transformer.SetParameter(new QName("", "fileUtil"), XdmAtomicValue.wrapExternalObject(fs)[/code]); now in the XSLT stylesheet, we can get the fileUtil parameter[code] <xsl:param name="fileUtil" required="yes"[/code]/> but how to use it ? 1/ If FileExists class has a non-static method doing something for an instance of FileExist. How may I call this method in my XSLT stylesheet ? 2/ If I want to pass $fileUtil to a different static extension function, how must it be called ? I have tried but it raises an exception[code] Error in call to extension function : Method access is illegal[/code] [i] Context : Use of Saxon B 9.1.0.6 .NET XSLT 2.0[/i] Thanks in advance Regards -- bruno --


Please register to reply