mbugr
mbugr

Reputation: 352

Check xslt file compilation

How i can compile my xslt file ? this problem face me to check if the file already compiled to check error free or not? when try to use xsltc

'xsltc' is not recognized as an internal or external command, operable program or batch file.

My xsl file contain include tage to another xsl file so some online compiler doesn't serve my problem.

There is any way to make that to convert xsl to assembly file?

Upvotes: 1

Views: 1092

Answers (1)

Abel
Abel

Reputation: 57189

'xsltc' is not recognized as an internal or external command, operable program or batch file.

The program xsltc is a commandline program. Add it to your path, or to the directory where you are executing it, or select the path in your command. The result of compiling with xsltc is what they call a translet, a set of classes, which you can use in Java to add to your project.

You tagged your question with C#, you can use XslCompiledTransform in C# to get compile first, and then transform. This will show you whether you have any errors. The MSDN has a couple of examples on how to do this.

There is any way to make that to convert xsl to assembly file?

With Saxon, you can do this in Java, and in .NET you can use XslCompiledTransform.CompileToType and subsequently load it with XslCompiledTransform.Load(Type), also, we are planning to implement it for Exselt, which is a .NET XSLT 3.0 processor.

The typical way XSLT is used within programs is to simply load and compile on program startup (this usually takes no more than a few ms anyway) and then transform multiple times. Whether you do it this way in Java or C# does not matter much. In C# the compiled transform object is thread-safe and can be called with Transform simultaneously from multiple threads.

This approach has the advantage that you do not need to recompile your source if your XSLT changes.

Update (xsltc.exe)

Did you mean Microsoft's xsltc.exe? You can resolve your error above by simply opening a Visual Studio command prompt from your start menu. It will automatically set the correct paths.

After you have compiled your assembly, you can load it by following this MSDN article guideline.

Upvotes: 1

Related Questions