Project

Profile

Help

Feature #2422

closed

Command line tool

Added by Edward Avis over 9 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Category:
C++ API
Start date:
2015-07-22
Due date:
% Done:

100%

Estimated time:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Found in version:
Fixed in version:
SaxonC Languages:
SaxonC Platforms:
SaxonC Architecture:

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

Transform.c (8.64 KB) Transform.c O'Neil Delpratt, 2015-07-29 19:15

Related issues

Related to SaxonC - Bug #2657: Command line tool: Transform, Query, ValidateClosedO'Neil Delpratt2016-02-29

Actions
Actions #1

Updated by O'Neil Delpratt over 9 years ago

  • 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.

Actions #2

Updated by Edward Avis over 9 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.

Actions #3

Updated by O'Neil Delpratt over 9 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
Actions #4

Updated by O'Neil Delpratt over 9 years ago

There is a bug in the Transform.c file I added to this bug issue. Please fixed file attached.

Actions #5

Updated by O'Neil Delpratt over 9 years ago

  • File deleted (Transform.c)
Actions #6

Updated by Edward Avis over 9 years ago

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.

Actions #7

Updated by O'Neil Delpratt over 9 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.

Actions #8

Updated by O'Neil Delpratt over 8 years ago

We will be adding commandline tool for Saxon/C to the next maintenance release. This will be for Transform, Query and Validate

Actions #9

Updated by O'Neil Delpratt over 8 years ago

  • Related to Bug #2657: Command line tool: Transform, Query, Validate added
Actions #10

Updated by O'Neil Delpratt over 8 years ago

  • 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