2 * xsltproc.c: user program for the XSL Transformation 1.0 engine
4 * See Copyright for the status of this software.
6 * Daniel.Veillard@imag.fr
10 #include <libxml/xmlversion.h>
11 #include <libxml/xmlmemory.h>
12 #include <libxml/debugXML.h>
13 #include <libxslt/xslt.h>
14 #include <libxslt/xsltInternals.h>
15 #include <libxslt/transform.h>
16 #include <libxslt/xsltutils.h>
21 main(int argc, char **argv) {
23 xsltStylesheetPtr cur;
27 for (i = 1; i < argc ; i++) {
28 if ((!strcmp(argv[i], "-debug")) || (!strcmp(argv[i], "--debug"))) {
30 } else if ((!strcmp(argv[i], "-v")) ||
31 (!strcmp(argv[i], "-verbose")) ||
32 (!strcmp(argv[i], "--verbose"))) {
33 xsltSetGenericDebugFunc(stderr, NULL);
36 xmlSubstituteEntitiesDefault(1);
37 for (i = 1; i < argc ; i++) {
38 if ((argv[i][0] != '-') || (strcmp(argv[i], "-") == 0)) {
39 cur = xsltParseStylesheetFile((const xmlChar *)argv[i]);
42 xmlIndentTreeOutput = 1;
44 xmlIndentTreeOutput = 0;
50 for (;i < argc ; i++) {
51 doc = xmlParseFile(argv[i]);
53 fprintf(stderr, "unable to parse %s\n", argv[i]);
56 res = xsltApplyStylesheet(cur, doc);
59 fprintf(stderr, "no result for %s\n", argv[i]);
62 #ifdef LIBXML_DEBUG_ENABLED
64 xmlDebugDumpDocument(stdout, res);
67 xmlDocDump(stdout, res);
72 xsltFreeStylesheet(cur);