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

Subject: Re: [xsl] C# code and .NET libraries in xslt stylesheet
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Mon, 28 Nov 2011 05:17:51 -0800
> 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.

One can use the standard .NET XSLT processor, implemented in the
XslCompiledTransform class. XslCompiledTransform is considered to be
the fastest XSLT 1.0 processor. It is supported by an extensive IDE
(editor and debugger)  that is part of Visual Studio.

A transformation can be initiated in C# (or any other .NET programming
language) code, or on the command line, using a utility such as Oleg
Tkachenko's nxslt.exe.

Extension objects (whose public methods are accessible to the
transformation)  and written in any .NET programming languges, can be
added before invoking the transformation.

This is the recommended way of adding and using extension objects.
There is a possibility to include inline in the transformation the
source code of extension functions, but this isn't recommended for
large-scale, server-side applications, as it gradually consumes all
available memory -- the dynamic dlls generated for the extension
functions in each invoked transformation cannot be unloaded without
stopping and starting IIS.

Here are some links:

1. The XslCompiledTransform class:
http://msdn.microsoft.com/en-us/library/system.xml.xsl.xslcompiledtransform.a
spx

2. Adding extension methods to an XslCompiledTransform:
http://msdn.microsoft.com/en-us/library/system.xml.xsl.xsltargumentlist.addex
tensionobject.aspx

3. The nxslt.exe utility:
http://xmlwriter.net/user_tools/nxslt.shtml

There are two known XSLT 2.0 processors that are closely related to
.NET -- Saxon.NET and more recently XQSharp. Please, see the related
documentation on the respective websites.


--
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
Never fight an inanimate object
-------------------------------------
To avoid situations in which you might make mistakes may be the
biggest mistake of all
------------------------------------
Quality means doing it right when no one is looking.
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play
-------------------------------------
Facts do not cease to exist because they are ignored.
-------------------------------------
I finally figured out the only reason to be alive is to enjoy it.



2011/11/28 FaleEczyk Jakub <JFalenczyk@xxxxxxxxxxxxxxxx>:
> Hello,
>
> I need some advice in choosing appropriate xslt processor to include to my
AHFormatter (http://www.antennahouse.com/).
>
> 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
>
>
>
> Jakub

Current Thread