Here goes nxslt3.exe/NxsltTask v3.0. It's nxslt tool for .Net 3.5. It can do everything nxslt2/NxsltTask v2.3 can plus the ability to run compiled XSLT stylesheets.
Now short documentation about running compiled XSLT stylesheets.
Let's say you have a stylesheet called mytransform.xsl. First you compile it using nxsltc:
nxsltc mytransform.xsl /out:mytransform.dll
The result is mytransform.dll, containing mytransform class.
-c option says you want to run compiled stylesheet. Instead of XSLT stylesheet file name you pass compiled stylesheet class name (fully qualified if it has a namespace). And you need to specify dll file, where compiled stylesheet can be found.
Of course if you can afford assume things you can make it shorter. If dll is named after stylesheet and can be found in the current directory, you can omit it:
nxslt3 document.xml -c mytransform
Alternatively if dll contains single compiled stylesheet you can specify dll and omit stylesheet:
nxslt3 document.xml -c -af mytransform.dll
If you happens to compile your stylesheets into a strongly named dll:
nxsltc mytransform.xsl /keyfile:d:\keys\test.snk
and then installed it into the GAC, you run it by specifying full or partial dll name after -an option:
And finally. nxslt3 is a free feature-rich .NET 3.5 XSLT command line utility and NAnt/MSBuild task which uses .NET XSLT processor - XslCompiledTransform class and supports XML Base, XInclude, XPointer, EXSLT, compiled stylesheets, embedded stylesheets, processing instruction, multioutput, custom URI resolving, custom extension functions, pretty printing, XHTML output, XSLT 2.0-like character maps and more.
nxslt3.exe/NxsltTask are free tools under BSD license. Download here.
I updated nxsltc - XSLT compiler for .NET 3.5 tool one more time. I added /version:<x.x.x.x> and /keyfile:<file> options. Former is used to specify resulting DLL version and latter - to sign it with a strong name.
D:\>nxsltc.exe /?
XSLT Compiler version 1.0beta2 for .NET 3.5
(c) 2007 Oleg Tkachenko, http://www.xmllab.net
Usage: nxsltc [options]
where possible options include:
/out: Specifies the output file name
/debug[+|-] Emit debugging information
/nowarn Disable all warnings
/namespace: Specifies namespace for compiled stylesheets
/version: Specifies assembly version
/keyfile: Specifies strong name key file
/help Display this usage message (Short form: /?)
/nologo Do not display compiler copyright banner
I also updated nxsltc.exe (well, just rebuilt it using Visual Studio 2008 Beta2).
nXSLTC is an experimental XSLT to MSIL compiler for the forthcoming .NET 3.5. nXSLTC compiles one or more XSLT stylesheets into DLL. Compiled stylesheets then can be used for transforming XML documents using XslCompiledTransform class.
What's the probability of having two car accidents in one month? It must be high enough. Just a month after the first one some asshole hit me and run away. I wonder if it's a bad luck or actually a good luck? Sure, my own car is totaled and a company car doesn't look good either, but hey, I didn't get even a scratch, so I believe I'm a lucky guy.
Ok, back to work. I uploaded version 2.3 of the nxslt2.exe/NxsltTask tool. It's probably the last version for .NET 2.0. Anyway, here is what's new:
nxslt.exe options files (@file option) - useful when your command line gets too long.
XHTML output mode (-xhtml option) - this approach in action.
XSLT 2.0-like character maps (-cm option) - just like in XSLT 2.0, but in a proprietary namespace. I have to blog about this feature.
nxslt and NxsltTask are now debuggable - as it turned out when round-tripping assemblies with ildasm/ilasm there is still a solution to keep them debuggable.
resolving XInclude for XSLT stylesheets is now off by default - because usually nobody needs it and it breaks Docbooks stylesheets.
-xslxi option to turn XInclude for XSLT stylesheets on - if you still want it.
fixed several bugs preventing running Docbook stylesheets - XslCompiledTransfrom + DTD in imported stylesheets and documents loaded via document() function + custom XmlReaders= nightmare.
Oh, just in case: nxslt2 is a free feature-rich .NET 2.0 XSLT command line utility and NAnt/MSBuild task which uses .NET 2.0 XSLT processor - XslCompiledTransform class and supports XML Base, XInclude, XPointer, EXSLT, embedded stylesheets, processing instruction, multioutput, custom URI resolving, custom extension functions, pretty printing, XHTML output, XSLT 2.0-like character maps and more.