Command line tool
Could Saxon/C include an implementation of the 'saxon' command line XSLT processor? This might be a more lightweight replacement for the Java implementation.
#1 Updated by O'Neil Delpratt about 5 years ago
- Category set to C++ API
- Assignee set to O'Neil Delpratt
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.
#2 Updated by Edward Avis about 5 years ago
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.
#3 Updated by O'Neil Delpratt about 5 years ago
- 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
#6 Updated by Edward Avis about 5 years ago
Thanks, I can now build and run this on Fedora 20 with
% export jdkdir=/usr/lib/jvm/java-1.7.0-openjdk-126.96.36.199-188.8.131.52.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.
#7 Updated by O'Neil Delpratt about 5 years ago
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.
Please register to edit this issue