Feature #2422
closed
Fixed in Maintenance Release:
Description
Could Saxon/C include an implementation of the 'saxon' command line XSLT processor? This might be a more lightweight replacement for the Java implementation.
Files
- Category set to C++ API
- Assignee set to O'Neil Delpratt
Hi Edward,
There is no reason why we cannot.
I think one of the questions would be how useful would this interface be in C++ as opposed to just in Java? Initially we thought about this but the motivation of Saxon/C was to provide XSLT 2.0 to the PHP world. One obvious use-case would be on systems where there is not a JVM.
I was thinking of those cases where the command-line tool is invoked programmatically rather than calling into the Saxon library. I expect that is quite common in non-Java programs. Currently it is slow because a JVM has to start up each time you run 'saxon'. A native-compiled 'saxon' program implemented with Saxon/C would be faster, that's all.
- File Transform.c added
- Priority changed from Low to Normal
- % Done changed from 0 to 100
Please find attached the Transform.c which interfaces the Java command line tool in C. You can can compile it as follows:
gcc -m32 -I$jdkdir/include -I$jdkdir/include/linux Transform.c -o Transform -ldl -lc -lsaxon
There is a bug in the Transform.c file I added to this bug issue. Please fixed file attached.
- File deleted (
Transform.c)
Thanks, I can now build and run this on Fedora 20 with
% export jdkdir=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.79-2.5.5.0.fc20.x86_64
% gcc -I$jdkdir/include -I$jdkdir/include/linux Transform.c -o Transform -ldl -lc -lsaxon -L/path/to/libsaxon-HEC_jetpdb
and then run it as for example
% ./Transform -xsl:a.xslt -s:in.xml -o:out.xml
Interestingly, it seems a bit slower than running the Java implementation. I guess the JVM is pretty good at optimizing in the end.
Glad to hear you got it running in the end.
I am not surprised by the performance you are getting. The Java JVM has improved considerably over the last few years. Excelsior Jet have not quite got the performance on par with Java just yet for certain software and that unfortunately includes Saxon. I have provided sample code for Saxon/C which proves the performance issues in Jet of which I think is still on their list of things to investigate.
We will be adding commandline tool for Saxon/C to the next maintenance release. This will be for Transform, Query and Validate
- Related to Bug #2657: Command line tool: Transform, Query, Validate added
- Status changed from New to Closed
This feature has been added in the Saxon/C 1.0.1 maintenance release
Please register to edit this issue
Also available in: Atom
PDF