Accesing C# Code from XSL file

Here should go questions about transforming XML with XSLT and FOP.
FJJCENT
Posts: 25
Joined: Sun Apr 22, 2018 10:17 pm

Accesing C# Code from XSL file

Post by FJJCENT »

Hi everybody, again askin questions, and my question now it's a bit complicates althought also very useful to work in this way, in my company they mix the Xslt code with C# Code so they uses CLITYPE in the namespace of the XSL file in order to access the objects in .Net Libraries so the can use the lib for getting the data from DB or XML files with Linq to Xml and the the xsl file for showing or formatting.

so for accessing to the library they do three steps:

1) stablish an special namespace declaration --> xmlns:client="clitype:Empresa1.Datos.Clients.Client?asm=LibEmpresa"
2) declare te methods to be accessed as static --> public static decimal GetData(int ClientId) { ...} (inside client class)
3) access the methods from inside the XSL file --> <xsl:value-of select="client:GetData(num) />

And it works well in Visual Studio but I can check it with Oxygen, and I wanti to know if is there any way of getting this working in Oxygen for testing all the functionality, because VS doesn't debug XLS.

I currently work with the Oxygen Xml Editor release 11.2 and Saxon PE 9.2 and it recognizes my code but later in the third point client:GetData it doesn't access the method and yields an error message telling that it doesn't find such method.

Best Regards
adrian
Posts: 2855
Joined: Tue May 17, 2005 4:01 pm

Re: Accesing C# Code from XSL file

Post by adrian »

Hi,

I'm afraid we no longer provide technical support for Oxygen v11.2. It has reached its end of life a long time ago, 2012.
I would advise you to configure a transformation scenario and first make sure that the scenario runs in Oxygen and resolves the extension functions. Only after that works you can try and debug it (Debug Scenario). There's no point in going for the debugger if the regular transformation doesn't see the extension functions.

We do not have experience running XSLT with .NET extension functions. We only use Java extension functions. Try to follow the Saxon 9.2 documentation, Saxon 9.2 - Writing extension functions for .NET.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
FJJCENT
Posts: 25
Joined: Sun Apr 22, 2018 10:17 pm

Re: Accesing C# Code from XSL file

Post by FJJCENT »

Hi Adrian, really that I cann't change the Oxygen release because it's the oficial release for my company, the extension between C# and XSLT files work well in Visual Studio and really Works, but without any debug if everything goes well OK but if not you need to guess the reason, so I've checked with Oxygen but in spite of that the Debug Project includes an extensión Windows, it doesn't see the C# objects and yields an error message foreach instance of OBJECT:Funcion() enclosed in the xls file.

So tryng to debug I thought about oxygen, but I think that there is no compatibility.

Regards
Post Reply