Re: [xsl] C# code and .NET libraries in xslt stylesheet

Subject: Re: [xsl] C# code and .NET libraries in xslt stylesheet
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Mon, 28 Nov 2011 10:07:07 +0000
On 28/11/2011 08:32, Faleqczyk Jakub wrote:

I need some advice in choosing appropriate xslt processor to include to my AHFormatter (

I have to do some crazy stuff with images and there's no way to do it in xslt so I have to implement a function in C# to do these.
The problem is that my Formatter has MSXSL 3.0 included, and this xslt engine supports only scripts in JScript or VBScript and those don't offer me necessary functions.

In C# and .NET I got some Image libraries that would do the job. The problem is that I actually don't know what other xslt engine should I use.

Do you have any advice on what version of Saxon would interpret C# code ? If u do I would appreciate some information about using this function, how to write the code inside the stylesheet, and which version of .NET is available.

any help appreciated

Saxon on .NET can call out to functions written in C#: information on how to do this is here:

You don't write the C# code inside your stylesheet; you write it separately, and link to it from your stylesheet code. And Saxon doesn't interpret it, it simply calls it. We haven't had any reports of any restrictions affecting which versions of .NET you can use.

Getting "reflexive" extension functions to work under .NET (which requires dynamic loading of assemblies) can be tricky, and I would recommend using "integrated" extension functions instead. There are examples in the saxon-resources download file.

Michael Kay

Current Thread