Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XSLT Compiler for C/C++?

Status
Not open for further replies.

unclejemima

Programmer
Jun 12, 2008
1
US
Does anyone know of an existing XSLT Compiler for C or C++, such that it takes as input an XSL stylesheet and outputs some form of executable code, binary, compiled C code, assembly, shared library, etc. which can then be directly executed to convert XML files?

is a proof-of-concept implementation that has been dead since the year 2000.
I realize there are java, HTML compilers out there that perform the task, but I am under a C/C++ constraint with a speed/efficiency priority, worst case would be using an interpreter or doing inter process communication with a fast java compiler like Gregor/XSLT.

Anyone got any tips or ideas?
 
Have you actually downloaded and built the xsltc project? After a quick look at the code, it seems pretty clean, and might be faster to fix (see the known bugs list) and optimize than to find something newer/more mature. I admit, I did not look at it closely enough to determine how complete it is.
 
Especially if you can find a C/C++ library that will convert an XML file and an XSL file into another file of your choice of type in this many calls:

Code:
            DocumentBuilder builder = factory.newDocumentBuilder();
            document = builder.parse(datafile);

            // Use a Transformer for output
            TransformerFactory tFactory = TransformerFactory.newInstance();
            StreamSource stylesource = new StreamSource(stylesheet);
            Transformer transformer = tFactory.newTransformer(stylesource);

            DOMSource source = new DOMSource(document);
            StreamResult result = new StreamResult(outfile);
            transformer.transform(source, result);

(This is the brains of a nice little Java proggie called Stylizer from the Sun site. You can google for it with the search string "stylizer.java".)
 
See Xalan
especially compiled stylesheets.
Xalan said:
XalanCompiledStylesheet* compiledStylesheet = 0;
compiledStylesheet = theXalanTransformer.compileStylesheet("foo.xsl");
assert(compiledStylesheet!=0);
theXalanTransformer.transform("foo1.xml", *compiledStylesheet, "foo1.out.");
theXalanTransformer.transform("foo2.xml", *compiledStylesheet, "foo2.out");
...
Most likely, Xalan is a heavy-weight solution but it's stabe and fast one.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top