From a476e34b2eaebfcd05effe37130b993222c7fac7 Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Sun, 15 Jul 2001 18:30:53 +0000 Subject: Integrating EXSLT and cleanup: * Makefile.am configure.in libexslt/Makefile.am: Integration of libexslt in the build system * libxslt/Makefile.am libxslt/xsltproc.c libxslt/xsltutils.c xsltproc/Makefile.am xsltproc/xsltproc.c: Moved xsltproc to a separate directory, linked it to libexslt, and added exslt version reports to -V * tests/*/Makefile.am: updated the path to xsltproc * libexslt/common.c libexslt/exslt.h libexslt/exsltconfig.h.in libexslt/functions.c libexslt/math.c libexslt/sets.c: added versionning informations, some cleanup, and added documentation to a couple of exported functions Daniel --- ChangeLog | 14 ++ Makefile.am | 4 +- configure.in | 27 +++ libexslt/Makefile.am | 3 +- libexslt/common.c | 18 +- libexslt/exslt.h | 5 + libexslt/exsltconfig.h.in | 63 ++++++ libexslt/functions.c | 5 +- libexslt/math.c | 26 ++- libexslt/sets.c | 32 +-- libxslt/Makefile.am | 13 -- libxslt/xsltproc.c | 501 ------------------------------------------ libxslt/xsltutils.c | 2 +- tests/REC/Makefile.am | 8 +- tests/REC1/Makefile.am | 6 +- tests/REC2/Makefile.am | 10 +- tests/XSLTMark/Makefile.am | 82 +++---- tests/docbook/Makefile.am | 22 +- tests/documents/Makefile.am | 10 +- tests/extensions/Makefile.am | 6 +- tests/general/Makefile.am | 6 +- tests/multiple/Makefile.am | 6 +- tests/namespaces/Makefile.am | 6 +- tests/numbers/Makefile.am | 6 +- tests/xmlspec/Makefile.am | 8 +- xsltproc/Makefile.am | 15 ++ xsltproc/xsltproc.c | 510 +++++++++++++++++++++++++++++++++++++++++++ 27 files changed, 784 insertions(+), 630 deletions(-) create mode 100644 libexslt/exsltconfig.h.in delete mode 100644 libxslt/xsltproc.c create mode 100644 xsltproc/Makefile.am create mode 100644 xsltproc/xsltproc.c diff --git a/ChangeLog b/ChangeLog index 95aa7a27..e5227bd4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +Mon Jul 16 14:26:48 CEST 2001 Daniel Veillard + + * Makefile.am configure.in libexslt/Makefile.am: + Integration of libexslt in the build system + * libxslt/Makefile.am libxslt/xsltproc.c libxslt/xsltutils.c + xsltproc/Makefile.am xsltproc/xsltproc.c: + Moved xsltproc to a separate directory, linked it to libexslt, + and added exslt version reports to -V + * tests/*/Makefile.am: updated the path to xsltproc + * libexslt/common.c libexslt/exslt.h libexslt/exsltconfig.h.in + libexslt/functions.c libexslt/math.c libexslt/sets.c: added + versionning informations, some cleanup, and added documentation + to a couple of exported functions + Sun Jul 15 15:27:47 CEST 2001 Thomas Broyer * libexslt/Makefile.am: account for new source files diff --git a/Makefile.am b/Makefile.am index a07dac12..bc271343 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,7 @@ SUBDIRS = \ libxslt \ + libexslt \ + xsltproc \ tests \ doc @@ -11,7 +13,7 @@ bin_SCRIPTS = xslt-config EXTRA_DIST = xsltConf.sh.in xslt-config.in libxslt.spec libxslt.spec.in \ FEATURES TODO COPYING.LIB Copyright IPR \ win32/libxslt/libxslt.def win32/libxslt/libxslt.dsw \ - win32/libxslt/libxslt_so.dsp win32/libxslt/xsltproc.dsp + win32/libxslt/libxslt_so.dsp win32/xsltproc/xsltproc.dsp ## We create xsltConf.sh here and not from configure because we want ## to get the paths expanded correctly. Macros like srcdir are given diff --git a/configure.in b/configure.in index c9cb14b2..4bef1b8d 100644 --- a/configure.in +++ b/configure.in @@ -1,5 +1,8 @@ AC_INIT(libxslt/xslt.c) +dnl +dnl libxslt is the main part of the package +dnl LIBXSLT_MAJOR_VERSION=1 LIBXSLT_MINOR_VERSION=0 LIBXSLT_MICRO_VERSION=0 @@ -16,6 +19,27 @@ AC_SUBST(LIBXSLT_MICRO_VERSION) AC_SUBST(LIBXSLT_VERSION) AC_SUBST(LIBXSLT_VERSION_INFO) AC_SUBST(LIBXSLT_VERSION_NUMBER) + +dnl +dnl libexslt is an extension library +dnl +LIBEXSLT_MAJOR_VERSION=0 +LIBEXSLT_MINOR_VERSION=1 +LIBEXSLT_MICRO_VERSION=0 + +LIBEXSLT_VERSION=$LIBEXSLT_MAJOR_VERSION.$LIBEXSLT_MINOR_VERSION.$LIBEXSLT_MICRO_VERSION +LIBEXSLT_VERSION_INFO=`expr $LIBEXSLT_MAJOR_VERSION + $LIBEXSLT_MINOR_VERSION`:$LIBEXSLT_MICRO_VERSION:$LIBEXSLT_MINOR_VERSION + +LIBEXSLT_VERSION_NUMBER=`expr $LIBEXSLT_MAJOR_VERSION \* 10000 + $LIBEXSLT_MINOR_VERSION \* 100 + $LIBEXSLT_MICRO_VERSION` + +AC_SUBST(LIBEXSLT_MAJOR_VERSION) +AC_SUBST(LIBEXSLT_MINOR_VERSION) +AC_SUBST(LIBEXSLT_MICRO_VERSION) +AC_SUBST(LIBEXSLT_VERSION) +AC_SUBST(LIBEXSLT_VERSION_INFO) +AC_SUBST(LIBEXSLT_VERSION_NUMBER) + + VERSION=${LIBXSLT_VERSION} AM_CONFIG_HEADER(config.h) @@ -182,6 +206,9 @@ Makefile libxslt/Makefile libxslt/xsltconfig.h libxslt/xsltwin32config.h +libexslt/Makefile +libexslt/exsltconfig.h +xsltproc/Makefile tests/Makefile tests/docs/Makefile tests/REC1/Makefile diff --git a/libexslt/Makefile.am b/libexslt/Makefile.am index 444444da..12b6b12b 100644 --- a/libexslt/Makefile.am +++ b/libexslt/Makefile.am @@ -7,7 +7,8 @@ exsltincdir = $(includedir)/libexslt exsltinc_HEADERS = \ exslt.h \ - utils.h + utils.h \ + exsltconfig.h libexslt_la_SOURCES = \ exslt.c \ diff --git a/libexslt/common.c b/libexslt/common.c index 2c791c0e..dc4c2674 100644 --- a/libexslt/common.c +++ b/libexslt/common.c @@ -1,15 +1,23 @@ +#include #include #include #include +#include #include #include #include #include +#include "exsltconfig.h" #include "exslt.h" #include "utils.h" +const char *exsltLibraryVersion = LIBEXSLT_VERSION_STRING; +const int exsltLibexsltVersion = LIBEXSLT_VERSION; +const int exsltLibxsltVersion = LIBXSLT_VERSION; +const int exsltLibxmlVersion = LIBXML_VERSION; + /** * exslNodeSetFunction: * @ctxt: an XPath parser context @@ -18,7 +26,7 @@ * node-set exsl:node-set (result-tree-fragment) * for use by the XPath processor. */ -void +static void exslNodeSetFunction(xmlXPathParserContextPtr ctxt, int nargs){ if (nargs != 1) { xmlXPathSetArityError(ctxt); @@ -32,7 +40,7 @@ exslNodeSetFunction(xmlXPathParserContextPtr ctxt, int nargs){ ctxt->value->boolval = 1; } -void +static void exslObjectTypeFunction (xmlXPathParserContextPtr ctxt, int nargs) { xmlXPathObjectPtr obj, ret; @@ -87,6 +95,12 @@ exslCommonInit (xsltTransformContextPtr ctxt, const xmlChar *URI) { return(NULL); } +/** + * exslCommonRegister: + * + * Registers the EXSLT - Common module + */ + void exslCommonRegister (void) { xsltRegisterExtModule (EXSLT_COMMON_NAMESPACE, diff --git a/libexslt/exslt.h b/libexslt/exslt.h index 2f950ece..36a17bb7 100644 --- a/libexslt/exslt.h +++ b/libexslt/exslt.h @@ -4,6 +4,11 @@ #include +extern const char *exsltLibraryVersion; +extern const int exsltLibexsltVersion; +extern const int exsltLibxsltVersion; +extern const int exsltLibxmlVersion; + #define EXSLT_COMMON_NAMESPACE ((const xmlChar *) "http://exslt.org/common") #define EXSLT_MATH_NAMESPACE ((const xmlChar *) "http://exslt.org/math") #define EXSLT_SETS_NAMESPACE ((const xmlChar *) "http://exslt.org/sets") diff --git a/libexslt/exsltconfig.h.in b/libexslt/exsltconfig.h.in new file mode 100644 index 00000000..0dcf0ce8 --- /dev/null +++ b/libexslt/exsltconfig.h.in @@ -0,0 +1,63 @@ +/* + * exsltconfig.h: compile-time version informations for the EXSLT library + * + * See Copyright for the status of this software. + * + * daniel@veillard.com + */ + +#ifndef __XML_EXSLTCONFIG_H__ +#define __XML_EXSLTCONFIG_H__ + +#ifdef WIN32 +#include +#else +#include "config.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * LIBEXSLT_DOTTED_VERSION: + * + * the version string like "1.2.3" + */ +#define LIBEXSLT_DOTTED_VERSION "@VERSION@" + +/** + * LIBEXSLT_VERSION: + * + * the version number: 1.2.3 value is 1002003 + */ +#define LIBEXSLT_VERSION @LIBEXSLT_VERSION_NUMBER@ + +/** + * LIBEXSLT_VERSION_STRING: + * + * the version number string, 1.2.3 value is "1002003" + */ +#define LIBEXSLT_VERSION_STRING "@LIBEXSLT_VERSION_NUMBER@" + +/** + * ATTRIBUTE_UNUSED: + * + * This macro is used to flag unused function parameters to GCC + */ +#ifdef __GNUC__ +#ifdef HAVE_ANSIDECL_H +#include +#endif +#ifndef ATTRIBUTE_UNUSED +#define ATTRIBUTE_UNUSED +#endif +#else +#define ATTRIBUTE_UNUSED +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __XML_EXSLTCONFIG_H__ */ diff --git a/libexslt/functions.c b/libexslt/functions.c index 42a534ef..96caeafd 100644 --- a/libexslt/functions.c +++ b/libexslt/functions.c @@ -71,7 +71,7 @@ exslFuncInit (xsltTransformContextPtr ctxt, const xmlChar *URI) { * * Shutdown the EXSLT - Functions module */ -static void +static static void exslFuncShutdown (xsltTransformContextPtr ctxt ATTRIBUTE_UNUSED, const xmlChar *URI ATTRIBUTE_UNUSED, exslFuncData *data) { @@ -114,6 +114,7 @@ exslFuncNewFunctionData (void) { ret->nargs = 0; ret->content = NULL; + return(ret); } /** @@ -139,7 +140,7 @@ exslFuncFunctionFunction (xmlXPathParserContextPtr ctxt, int nargs) { data = (exslFuncData *) xsltGetExtData (tctxt, EXSLT_FUNCTIONS_NAMESPACE); oldResult = data->result; - data->result == NULL; + data->result = NULL; func = (exslFuncFunctionData*) xmlHashLookup2 (data->funcs, ctxt->context->functionURI, diff --git a/libexslt/math.c b/libexslt/math.c index 95ce9f5d..1e60f146 100644 --- a/libexslt/math.c +++ b/libexslt/math.c @@ -9,6 +9,9 @@ #include "exslt.h" #include "utils.h" +/* TODO: cleanup when headers change have propagated in a libxml release */ +extern double xmlXPathNAN; + /** * exslMathMin: * @ns: a node-set @@ -20,7 +23,7 @@ * xmlXPathNAN if @ns is NULL or empty or if one of the nodes * turns into NaN. */ -double +static double exslMathMin (xmlNodeSetPtr ns) { double ret, cur; int i; @@ -47,7 +50,7 @@ exslMathMin (xmlNodeSetPtr ns) { * * Wraps #exslMathMin for use by the XPath processor. */ -void +static void exslMathMinFunction (xmlXPathParserContextPtr ctxt, int nargs) { xmlNodeSetPtr ns; double ret; @@ -81,7 +84,7 @@ exslMathMinFunction (xmlXPathParserContextPtr ctxt, int nargs) { * xmlXPathNAN if @ns is NULL or empty or if one of the nodes * turns into NaN. */ -double +static double exslMathMax (xmlNodeSetPtr ns) { double ret, cur; int i; @@ -108,7 +111,7 @@ exslMathMax (xmlNodeSetPtr ns) { * * Wraps #exslMathMax for use by the XPath processor. */ -void +static void exslMathMaxFunction (xmlXPathParserContextPtr ctxt, int nargs) { xmlNodeSetPtr ns; double ret; @@ -138,7 +141,7 @@ exslMathMaxFunction (xmlXPathParserContextPtr ctxt, int nargs) { * Returns the nodes in the node-set whose value is the maximum value * for the node-set. */ -xmlNodeSetPtr +static xmlNodeSetPtr exslMathHighest (xmlNodeSetPtr ns) { xmlNodeSetPtr ret = xmlXPathNodeSetCreate(NULL); double max, cur; @@ -179,7 +182,7 @@ exslMathHighest (xmlNodeSetPtr ns) { * * Wraps #exslMathHighest for use by the XPath processor */ -void +static void exslMathHighestFunction (xmlXPathParserContextPtr ctxt, int nargs) { xmlNodeSetPtr ns, ret; @@ -209,7 +212,7 @@ exslMathHighestFunction (xmlXPathParserContextPtr ctxt, int nargs) { * Returns the nodes in the node-set whose value is the minimum value * for the node-set. */ -xmlNodeSetPtr +static xmlNodeSetPtr exslMathLowest (xmlNodeSetPtr ns) { xmlNodeSetPtr ret = xmlXPathNodeSetCreate(NULL); double min, cur; @@ -250,7 +253,7 @@ exslMathLowest (xmlNodeSetPtr ns) { * * Wraps #exslMathLowest for use by the XPath processor */ -void +static void exslMathLowestFunction (xmlXPathParserContextPtr ctxt, int nargs) { xmlNodeSetPtr ns, ret; @@ -280,8 +283,15 @@ exslMathInit (xsltTransformContextPtr ctxt, const xmlChar *URI) { URI, exslMathHighestFunction); xsltRegisterExtFunction (ctxt, (const xmlChar *) "lowest", URI, exslMathLowestFunction); + return(NULL); } +/** + * exslMathRegister: + * + * Registers the EXSLT - Math module + */ + void exslMathRegister (void) { xsltRegisterExtModule (EXSLT_MATH_NAMESPACE, exslMathInit, NULL); diff --git a/libexslt/sets.c b/libexslt/sets.c index ee7b1511..248cdbec 100644 --- a/libexslt/sets.c +++ b/libexslt/sets.c @@ -20,7 +20,7 @@ * Returns the difference between the two node sets, or nodes1 if * nodes2 is empty */ -xmlNodeSetPtr +static xmlNodeSetPtr exslSetsDifference (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) { xmlNodeSetPtr ret; int i, l1; @@ -50,7 +50,7 @@ exslSetsDifference (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) { * * Wraps #exslSetsDifference for use by the XPath processor */ -void +static void exslSetsDifferenceFunction (xmlXPathParserContextPtr ctxt, int nargs) { xmlNodeSetPtr arg1, arg2, ret; @@ -91,7 +91,7 @@ exslSetsDifferenceFunction (xmlXPathParserContextPtr ctxt, int nargs) { * Returns a node set comprising the nodes that are within both the * node sets passed as arguments */ -xmlNodeSetPtr +static xmlNodeSetPtr exslSetsIntersection (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) { xmlNodeSetPtr ret = xmlXPathNodeSetCreate(NULL); int i, l1; @@ -119,7 +119,7 @@ exslSetsIntersection (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) { * * Wraps #exslSetsIntersection for use by the XPath processor */ -void +static void exslSetsIntersectionFunction (xmlXPathParserContextPtr ctxt, int nargs) { xmlNodeSetPtr arg1, arg2, ret; @@ -158,7 +158,7 @@ exslSetsIntersectionFunction (xmlXPathParserContextPtr ctxt, int nargs) { * Returns a subset of the nodes contained in @nodes, or @nodes if * it is empty */ -xmlNodeSetPtr +static xmlNodeSetPtr exslSetsDistinctSorted (xmlNodeSetPtr nodes) { xmlNodeSetPtr ret; xmlHashTablePtr hash; @@ -214,7 +214,7 @@ exslSetsDistinct (xmlNodeSetPtr nodes) { * * Wraps #exslSetsDistinct for use by the XPath processor */ -void +static void exslSetsDistinctFunction (xmlXPathParserContextPtr ctxt, int nargs) { xmlNodeSetPtr ns, ret; @@ -246,7 +246,7 @@ exslSetsDistinctFunction (xmlXPathParserContextPtr ctxt, int nargs) { * Returns true (1) if @nodes1 shares any node with @nodes2, false (0) * otherwise */ -int +static int exslSetsHasSameNodes (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) { int i, l; xmlNodePtr cur; @@ -271,7 +271,7 @@ exslSetsHasSameNodes (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) { * * Wraps #exslSetsHasSameNodes for use by the XPath processor */ -void +static void exslSetsHasSameNodesFunction (xmlXPathParserContextPtr ctxt, int nargs) { xmlNodeSetPtr arg1, arg2; @@ -314,7 +314,7 @@ exslSetsHasSameNodesFunction (xmlXPathParserContextPtr ctxt, * @nodes if @node is NULL or an empty node-set if @nodes * doesn't contain @node */ -xmlNodeSetPtr +static xmlNodeSetPtr exslSetsNodeLeadingSorted (xmlNodeSetPtr nodes, xmlNodePtr node) { int i, l; xmlNodePtr cur; @@ -370,7 +370,7 @@ exslSetsNodeLeading (xmlNodeSetPtr nodes, xmlNodePtr node) { * in document order, @nodes1 if @nodes2 is NULL or empty or * an empty node-set if @nodes1 doesn't contain @nodes2 */ -xmlNodeSetPtr +static xmlNodeSetPtr exslSetsLeadingSorted (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) { if (xmlXPathNodeSetIsEmpty(nodes2)) return(nodes1); @@ -411,7 +411,7 @@ exslSetsLeading (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) { * * Wraps #exslSetsLeading for use by the XPath processor */ -void +static void exslSetsLeadingFunction (xmlXPathParserContextPtr ctxt, int nargs) { xmlNodeSetPtr arg1, arg2, ret; @@ -452,7 +452,7 @@ exslSetsLeadingFunction (xmlXPathParserContextPtr ctxt, int nargs) { * @nodes if @node is NULL or an empty node-set if @nodes * doesn't contain @node */ -xmlNodeSetPtr +static xmlNodeSetPtr exslSetsNodeTrailingSorted (xmlNodeSetPtr nodes, xmlNodePtr node) { int i, l; xmlNodePtr cur; @@ -549,7 +549,7 @@ exslSetsTrailing (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) { * * Wraps #exslSetsTrailing for use by the XPath processor */ -void +static void exslSetsTrailingFunction (xmlXPathParserContextPtr ctxt, int nargs) { xmlNodeSetPtr arg1, arg2, ret; @@ -596,6 +596,12 @@ exslSetsInit (xsltTransformContextPtr ctxt, const xmlChar *URI) { return(NULL); } +/** + * exslCommonRegister: + * + * Registers the EXSLT - Sets module + */ + void exslSetsRegister (void) { xsltRegisterExtModule (EXSLT_SETS_NAMESPACE, exslSetsInit, NULL); diff --git a/libxslt/Makefile.am b/libxslt/Makefile.am index c10e6a6b..85998436 100644 --- a/libxslt/Makefile.am +++ b/libxslt/Makefile.am @@ -49,16 +49,3 @@ libxslt_la_SOURCES = \ libxslt_la_LIBADD = $(EXTRA_LIBS) libxslt_la_LDFLAGS = -version-info @LIBXSLT_VERSION_INFO@ -# what is this include dir ? -# libxsltincdir = $(includedir)/libxslt - -bin_PROGRAMS = xsltproc - -DEPS = $(lib_LTLIBRARIES) -LDADDS = -L. $(top_builddir)/libxslt/libxslt.la $(EXTRA_LIBS) - -xsltproc_SOURCES = xsltproc.c -xsltproc_LDFLAGS = -xsltproc_DEPENDENCIES = $(DEPS) -xsltproc_LDADD = $(LDADDS) - diff --git a/libxslt/xsltproc.c b/libxslt/xsltproc.c deleted file mode 100644 index b1694b02..00000000 --- a/libxslt/xsltproc.c +++ /dev/null @@ -1,501 +0,0 @@ -/* - * xsltproc.c: user program for the XSL Transformation 1.0 engine - * - * See Copyright for the status of this software. - * - * daniel@veillard.com - */ - -#include "libxslt.h" -#ifdef HAVE_STRING_H -#include -#endif -#ifdef HAVE_SYS_TIME_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif -#ifdef HAVE_STDLIB_H -#include -#endif -#include -#include -#include -#include -#ifdef LIBXML_DOCB_ENABLED -#include -#endif -#ifdef LIBXML_XINCLUDE_ENABLED -#include -#endif -#ifdef LIBXML_CATALOG_ENABLED -#include -#endif -#include -#include -#include -#include -#include - -#ifdef WIN32 -#ifdef _MSC_VER -#include -#pragma comment(lib, "ws2_32.lib") -#define gettimeofday(p1,p2) -#endif /* _MS_VER */ -#else /* WIN32 */ -#include -#endif /* WIN32 */ - -extern int xmlLoadExtDtdDefaultValue; - -static int debug = 0; -static int repeat = 0; -static int timing = 0; -static int novalid = 0; -static int noout = 0; -#ifdef LIBXML_DOCB_ENABLED -static int docbook = 0; -#endif -#ifdef LIBXML_HTML_ENABLED -static int html = 0; -#endif -#ifdef LIBXML_XINCLUDE_ENABLED -static int xinclude = 0; -#endif -static int profile = 0; -static int nonet; -static xmlExternalEntityLoader defaultLoader = NULL; - -static struct timeval begin, end; -static const char *params[16 + 1]; -static int nbparams = 0; -static const char *output = NULL; - -static xmlParserInputPtr -xsltNoNetExternalEntityLoader(const char *URL, const char *ID, - xmlParserCtxtPtr ctxt) { - if (URL != NULL) { - if ((!xmlStrncasecmp((const xmlChar *) URL, - (const xmlChar *) "ftp://", 6)) || - (!xmlStrncasecmp((const xmlChar *) URL, - (const xmlChar *) "http://", 7))) { - fprintf(stderr, "Attempt to load network entity %s \n", URL); - if (nonet) - return(NULL); - } - } - if (defaultLoader != NULL) { - return(defaultLoader(URL, ID, ctxt)); - } - return(NULL); -} - -static void -xsltProcess(xmlDocPtr doc, xsltStylesheetPtr cur, const char *filename) { - xmlDocPtr res; - -#ifdef LIBXML_XINCLUDE_ENABLED - if (xinclude) { - if (timing) - gettimeofday(&begin, NULL); - xmlXIncludeProcess(doc); - if (timing) { - long msec; - - gettimeofday(&end, NULL); - msec = end.tv_sec - begin.tv_sec; - msec *= 1000; - msec += (end.tv_usec - begin.tv_usec) / 1000; - fprintf(stderr, "XInclude processing %s took %ld ms\n", - filename, msec); - } - } -#endif - if (timing) - gettimeofday(&begin, NULL); - if (output == NULL) { - if (repeat) { - int j; - - for (j = 1; j < repeat; j++) { - res = xsltApplyStylesheet(cur, doc, params); - xmlFreeDoc(res); - xmlFreeDoc(doc); -#ifdef LIBXML_HTML_ENABLED - if (html) - doc = htmlParseFile(filename, NULL); - else -#endif -#ifdef LIBXML_DOCB_ENABLED - if (docbook) - doc = docbParseFile(filename, NULL); - else -#endif - doc = xmlParseFile(filename); - } - } - if (profile) { - res = xsltProfileStylesheet(cur, doc, params, stderr); - } else { - res = xsltApplyStylesheet(cur, doc, params); - } - if (timing) { - long msec; - - gettimeofday(&end, NULL); - msec = end.tv_sec - begin.tv_sec; - msec *= 1000; - msec += (end.tv_usec - begin.tv_usec) / 1000; - if (repeat) - fprintf(stderr, - "Applying stylesheet %d times took %ld ms\n", - repeat, msec); - else - fprintf(stderr, - "Applying stylesheet took %ld ms\n", msec); - } - xmlFreeDoc(doc); - if (res == NULL) { - fprintf(stderr, "no result for %s\n", filename); - return; - } - if (noout) { - xmlFreeDoc(res); - return; - } -#ifdef LIBXML_DEBUG_ENABLED - if (debug) - xmlDebugDumpDocument(stdout, res); - else { -#endif - if (cur->methodURI == NULL) { - if (timing) - gettimeofday(&begin, NULL); - xsltSaveResultToFile(stdout, res, cur); - if (timing) { - long msec; - - gettimeofday(&end, NULL); - msec = end.tv_sec - begin.tv_sec; - msec *= 1000; - msec += (end.tv_usec - begin.tv_usec) / 1000; - fprintf(stderr, "Saving result took %ld ms\n", - msec); - } - } else { - if (xmlStrEqual - (cur->method, (const xmlChar *) "xhtml")) { - fprintf(stderr, "non standard output xhtml\n"); - if (timing) - gettimeofday(&begin, NULL); - xsltSaveResultToFile(stdout, res, cur); - if (timing) { - long msec; - - gettimeofday(&end, NULL); - msec = end.tv_sec - begin.tv_sec; - msec *= 1000; - msec += - (end.tv_usec - begin.tv_usec) / 1000; - fprintf(stderr, - "Saving result took %ld ms\n", - msec); - } - } else { - fprintf(stderr, - "Unsupported non standard output %s\n", - cur->method); - } - } -#ifdef LIBXML_DEBUG_ENABLED - } -#endif - - xmlFreeDoc(res); - } else { - xsltRunStylesheet(cur, doc, params, output, NULL, NULL); - if (timing) { - long msec; - - gettimeofday(&end, NULL); - msec = end.tv_sec - begin.tv_sec; - msec *= 1000; - msec += (end.tv_usec - begin.tv_usec) / 1000; - fprintf(stderr, - "Running stylesheet and saving result took %ld ms\n", - msec); - } - xmlFreeDoc(doc); - } -} - -static void usage(const char *name) { - printf("Usage: %s [options] stylesheet file [file ...]\n", name); - printf(" Options:\n"); - printf(" --version or -V: show the version of libxml and libxslt used\n"); - printf(" --verbose or -v: show logs of what's happening\n"); - printf(" --output file or -o file: save to a given file\n"); - printf(" --timing: display the time used\n"); - printf(" --repeat: run the transformation 20 times\n"); - printf(" --debug: dump the tree of the result instead\n"); - printf(" --novalid: skip the Dtd loading phase\n"); - printf(" --noout: do not dump the result\n"); - printf(" --maxdepth val : increase the maximum depth\n"); -#ifdef LIBXML_HTML_ENABLED - printf(" --html: the input document is(are) an HTML file(s)\n"); -#endif -#ifdef LIBXML_DOCB_ENABLED - printf(" --docbook: the input document is SGML docbook\n"); -#endif - printf(" --param name value : pass a (parameter,value) pair\n"); - printf(" --nonet refuse to fetch DTDs or entities over network\n"); - printf(" --warnnet warn against fetching over the network\n"); -#ifdef LIBXML_CATALOG_ENABLED - printf(" --catalogs : use the catalogs from $SGML_CATALOG_FILES\n"); -#endif -#ifdef LIBXML_XINCLUDE_ENABLED - printf(" --xinclude : do XInclude processing on document intput\n"); -#endif - printf(" --profile or --norman : dump profiling informations \n"); -} - -int -main(int argc, char **argv) -{ - int i; - xsltStylesheetPtr cur = NULL; - xmlDocPtr doc, style; - - if (argc <= 1) { - usage(argv[0]); - return (1); - } - - xmlInitMemory(); - - LIBXML_TEST_VERSION - - defaultLoader = xmlGetExternalEntityLoader(); - if (novalid == 0) /* TODO XML_DETECT_IDS | XML_COMPLETE_ATTRS */ - xmlLoadExtDtdDefaultValue = 6; - else - xmlLoadExtDtdDefaultValue = 0; - for (i = 1; i < argc; i++) { - if (!strcmp(argv[i], "-")) - break; - - if (argv[i][0] != '-') - continue; -#ifdef LIBXML_DEBUG_ENABLED - if ((!strcmp(argv[i], "-debug")) || (!strcmp(argv[i], "--debug"))) { - debug++; - } else -#endif - if ((!strcmp(argv[i], "-v")) || - (!strcmp(argv[i], "-verbose")) || - (!strcmp(argv[i], "--verbose"))) { - xsltSetGenericDebugFunc(stderr, NULL); - } else if ((!strcmp(argv[i], "-o")) || - (!strcmp(argv[i], "-output")) || - (!strcmp(argv[i], "--output"))) { - i++; - output = argv[i++]; - } else if ((!strcmp(argv[i], "-V")) || - (!strcmp(argv[i], "-version")) || - (!strcmp(argv[i], "--version"))) { - printf("Using libxml %s and libxslt %s\n", - xmlParserVersion, xsltEngineVersion); - printf - ("xsltproc was compiled against libxml %d and libxslt %d\n", - LIBXML_VERSION, LIBXSLT_VERSION); - printf("libxslt %d was compiled against libxml %d\n", - xsltLibxsltVersion, xsltLibxmlVersion); - } else if ((!strcmp(argv[i], "-repeat")) - || (!strcmp(argv[i], "--repeat"))) { - if (repeat == 0) - repeat = 20; - else - repeat = 100; - } else if ((!strcmp(argv[i], "-novalid")) || - (!strcmp(argv[i], "--novalid"))) { - novalid++; - } else if ((!strcmp(argv[i], "-noout")) || - (!strcmp(argv[i], "--noout"))) { - noout++; -#ifdef LIBXML_DOCB_ENABLED - } else if ((!strcmp(argv[i], "-docbook")) || - (!strcmp(argv[i], "--docbook"))) { - docbook++; -#endif -#ifdef LIBXML_HTML_ENABLED - } else if ((!strcmp(argv[i], "-html")) || - (!strcmp(argv[i], "--html"))) { - html++; -#endif - } else if ((!strcmp(argv[i], "-timing")) || - (!strcmp(argv[i], "--timing"))) { - timing++; - } else if ((!strcmp(argv[i], "-profile")) || - (!strcmp(argv[i], "--profile"))) { - profile++; - } else if ((!strcmp(argv[i], "-norman")) || - (!strcmp(argv[i], "--norman"))) { - profile++; - } else if ((!strcmp(argv[i], "-warnnet")) || - (!strcmp(argv[i], "--warnnet"))) { - xmlSetExternalEntityLoader(xsltNoNetExternalEntityLoader); - } else if ((!strcmp(argv[i], "-nonet")) || - (!strcmp(argv[i], "--nonet"))) { - xmlSetExternalEntityLoader(xsltNoNetExternalEntityLoader); - nonet = 1; -#ifdef LIBXML_CATALOG_ENABLED - } else if ((!strcmp(argv[i], "-catalogs")) || - (!strcmp(argv[i], "--catalogs"))) { - const char *catalogs; - - catalogs = getenv("SGML_CATALOG_FILES"); - if (catalogs == NULL) { - fprintf(stderr, "Variable $SGML_CATALOG_FILES not set\n"); - } else { - xmlLoadCatalogs(catalogs); - } -#endif -#ifdef LIBXML_XINCLUDE_ENABLED - } else if ((!strcmp(argv[i], "-xinclude")) || - (!strcmp(argv[i], "--xinclude"))) { - xinclude++; - xsltSetXIncludeDefault(1); -#endif - } else if ((!strcmp(argv[i], "-param")) || - (!strcmp(argv[i], "--param"))) { - i++; - params[nbparams++] = argv[i++]; - params[nbparams++] = argv[i]; - if (nbparams >= 16) { - fprintf(stderr, "too many params\n"); - return (1); - } - } else if ((!strcmp(argv[i], "-maxdepth")) || - (!strcmp(argv[i], "--maxdepth"))) { - int value; - - i++; - if (sscanf(argv[i], "%d", &value) == 1) { - if (value > 0) - xsltMaxDepth = value; - } - } else { - fprintf(stderr, "Unknown option %s\n", argv[i]); - usage(argv[0]); - return (1); - } - } - params[nbparams] = NULL; - - /* - * Replace entities with their content. - */ - xmlSubstituteEntitiesDefault(1); - - for (i = 1; i < argc; i++) { - if ((!strcmp(argv[i], "-maxdepth")) || - (!strcmp(argv[i], "--maxdepth"))) { - i++; - continue; - } else if ((!strcmp(argv[i], "-o")) || - (!strcmp(argv[i], "-output")) || - (!strcmp(argv[i], "--output"))) { - i++; - continue; - } - if ((!strcmp(argv[i], "-param")) || (!strcmp(argv[i], "--param"))) { - i += 2; - continue; - } - if ((argv[i][0] != '-') || (strcmp(argv[i], "-") == 0)) { - if (timing) - gettimeofday(&begin, NULL); - style = xmlParseFile((const char *) argv[i]); - if (timing) { - long msec; - - gettimeofday(&end, NULL); - msec = end.tv_sec - begin.tv_sec; - msec *= 1000; - msec += (end.tv_usec - begin.tv_usec) / 1000; - fprintf(stderr, "Parsing stylesheet %s took %ld ms\n", - argv[i], msec); - } - if (style == NULL) { - fprintf(stderr, "cannot parse %s\n", argv[i]); - cur = NULL; - } else { - cur = xsltLoadStylesheetPI(style); - if (cur != NULL) { - /* it is an embedded stylesheet */ - xsltProcess(style, cur, argv[i]); - xsltFreeStylesheet(cur); - exit(0); - } - cur = xsltParseStylesheetDoc(style); - if (cur != NULL) { - if (cur->indent == 1) - xmlIndentTreeOutput = 1; - else - xmlIndentTreeOutput = 0; - i++; - } - } - break; - - } - } - - /* - * disable CDATA from being built in the document tree - */ - xmlDefaultSAXHandlerInit(); - xmlDefaultSAXHandler.cdataBlock = NULL; - - if ((cur != NULL) && (cur->errors == 0)) { - for (; i < argc; i++) { - doc = NULL; - if (timing) - gettimeofday(&begin, NULL); -#ifdef LIBXML_HTML_ENABLED - if (html) - doc = htmlParseFile(argv[i], NULL); - else -#endif -#ifdef LIBXML_DOCB_ENABLED - if (docbook) - doc = docbParseFile(argv[i], NULL); - else -#endif - doc = xmlParseFile(argv[i]); - if (doc == NULL) { - fprintf(stderr, "unable to parse %s\n", argv[i]); - continue; - } - if (timing) { - long msec; - - gettimeofday(&end, NULL); - msec = end.tv_sec - begin.tv_sec; - msec *= 1000; - msec += (end.tv_usec - begin.tv_usec) / 1000; - fprintf(stderr, "Parsing document %s took %ld ms\n", - argv[i], msec); - } - xsltProcess(doc, cur, argv[i]); - } - xsltFreeStylesheet(cur); - } - xsltUnregisterAllExtModules(); - xmlCleanupParser(); - xmlMemoryDump(); - return (0); -} - diff --git a/libxslt/xsltutils.c b/libxslt/xsltutils.c index a9285a9e..66762ef2 100644 --- a/libxslt/xsltutils.c +++ b/libxslt/xsltutils.c @@ -1066,7 +1066,7 @@ xsltCalibrateAdjust(long delta) { * * Used for gathering profiling data * - * Returns the number of milliseconds since the beginning of the + * Returns the number of tenth of milliseconds since the beginning of the * profiling */ long diff --git a/tests/REC/Makefile.am b/tests/REC/Makefile.am index fa396a23..eebd41e0 100644 --- a/tests/REC/Makefile.am +++ b/tests/REC/Makefile.am @@ -1,6 +1,6 @@ ## Process this file with automake to produce Makefile.in -$(top_builddir)/libxslt/xsltproc: +$(top_builddir)/xsltproc/xsltproc: @(cd ../../libxslt ; make xsltproc) EXTRA_DIST = \ @@ -71,13 +71,13 @@ EXTRA_DIST = \ all: test -test tests: $(top_builddir)/libxslt/xsltproc +test tests: $(top_builddir)/xsltproc/xsltproc @(echo > .memdump) @(for i in $(srcdir)/*.xsl ; do \ name=`basename $$i .xsl` ; \ if [ ! -f $(srcdir)/$$name.xml ] ; then continue ; fi ; \ echo $$name.xml ; \ - $(top_builddir)/libxslt/xsltproc $(srcdir)/$$name.xsl $(srcdir)/$$name.xml > $$name.res;\ + $(top_builddir)/xsltproc/xsltproc $(srcdir)/$$name.xsl $(srcdir)/$$name.xml > $$name.res;\ if [ ! -f $(srcdir)/$$name.out ] ; then cp $$name.res $(srcdir)/$$name.out ; \ else if [ ! -s $$name.res ] ; then echo "Fatal error, no $$name.res\n" ; \ else diff $(srcdir)/$$name.out $$name.res ; fi ; fi; \ @@ -87,7 +87,7 @@ test tests: $(top_builddir)/libxslt/xsltproc @(for i in $(srcdir)/stand*.xml ; do \ name=`basename $$i .xml` ; \ echo $$name.xml ; \ - $(top_builddir)/libxslt/xsltproc $(srcdir)/$$name.xml > $$name.res;\ + $(top_builddir)/xsltproc/xsltproc $(srcdir)/$$name.xml > $$name.res;\ if [ ! -f $(srcdir)/$$name.stand.out ] ; then cp $$name.res $(srcdir)/$$name.stand.out ; \ else if [ ! -s $$name.res ] ; then echo "Fatal error, no $$name.res\n" ; \ else diff $(srcdir)/$$name.stand.out $$name.res ; fi ; fi; \ diff --git a/tests/REC1/Makefile.am b/tests/REC1/Makefile.am index 91091877..02ee4bdf 100644 --- a/tests/REC1/Makefile.am +++ b/tests/REC1/Makefile.am @@ -1,15 +1,15 @@ ## Process this file with automake to produce Makefile.in -$(top_builddir)/libxslt/xsltproc: +$(top_builddir)/xsltproc/xsltproc: @(cd ../../libxslt ; make xsltproc) EXTRA_DIST = doc.xsl doc.xml doc.dtd result.xml all: test -test tests: $(top_builddir)/libxslt/xsltproc +test tests: $(top_builddir)/xsltproc/xsltproc @(echo > .memdump) - @($(top_builddir)/libxslt/xsltproc $(srcdir)/doc.xsl $(srcdir)/doc.xml > doc.res ; \ + @($(top_builddir)/xsltproc/xsltproc $(srcdir)/doc.xsl $(srcdir)/doc.xml > doc.res ; \ diff $(srcdir)/result.xml doc.res ; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true;\ rm -f doc.res) diff --git a/tests/REC2/Makefile.am b/tests/REC2/Makefile.am index 9cb8e06d..cfaf50f9 100644 --- a/tests/REC2/Makefile.am +++ b/tests/REC2/Makefile.am @@ -1,23 +1,23 @@ ## Process this file with automake to produce Makefile.in -$(top_builddir)/libxslt/xsltproc: +$(top_builddir)/xsltproc/xsltproc: @(cd ../../libxslt ; make xsltproc) EXTRA_DIST = data.xml vrml.xsl vrml.xml svg.xsl svg.xml html.xsl html.xml all: test -test tests: $(top_builddir)/libxslt/xsltproc +test tests: $(top_builddir)/xsltproc/xsltproc @(echo > .memdump) - @($(top_builddir)/libxslt/xsltproc $(srcdir)/vrml.xsl $(srcdir)/data.xml > vrml.res ; \ + @($(top_builddir)/xsltproc/xsltproc $(srcdir)/vrml.xsl $(srcdir)/data.xml > vrml.res ; \ diff $(srcdir)/vrml.xml vrml.res ; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true;\ rm -f vrml.res) - @($(top_builddir)/libxslt/xsltproc $(srcdir)/svg.xsl $(srcdir)/data.xml > svg.res ; \ + @($(top_builddir)/xsltproc/xsltproc $(srcdir)/svg.xsl $(srcdir)/data.xml > svg.res ; \ diff $(srcdir)/svg.xml svg.res ; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true;\ rm -f svg.res) - @($(top_builddir)/libxslt/xsltproc $(srcdir)/html.xsl $(srcdir)/data.xml > html.res ; \ + @($(top_builddir)/xsltproc/xsltproc $(srcdir)/html.xsl $(srcdir)/data.xml > html.res ; \ diff $(srcdir)/html.xml html.res ; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true;\ rm -f html.res) diff --git a/tests/XSLTMark/Makefile.am b/tests/XSLTMark/Makefile.am index 5431be71..39abf20a 100644 --- a/tests/XSLTMark/Makefile.am +++ b/tests/XSLTMark/Makefile.am @@ -47,7 +47,7 @@ EXTRA_DIST = \ xslbench3.out xslbench3.xsl \ xslbenchdream.xml -$(top_builddir)/libxslt/xsltproc: +$(top_builddir)/xsltproc/xsltproc: @(cd ../../libxslt ; make xsltproc) all: alphabetize attsets avts axis backwards bottles breadth brutal chart \ @@ -74,7 +74,7 @@ db10000.xml: $(srcdir)/dbgen.pl alphabetize: db100.xml @(echo > .memdump) @(echo alphabetize) - @($(top_builddir)/libxslt/xsltproc $(srcdir)/alphabetize.xsl db100.xml > alphabetize.tmp; \ + @($(top_builddir)/xsltproc/xsltproc $(srcdir)/alphabetize.xsl db100.xml > alphabetize.tmp; \ if [ ! -f $(srcdir)/alphabetize.out ] ; then cp alphabetize.tmp $(srcdir)/alphabetize.out ; \ else diff $(srcdir)/alphabetize.out alphabetize.tmp ; fi ; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true ) @@ -85,7 +85,7 @@ alphabetize: db100.xml avts: db100.xml @(echo > .memdump) @(echo avts) - @($(top_builddir)/libxslt/xsltproc $(srcdir)/avts.xsl db100.xml > avts.tmp; \ + @($(top_builddir)/xsltproc/xsltproc $(srcdir)/avts.xsl db100.xml > avts.tmp; \ if [ ! -f $(srcdir)/avts.out ] ; then cp avts.tmp $(srcdir)/avts.out ; \ else diff $(srcdir)/avts.out avts.tmp ; fi ; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true ) @@ -95,7 +95,7 @@ avts: db100.xml creation: db100.xml @(echo > .memdump) @(echo creation) - @($(top_builddir)/libxslt/xsltproc $(srcdir)/creation.xsl db100.xml > creation.tmp; \ + @($(top_builddir)/xsltproc/xsltproc $(srcdir)/creation.xsl db100.xml > creation.tmp; \ if [ ! -f $(srcdir)/creation.out ] ; then cp creation.tmp $(srcdir)/creation.out ; \ else diff $(srcdir)/creation.out creation.tmp ; fi ; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true ) @@ -105,7 +105,7 @@ creation: db100.xml dbonerow: db10000.xml @(echo > .memdump) @(echo dbonerow) - @($(top_builddir)/libxslt/xsltproc $(srcdir)/dbonerow.xsl db10000.xml > dbonerow.tmp; \ + @($(top_builddir)/xsltproc/xsltproc $(srcdir)/dbonerow.xsl db10000.xml > dbonerow.tmp; \ if [ ! -f $(srcdir)/dbonerow.out ] ; then cp dbonerow.tmp $(srcdir)/dbonerow.out ; \ else diff $(srcdir)/dbonerow.out dbonerow.tmp ; fi ; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true ) @@ -115,7 +115,7 @@ dbonerow: db10000.xml dbtail: db100.xml @(echo > .memdump) @(echo dbtail) - @($(top_builddir)/libxslt/xsltproc $(srcdir)/dbtail.xsl db100.xml > dbtail.tmp; \ + @($(top_builddir)/xsltproc/xsltproc $(srcdir)/dbtail.xsl db100.xml > dbtail.tmp; \ if [ ! -f $(srcdir)/dbtail.out ] ; then cp dbtail.tmp $(srcdir)/dbtail.out ; \ else diff $(srcdir)/dbtail.out dbtail.tmp ; fi ; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true ) @@ -125,7 +125,7 @@ dbtail: db100.xml decoy: db100.xml @(echo > .memdump) @(echo decoy) - @($(top_builddir)/libxslt/xsltproc $(srcdir)/decoy.xsl db100.xml > decoy.tmp; \ + @($(top_builddir)/xsltproc/xsltproc $(srcdir)/decoy.xsl db100.xml > decoy.tmp; \ if [ ! -f $(srcdir)/decoy.out ] ; then cp decoy.tmp $(srcdir)/decoy.out ; \ else diff $(srcdir)/decoy.out decoy.tmp ; fi ; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true ) @@ -135,7 +135,7 @@ decoy: db100.xml encrypt: db100.xml @(echo > .memdump) @(echo encrypt) - @($(top_builddir)/libxslt/xsltproc $(srcdir)/encrypt.xsl db100.xml > encrypt.tmp; \ + @($(top_builddir)/xsltproc/xsltproc $(srcdir)/encrypt.xsl db100.xml > encrypt.tmp; \ if [ ! -f $(srcdir)/encrypt.out ] ; then cp encrypt.tmp $(srcdir)/encrypt.out ; \ else diff $(srcdir)/encrypt.out encrypt.tmp ; fi ; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true ) @@ -145,7 +145,7 @@ encrypt: db100.xml functions: db100.xml @(echo > .memdump) @(echo functions) - @($(top_builddir)/libxslt/xsltproc $(srcdir)/functions.xsl db100.xml > functions.tmp; \ + @($(top_builddir)/xsltproc/xsltproc $(srcdir)/functions.xsl db100.xml > functions.tmp; \ if [ ! -f $(srcdir)/functions.out ] ; then cp functions.tmp $(srcdir)/functions.out ; \ else diff $(srcdir)/functions.out functions.tmp ; fi ; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true ) @@ -155,7 +155,7 @@ functions: db100.xml identity: db1000.xml @(echo > .memdump) @(echo identity) - @($(top_builddir)/libxslt/xsltproc $(srcdir)/identity.xsl db1000.xml > identity.tmp; \ + @($(top_builddir)/xsltproc/xsltproc $(srcdir)/identity.xsl db1000.xml > identity.tmp; \ if [ ! -f $(srcdir)/identity.out ] ; then cp identity.tmp $(srcdir)/identity.out ; \ else diff $(srcdir)/identity.out identity.tmp ; fi ; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true ) @@ -165,7 +165,7 @@ identity: db1000.xml inventory: @(echo > .memdump) @(echo inventory) - @($(top_builddir)/libxslt/xsltproc $(srcdir)/inventory.xsl $(srcdir)/inventory.xml > inventory.tmp; \ + @($(top_builddir)/xsltproc/xsltproc $(srcdir)/inventory.xsl $(srcdir)/inventory.xml > inventory.tmp; \ if [ ! -f $(srcdir)/inventory.out ] ; then cp inventory.tmp $(srcdir)/inventory.out ; \ else diff $(srcdir)/inventory.out inventory.tmp ; fi ; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true ) @@ -175,7 +175,7 @@ inventory: patterns: db100.xml @(echo > .memdump) @(echo patterns) - @($(top_builddir)/libxslt/xsltproc $(srcdir)/patterns.xsl db100.xml > patterns.tmp; \ + @($(top_builddir)/xsltproc/xsltproc $(srcdir)/patterns.xsl db100.xml > patterns.tmp; \ if [ ! -f $(srcdir)/patterns.out ] ; then cp patterns.tmp $(srcdir)/patterns.out ; \ else diff $(srcdir)/patterns.out patterns.tmp ; fi ; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true ) @@ -185,7 +185,7 @@ patterns: db100.xml prettyprint: db100.xml @(echo > .memdump) @(echo prettyprint) - @($(top_builddir)/libxslt/xsltproc $(srcdir)/prettyprint.xsl db100.xml > prettyprint.tmp; \ + @($(top_builddir)/xsltproc/xsltproc $(srcdir)/prettyprint.xsl db100.xml > prettyprint.tmp; \ if [ ! -f $(srcdir)/prettyprint.out ] ; then cp prettyprint.tmp $(srcdir)/prettyprint.out ; \ else diff $(srcdir)/prettyprint.out prettyprint.tmp ; fi ; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true ) @@ -195,7 +195,7 @@ prettyprint: db100.xml stringsort: db1000.xml @(echo > .memdump) @(echo stringsort) - @($(top_builddir)/libxslt/xsltproc $(srcdir)/stringsort.xsl db1000.xml > stringsort.tmp; \ + @($(top_builddir)/xsltproc/xsltproc $(srcdir)/stringsort.xsl db1000.xml > stringsort.tmp; \ if [ ! -f $(srcdir)/stringsort.out ] ; then cp stringsort.tmp $(srcdir)/stringsort.out ; \ else diff $(srcdir)/stringsort.out stringsort.tmp ; fi ; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true ) @@ -207,7 +207,7 @@ endif attsets: @(echo > .memdump) @(echo attsets) - @($(top_builddir)/libxslt/xsltproc $(srcdir)/attsets.xsl $(srcdir)/chart.xml > attsets.tmp; \ + @($(top_builddir)/xsltproc/xsltproc $(srcdir)/attsets.xsl $(srcdir)/chart.xml > attsets.tmp; \ if [ ! -f $(srcdir)/attsets.out ] ; then cp attsets.tmp $(srcdir)/attsets.out ; \ else diff $(srcdir)/attsets.out attsets.tmp ; fi ; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true ) @@ -217,7 +217,7 @@ attsets: axis: @(echo > .memdump) @(echo axis) - @($(top_builddir)/libxslt/xsltproc $(srcdir)/axis.xsl $(srcdir)/axis.xml > axis.tmp; \ + @($(top_builddir)/xsltproc/xsltproc $(srcdir)/axis.xsl $(srcdir)/axis.xml > axis.tmp; \ if [ ! -f $(srcdir)/axis.out ] ; then cp axis.tmp $(srcdir)/axis.out ; \ else diff $(srcdir)/axis.out axis.tmp ; fi ; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true ) @@ -227,7 +227,7 @@ axis: backwards: @(echo > .memdump) @(echo backwards) - @($(top_builddir)/libxslt/xsltproc $(srcdir)/backwards.xsl $(srcdir)/game.xml > backwards.tmp; \ + @($(top_builddir)/xsltproc/xsltproc $(srcdir)/backwards.xsl $(srcdir)/game.xml > backwards.tmp; \ if [ ! -f $(srcdir)/backwards.out ] ; then cp backwards.tmp $(srcdir)/backwards.out ; \ else diff $(srcdir)/backwards.out backwards.tmp ; fi ; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true ) @@ -237,7 +237,7 @@ backwards: bottles: @(echo > .memdump) @(echo bottles) - @($(top_builddir)/libxslt/xsltproc $(srcdir)/bottles.xsl $(srcdir)/bottles.xml > bottles.tmp; \ + @($(top_builddir)/xsltproc/xsltproc $(srcdir)/bottles.xsl $(srcdir)/bottles.xml > bottles.tmp; \ if [ ! -f $(srcdir)/bottles.out ] ; then cp bottles.tmp $(srcdir)/bottles.out ; \ else diff $(srcdir)/bottles.out bottles.tmp ; fi ; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true ) @@ -247,7 +247,7 @@ bottles: breadth: @(echo > .memdump) @(echo breadth) - @($(top_builddir)/libxslt/xsltproc $(srcdir)/find.xsl $(srcdir)/breadth.xml > breadth.tmp; \ + @($(top_builddir)/xsltproc/xsltproc $(srcdir)/find.xsl $(srcdir)/breadth.xml > breadth.tmp; \ if [ ! -f $(srcdir)/breadth.out ] ; then cp breadth.tmp $(srcdir)/breadth.out ; \ else diff $(srcdir)/breadth.out breadth.tmp ; fi ; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true ) @@ -257,7 +257,7 @@ breadth: brutal: @(echo > .memdump) @(echo brutal) - @($(top_builddir)/libxslt/xsltproc $(srcdir)/brutal.xsl $(srcdir)/brutal.xml > brutal.tmp; \ + @($(top_builddir)/xsltproc/xsltproc $(srcdir)/brutal.xsl $(srcdir)/brutal.xml > brutal.tmp; \ if [ ! -f $(srcdir)/brutal.out ] ; then cp brutal.tmp $(srcdir)/brutal.out ; \ else diff $(srcdir)/brutal.out brutal.tmp ; fi ; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true ) @@ -267,7 +267,7 @@ brutal: chart: @(echo > .memdump) @(echo chart) - @($(top_builddir)/libxslt/xsltproc $(srcdir)/chart.xsl $(srcdir)/chart.xml > chart.tmp; \ + @($(top_builddir)/xsltproc/xsltproc $(srcdir)/chart.xsl $(srcdir)/chart.xml > chart.tmp; \ if [ ! -f $(srcdir)/chart.out ] ; then cp chart.tmp $(srcdir)/chart.out ; \ else diff $(srcdir)/chart.out chart.tmp ; fi ; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true ) @@ -277,7 +277,7 @@ chart: current: @(echo > .memdump) @(echo current) - @($(top_builddir)/libxslt/xsltproc $(srcdir)/current.xsl $(srcdir)/current.xml > current.tmp; \ + @($(top_builddir)/xsltproc/xsltproc $(srcdir)/current.xsl $(srcdir)/current.xml > current.tmp; \ if [ ! -f $(srcdir)/current.out ] ; then cp current.tmp $(srcdir)/current.out ; \ else diff $(srcdir)/current.out current.tmp ; fi ; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true ) @@ -287,7 +287,7 @@ current: depth: @(echo > .memdump) @(echo depth) - @($(top_builddir)/libxslt/xsltproc $(srcdir)/find.xsl $(srcdir)/depth.xml > depth.tmp; \ + @($(top_builddir)/xsltproc/xsltproc $(srcdir)/find.xsl $(srcdir)/depth.xml > depth.tmp; \ if [ ! -f $(srcdir)/depth.out ] ; then cp depth.tmp $(srcdir)/depth.out ; \ else diff $(srcdir)/depth.out depth.tmp ; fi ; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true ) @@ -297,7 +297,7 @@ depth: game: @(echo > .memdump) @(echo game) - @($(top_builddir)/libxslt/xsltproc $(srcdir)/game.xsl $(srcdir)/game.xml > game.tmp; \ + @($(top_builddir)/xsltproc/xsltproc $(srcdir)/game.xsl $(srcdir)/game.xml > game.tmp; \ if [ ! -f $(srcdir)/game.out ] ; then cp game.tmp $(srcdir)/game.out ; \ else diff $(srcdir)/game.out game.tmp ; fi ; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true ) @@ -307,7 +307,7 @@ game: html: @(echo > .memdump) @(echo html) - @($(top_builddir)/libxslt/xsltproc $(srcdir)/html.xsl $(srcdir)/html.xml > html.tmp; \ + @($(top_builddir)/xsltproc/xsltproc $(srcdir)/html.xsl $(srcdir)/html.xml > html.tmp; \ if [ ! -f $(srcdir)/html.out ] ; then cp html.tmp $(srcdir)/html.out ; \ else diff $(srcdir)/html.out html.tmp ; fi ; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true ) @@ -317,7 +317,7 @@ html: metric: @(echo > .memdump) @(echo metric) - @($(top_builddir)/libxslt/xsltproc $(srcdir)/metric.xsl $(srcdir)/metric.xml > metric.tmp; \ + @($(top_builddir)/xsltproc/xsltproc $(srcdir)/metric.xsl $(srcdir)/metric.xml > metric.tmp; \ if [ ! -f $(srcdir)/metric.out ] ; then cp metric.tmp $(srcdir)/metric.out ; \ else diff $(srcdir)/metric.out metric.tmp ; fi ; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true ) @@ -327,7 +327,7 @@ metric: number: @(echo > .memdump) @(echo number) - @($(top_builddir)/libxslt/xsltproc $(srcdir)/number.xsl $(srcdir)/number.xml > number.tmp; \ + @($(top_builddir)/xsltproc/xsltproc $(srcdir)/number.xsl $(srcdir)/number.xml > number.tmp; \ if [ ! -f $(srcdir)/number.out ] ; then cp number.tmp $(srcdir)/number.out ; \ else diff $(srcdir)/number.out number.tmp ; fi ; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true ) @@ -337,7 +337,7 @@ skipdriver=ExternalDriver:txdriver oddtemplate: @(echo > .memdump) @(echo oddtemplate) - @($(top_builddir)/libxslt/xsltproc $(srcdir)/oddtemplate.xsl $(srcdir)/oddtemplate.xml > oddtemplate.tmp; \ + @($(top_builddir)/xsltproc/xsltproc $(srcdir)/oddtemplate.xsl $(srcdir)/oddtemplate.xml > oddtemplate.tmp; \ if [ ! -f $(srcdir)/oddtemplate.out ] ; then cp oddtemplate.tmp $(srcdir)/oddtemplate.out ; \ else diff $(srcdir)/oddtemplate.out oddtemplate.tmp ; fi ; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true ) @@ -347,7 +347,7 @@ oddtemplate: priority: @(echo > .memdump) @(echo priority) - @($(top_builddir)/libxslt/xsltproc $(srcdir)/priority.xsl $(srcdir)/priority.xml > priority.tmp; \ + @($(top_builddir)/xsltproc/xsltproc $(srcdir)/priority.xsl $(srcdir)/priority.xml > priority.tmp; \ if [ ! -f $(srcdir)/priority.out ] ; then cp priority.tmp $(srcdir)/priority.out ; \ else diff $(srcdir)/priority.out priority.tmp ; fi ; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true ) @@ -357,7 +357,7 @@ priority: products: @(echo > .memdump) @(echo products) - @($(top_builddir)/libxslt/xsltproc $(srcdir)/products.xsl $(srcdir)/products.xml > products.tmp; \ + @($(top_builddir)/xsltproc/xsltproc $(srcdir)/products.xsl $(srcdir)/products.xml > products.tmp; \ if [ ! -f $(srcdir)/products.out ] ; then cp products.tmp $(srcdir)/products.out ; \ else diff $(srcdir)/products.out products.tmp ; fi ; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true ) @@ -367,7 +367,7 @@ products: queens: @(echo > .memdump) @(echo queens) - @($(top_builddir)/libxslt/xsltproc $(srcdir)/queens.xsl $(srcdir)/queens.xml > queens.tmp; \ + @($(top_builddir)/xsltproc/xsltproc $(srcdir)/queens.xsl $(srcdir)/queens.xml > queens.tmp; \ if [ ! -f $(srcdir)/queens.out ] ; then cp queens.tmp $(srcdir)/queens.out ; \ else diff $(srcdir)/queens.out queens.tmp ; fi ; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true ) @@ -377,7 +377,7 @@ queens: reverser: @(echo > .memdump) @(echo reverser) - @($(top_builddir)/libxslt/xsltproc $(srcdir)/reverser.xsl $(srcdir)/gettysburg.xml > reverser.tmp; \ + @($(top_builddir)/xsltproc/xsltproc $(srcdir)/reverser.xsl $(srcdir)/gettysburg.xml > reverser.tmp; \ if [ ! -f $(srcdir)/reverser.out ] ; then cp reverser.tmp $(srcdir)/reverser.out ; \ else diff $(srcdir)/reverser.out reverser.tmp ; fi ; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true ) @@ -387,7 +387,7 @@ reverser: summarize: @(echo > .memdump) @(echo summarize) - @($(top_builddir)/libxslt/xsltproc $(srcdir)/summarize.xsl $(srcdir)/queens.xsl > summarize.tmp; \ + @($(top_builddir)/xsltproc/xsltproc $(srcdir)/summarize.xsl $(srcdir)/queens.xsl > summarize.tmp; \ if [ ! -f $(srcdir)/summarize.out ] ; then cp summarize.tmp $(srcdir)/summarize.out ; \ else diff $(srcdir)/summarize.out summarize.tmp ; fi ; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true ) @@ -397,7 +397,7 @@ summarize: total: @(echo > .memdump) @(echo total) - @($(top_builddir)/libxslt/xsltproc $(srcdir)/total.xsl $(srcdir)/chart.xml > total.tmp; \ + @($(top_builddir)/xsltproc/xsltproc $(srcdir)/total.xsl $(srcdir)/chart.xml > total.tmp; \ if [ ! -f $(srcdir)/total.out ] ; then cp total.tmp $(srcdir)/total.out ; \ else diff $(srcdir)/total.out total.tmp ; fi ; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true ) @@ -407,7 +407,7 @@ total: tower: @(echo > .memdump) @(echo tower) - @($(top_builddir)/libxslt/xsltproc $(srcdir)/tower.xsl $(srcdir)/tower.xml > tower.tmp; \ + @($(top_builddir)/xsltproc/xsltproc $(srcdir)/tower.xsl $(srcdir)/tower.xml > tower.tmp; \ if [ ! -f $(srcdir)/tower.out ] ; then cp tower.tmp $(srcdir)/tower.out ; \ else diff $(srcdir)/tower.out tower.tmp ; fi ; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true ) @@ -417,7 +417,7 @@ tower: trend: @(echo > .memdump) @(echo trend) - @($(top_builddir)/libxslt/xsltproc $(srcdir)/trend.xsl $(srcdir)/trend.xml > trend.tmp; \ + @($(top_builddir)/xsltproc/xsltproc $(srcdir)/trend.xsl $(srcdir)/trend.xml > trend.tmp; \ if [ ! -f $(srcdir)/trend.out ] ; then cp trend.tmp $(srcdir)/trend.out ; \ else diff $(srcdir)/trend.out trend.tmp ; fi ; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true ) @@ -427,7 +427,7 @@ trend: union: @(echo > .memdump) @(echo union) - @($(top_builddir)/libxslt/xsltproc $(srcdir)/union.xsl $(srcdir)/union.xml > union.tmp; \ + @($(top_builddir)/xsltproc/xsltproc $(srcdir)/union.xsl $(srcdir)/union.xml > union.tmp; \ if [ ! -f $(srcdir)/union.out ] ; then cp union.tmp $(srcdir)/union.out ; \ else diff $(srcdir)/union.out union.tmp ; fi ; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true ) @@ -437,7 +437,7 @@ union: xpath: @(echo > .memdump) @(echo xpath) - @($(top_builddir)/libxslt/xsltproc $(srcdir)/xpath.xsl $(srcdir)/xpath.xml > xpath.tmp; \ + @($(top_builddir)/xsltproc/xsltproc $(srcdir)/xpath.xsl $(srcdir)/xpath.xml > xpath.tmp; \ if [ ! -f $(srcdir)/xpath.out ] ; then cp xpath.tmp $(srcdir)/xpath.out ; \ else diff $(srcdir)/xpath.out xpath.tmp ; fi ; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true ) @@ -447,7 +447,7 @@ xpath: xslbench1: @(echo > .memdump) @(echo xslbench1) - @($(top_builddir)/libxslt/xsltproc $(srcdir)/xslbench1.xsl $(srcdir)/xslbench1.xml > xslbench1.tmp; \ + @($(top_builddir)/xsltproc/xsltproc $(srcdir)/xslbench1.xsl $(srcdir)/xslbench1.xml > xslbench1.tmp; \ if [ ! -f $(srcdir)/xslbench1.out ] ; then cp xslbench1.tmp $(srcdir)/xslbench1.out ; \ else diff $(srcdir)/xslbench1.out xslbench1.tmp ; fi ; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true ) @@ -455,7 +455,7 @@ xslbench1: xslbench2: @(echo > .memdump) @(echo xslbench2) - @($(top_builddir)/libxslt/xsltproc $(srcdir)/xslbench2.xsl $(srcdir)/xslbenchdream.xml > xslbench2.tmp; \ + @($(top_builddir)/xsltproc/xsltproc $(srcdir)/xslbench2.xsl $(srcdir)/xslbenchdream.xml > xslbench2.tmp; \ if [ ! -f $(srcdir)/xslbench2.out ] ; then cp xslbench2.tmp $(srcdir)/xslbench2.out ; \ else diff $(srcdir)/xslbench2.out xslbench2.tmp ; fi ; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true ) @@ -463,7 +463,7 @@ xslbench2: xslbench3: @(echo > .memdump) @(echo xslbench3) - @($(top_builddir)/libxslt/xsltproc $(srcdir)/xslbench3.xsl $(srcdir)/xslbenchdream.xml > xslbench3.tmp; \ + @($(top_builddir)/xsltproc/xsltproc $(srcdir)/xslbench3.xsl $(srcdir)/xslbenchdream.xml > xslbench3.tmp; \ if [ ! -f $(srcdir)/xslbench3.out ] ; then cp xslbench3.tmp $(srcdir)/xslbench3.out ; \ else diff $(srcdir)/xslbench3.out xslbench3.tmp ; fi ; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true ) diff --git a/tests/docbook/Makefile.am b/tests/docbook/Makefile.am index a519dbf6..f1d5706e 100644 --- a/tests/docbook/Makefile.am +++ b/tests/docbook/Makefile.am @@ -2,7 +2,7 @@ all: single xtchunk # Avoid doing the test in normal pass -$(top_builddir)/libxslt/xsltproc: +$(top_builddir)/xsltproc/xsltproc: @(cd ../../libxslt ; make xsltproc) EXTRA_DIST = README VERSION @@ -18,7 +18,7 @@ single: echo -n "$$i : html " ; \ out=$(srcdir)/result/html/`basename $$i .xml`.tst; \ html=$(srcdir)/result/html/`basename $$i .xml`.html; \ - $(top_builddir)/libxslt/xsltproc --nonet $(srcdir)/html/docbook.xsl $$i > $$out ; \ + $(top_builddir)/xsltproc/xsltproc --nonet $(srcdir)/html/docbook.xsl $$i > $$out ; \ if [ -f $$html ] ; then \ grep -v id < $$html > $$html.noid ; \ grep -v id < $$out > $$out.noid ; \ @@ -31,7 +31,7 @@ single: out=$(srcdir)/result/fo/`basename $$i .xml`.tst; \ fo=$(srcdir)/result/fo/`basename $$i .xml`.fo; \ msg=$(srcdir)/result/fo/`basename $$i .xml`.msg; \ - $(top_builddir)/libxslt/xsltproc --nonet $(srcdir)/fo/docbook.xsl $$i > $$out 2> $$msg ; \ + $(top_builddir)/xsltproc/xsltproc --nonet $(srcdir)/fo/docbook.xsl $$i > $$out 2> $$msg ; \ if [ -f $$fo ] ; then \ grep -v id < $$fo > $$fo.noid ; \ grep -v id < $$out > $$out.noid ; \ @@ -43,7 +43,7 @@ single: echo -n "xhtml " ; \ out=$(srcdir)/result/xhtml/`basename $$i .xml`.tst; \ xhtml=$(srcdir)/result/xhtml/`basename $$i .xml`.xhtml; \ - $(top_builddir)/libxslt/xsltproc --nonet $(srcdir)/xhtml/docbook.xsl $$i > $$out ; \ + $(top_builddir)/xsltproc/xsltproc --nonet $(srcdir)/xhtml/docbook.xsl $$i > $$out ; \ if [ -f $$xhtml ] ; then \ grep -v id < $$xhtml > $$xhtml.noid ; \ grep -v id < $$out > $$out.noid ; \ @@ -60,7 +60,7 @@ xtchunk: @(for i in $(srcdir)/test/gdp-handbook.xml ; do \ echo "Testing HTML chunking on $$i :" ; \ html=$(srcdir)/result/html/`basename $$i .xml`.html; \ - $(top_builddir)/libxslt/xsltproc -o $(srcdir)/result/xtchunk/html/gdp-handbook $(srcdir)/html/xtchunk.xsl $$i ; \ + $(top_builddir)/xsltproc/xsltproc -o $(srcdir)/result/xtchunk/html/gdp-handbook $(srcdir)/html/xtchunk.xsl $$i ; \ for html in $(srcdir)/result/xtchunk/html/*.html ; do \ orig=$(srcdir)/result/xtchunk/html/`basename $$html .html`.orig ;\ if [ -f $$orig ] ; then \ @@ -77,7 +77,7 @@ xtchunk: # # The full set of tests # -htmltests: $(top_builddir)/libxslt/xsltproc +htmltests: $(top_builddir)/xsltproc/xsltproc @(echo > .memdump) @echo "##" @echo "## HTML stylesheets regression tests" @@ -86,7 +86,7 @@ htmltests: $(top_builddir)/libxslt/xsltproc echo $$i ; \ out=$(srcdir)/result/html/`basename $$i .xml`.tst; \ html=$(srcdir)/result/html/`basename $$i .xml`.html; \ - $(top_builddir)/libxslt/xsltproc --nonet $(srcdir)/html/docbook.xsl $$i > $$out ; \ + $(top_builddir)/xsltproc/xsltproc --nonet $(srcdir)/html/docbook.xsl $$i > $$out ; \ if [ -f $$html ] ; then \ grep -v id < $$html > $$html.noid ; \ grep -v id < $$out > $$out.noid ; \ @@ -96,7 +96,7 @@ htmltests: $(top_builddir)/libxslt/xsltproc grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true;\ rm -f $$out ; done ) -fotests: $(top_builddir)/libxslt/xsltproc +fotests: $(top_builddir)/xsltproc/xsltproc @(echo > .memdump) @echo "##" @echo "## XSL FO stylesheets regression tests" @@ -106,7 +106,7 @@ fotests: $(top_builddir)/libxslt/xsltproc out=$(srcdir)/result/fo/`basename $$i .xml`.tst; \ fo=$(srcdir)/result/fo/`basename $$i .xml`.fo; \ msg=$(srcdir)/result/fo/`basename $$i .xml`.msg; \ - $(top_builddir)/libxslt/xsltproc --nonet $(srcdir)/fo/docbook.xsl $$i > $$out 2> $$msg ; \ + $(top_builddir)/xsltproc/xsltproc --nonet $(srcdir)/fo/docbook.xsl $$i > $$out 2> $$msg ; \ if [ -f $$fo ] ; then \ grep -v id < $$fo > $$fo.noid ; \ grep -v id < $$out > $$out.noid ; \ @@ -117,7 +117,7 @@ fotests: $(top_builddir)/libxslt/xsltproc rm -f $$out $$msg ; \ done ) -xhtmltests: $(top_builddir)/libxslt/xsltproc +xhtmltests: $(top_builddir)/xsltproc/xsltproc @(echo > .memdump) @echo "##" @echo "## XHTML stylesheets regression tests" @@ -126,7 +126,7 @@ xhtmltests: $(top_builddir)/libxslt/xsltproc echo $$i ; \ out=$(srcdir)/result/xhtml/`basename $$i .xml`.tst; \ xhtml=$(srcdir)/result/xhtml/`basename $$i .xml`.xhtml; \ - $(top_builddir)/libxslt/xsltproc --nonet $(srcdir)/xhtml/docbook.xsl $$i > $$out ; \ + $(top_builddir)/xsltproc/xsltproc --nonet $(srcdir)/xhtml/docbook.xsl $$i > $$out ; \ if [ -f $$xhtml ] ; then \ grep -v id < $$xhtml > $$xhtml.noid ; \ grep -v id < $$out > $$out.noid ; \ diff --git a/tests/documents/Makefile.am b/tests/documents/Makefile.am index 67e6ce90..008f6e9f 100644 --- a/tests/documents/Makefile.am +++ b/tests/documents/Makefile.am @@ -1,6 +1,6 @@ ## Process this file with automake to produce Makefile.in -$(top_builddir)/libxslt/xsltproc: +$(top_builddir)/xsltproc/xsltproc: @(cd ../../libxslt ; make xsltproc) EXTRA_DIST = bredfort.css index.xml system.xml \ @@ -11,17 +11,17 @@ EXTRA_DIST = bredfort.css index.xml system.xml \ all: test -test tests: $(top_builddir)/libxslt/xsltproc +test tests: $(top_builddir)/xsltproc/xsltproc @(echo > .memdump) - @($(top_builddir)/libxslt/xsltproc $(srcdir)/bredfort.xsl $(srcdir)/index.xml > result ; \ + @($(top_builddir)/xsltproc/xsltproc $(srcdir)/bredfort.xsl $(srcdir)/index.xml > result ; \ diff $(srcdir)/result.xhtml result; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true;\ rm -f result) - @($(top_builddir)/libxslt/xsltproc $(srcdir)/test.xsl $(srcdir)/test.xml > result ; \ + @($(top_builddir)/xsltproc/xsltproc $(srcdir)/test.xsl $(srcdir)/test.xml > result ; \ diff $(srcdir)/test.result result; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true;\ rm -f result) - @($(top_builddir)/libxslt/xsltproc $(srcdir)/message.xsl $(srcdir)/message.xml > result 2>&1 ; \ + @($(top_builddir)/xsltproc/xsltproc $(srcdir)/message.xsl $(srcdir)/message.xml > result 2>&1 ; \ diff $(srcdir)/message.result result; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true;\ rm -f result) diff --git a/tests/extensions/Makefile.am b/tests/extensions/Makefile.am index 8db24e26..56aa74fb 100644 --- a/tests/extensions/Makefile.am +++ b/tests/extensions/Makefile.am @@ -1,6 +1,6 @@ ## Process this file with automake to produce Makefile.in -$(top_builddir)/libxslt/xsltproc: +$(top_builddir)/xsltproc/xsltproc: @(cd ../../libxslt ; make xsltproc) EXTRA_DIST = \ @@ -10,7 +10,7 @@ EXTRA_DIST = \ all: test -test tests: $(top_builddir)/libxslt/xsltproc +test tests: $(top_builddir)/xsltproc/xsltproc @(echo > .memdump) @(for i in $(srcdir)/*.xml ; do \ if [ -d $$i ] ; then continue ; fi ; \ @@ -21,7 +21,7 @@ test tests: $(top_builddir)/libxslt/xsltproc name=`basename $$j .xsl`; \ out=$(srcdir)/"$$name".out; \ echo Running $$j on $$i ; \ - $(top_builddir)/libxslt/xsltproc $$j $$i > result.$$name;\ + $(top_builddir)/xsltproc/xsltproc $$j $$i > result.$$name;\ if [ ! -f $$out ] ; then cp result.$$name $$out ; \ else diff $$out result.$$name; fi ; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true;\ diff --git a/tests/general/Makefile.am b/tests/general/Makefile.am index b80be711..3e0c5989 100644 --- a/tests/general/Makefile.am +++ b/tests/general/Makefile.am @@ -1,6 +1,6 @@ ## Process this file with automake to produce Makefile.in -$(top_builddir)/libxslt/xsltproc: +$(top_builddir)/xsltproc/xsltproc: @(cd ../../libxslt ; make xsltproc) EXTRA_DIST = \ @@ -64,7 +64,7 @@ EXTRA_DIST = \ all: test -test tests: $(top_builddir)/libxslt/xsltproc +test tests: $(top_builddir)/xsltproc/xsltproc @(echo > .memdump) @(for i in $(srcdir)/../docs/*.xml ; do \ if [ -d $$i ] ; then continue ; fi ; \ @@ -75,7 +75,7 @@ test tests: $(top_builddir)/libxslt/xsltproc name=`basename $$j .xsl`; \ out=$(srcdir)/"$$name".out; \ echo Running $$j on $$i ; \ - $(top_builddir)/libxslt/xsltproc $$j $$i > result.$$name;\ + $(top_builddir)/xsltproc/xsltproc $$j $$i > result.$$name;\ if [ ! -f $$out ] ; then cp result.$$name $$out ; \ else diff $$out result.$$name; fi ; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true;\ diff --git a/tests/multiple/Makefile.am b/tests/multiple/Makefile.am index 9136499d..2cf906f3 100644 --- a/tests/multiple/Makefile.am +++ b/tests/multiple/Makefile.am @@ -1,6 +1,6 @@ ## Process this file with automake to produce Makefile.in -$(top_builddir)/libxslt/xsltproc: +$(top_builddir)/xsltproc/xsltproc: @(cd ../../libxslt ; make xsltproc) EXTRA_DIST = dict.dtd dict.xml dict.xsl result.xml \ @@ -30,9 +30,9 @@ GENERATED = \ all: test -test tests: $(top_builddir)/libxslt/xsltproc +test tests: $(top_builddir)/xsltproc/xsltproc @(echo > .memdump) - @($(top_builddir)/libxslt/xsltproc $(srcdir)/dict.xsl $(srcdir)/dict.xml > dict.res ; \ + @($(top_builddir)/xsltproc/xsltproc $(srcdir)/dict.xsl $(srcdir)/dict.xml > dict.res ; \ diff $(srcdir)/result.xml dict.res; \ for i in $(srcdir)/out/letter*.html $(srcdir)/out/titlepage.html ; do \ orig=$(srcdir)/out/`basename $$i .html`.orig ; \ diff --git a/tests/namespaces/Makefile.am b/tests/namespaces/Makefile.am index 9ccd8c64..7040eacd 100644 --- a/tests/namespaces/Makefile.am +++ b/tests/namespaces/Makefile.am @@ -1,6 +1,6 @@ ## Process this file with automake to produce Makefile.in -$(top_builddir)/libxslt/xsltproc: +$(top_builddir)/xsltproc/xsltproc: @(cd ../../libxslt ; make xsltproc) EXTRA_DIST = \ @@ -12,7 +12,7 @@ EXTRA_DIST = \ all: test -test tests: $(top_builddir)/libxslt/xsltproc +test tests: $(top_builddir)/xsltproc/xsltproc @(echo > .memdump) @(for i in $(srcdir)/*.xml ; do \ doc="`basename $$i .xml`" ; \ @@ -22,7 +22,7 @@ test tests: $(top_builddir)/libxslt/xsltproc name="`basename $$j .xsl`"; \ out=$(srcdir)/"$$name".out; \ echo $$j ; \ - $(top_builddir)/libxslt/xsltproc $$j $$i > result.$$name;\ + $(top_builddir)/xsltproc/xsltproc $$j $$i > result.$$name;\ if [ ! -f $$out ] ; then cp result.$$name $$out ; \ else diff $$out result.$$name ; fi ; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true;\ diff --git a/tests/numbers/Makefile.am b/tests/numbers/Makefile.am index a7c25852..e53be590 100644 --- a/tests/numbers/Makefile.am +++ b/tests/numbers/Makefile.am @@ -1,15 +1,15 @@ ## Process this file with automake to produce Makefile.in -$(top_builddir)/libxslt/xsltproc: +$(top_builddir)/xsltproc/xsltproc: @(cd ../../libxslt ; make xsltproc) EXTRA_DIST = format-number.xsl format-number.xml format-number.out all: test -test tests: $(top_builddir)/libxslt/xsltproc +test tests: $(top_builddir)/xsltproc/xsltproc @(echo > .memdump) - @($(top_builddir)/libxslt/xsltproc $(srcdir)/format-number.xsl $(srcdir)/format-number.xml > format-number.res ; \ + @($(top_builddir)/xsltproc/xsltproc $(srcdir)/format-number.xsl $(srcdir)/format-number.xml > format-number.res ; \ diff $(srcdir)/format-number.out format-number.res ; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true;\ rm -f format-number.res) diff --git a/tests/xmlspec/Makefile.am b/tests/xmlspec/Makefile.am index 48ead921..8bcbbcd5 100644 --- a/tests/xmlspec/Makefile.am +++ b/tests/xmlspec/Makefile.am @@ -1,6 +1,6 @@ ## Process this file with automake to produce Makefile.in -$(top_builddir)/libxslt/xsltproc: +$(top_builddir)/xsltproc/xsltproc: @(cd ../../libxslt ; make xsltproc) EXTRA_DIST = REC-xml-20001006.xml xmlspec-v21.dtd W3C-REC.css \ @@ -9,15 +9,15 @@ EXTRA_DIST = REC-xml-20001006.xml xmlspec-v21.dtd W3C-REC.css \ all: test -test tests: $(top_builddir)/libxslt/xsltproc +test tests: $(top_builddir)/xsltproc/xsltproc @(echo > .memdump) - @($(top_builddir)/libxslt/xsltproc -timing $(srcdir)/REC-xml-2e.xsl $(srcdir)/REC-xml-20001006.xml > REC-xml-20001006.out 2> debug ; \ + @($(top_builddir)/xsltproc/xsltproc -timing $(srcdir)/REC-xml-2e.xsl $(srcdir)/REC-xml-20001006.xml > REC-xml-20001006.out 2> debug ; \ diff $(srcdir)/REC-xml-20001006.html REC-xml-20001006.out | grep -v 'id[0-9]' | grep -v -- '---' | grep -v 100 | grep -v 3866 ; \ grep implemented debug | sort | uniq -c || true; \ grep " ms$$" debug || true; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true;\ rm -f REC-xml-20001006.out) - @($(top_builddir)/libxslt/xsltproc -timing --param show.diff.markup 1 $(srcdir)/REC-xml-2e.xsl $(srcdir)/REC-xml-20001006.xml > REC-xml-20001006-review.out 2> debug ; \ + @($(top_builddir)/xsltproc/xsltproc -timing --param show.diff.markup 1 $(srcdir)/REC-xml-2e.xsl $(srcdir)/REC-xml-20001006.xml > REC-xml-20001006-review.out 2> debug ; \ diff $(srcdir)/REC-xml-20001006-review.html REC-xml-20001006-review.out | grep -v 'id[0-9]' | grep -v -- '---' | grep -v 117 | grep -v 4066 ; \ grep implemented debug | sort | uniq -c || true; \ grep " ms$$" debug || true; \ diff --git a/xsltproc/Makefile.am b/xsltproc/Makefile.am new file mode 100644 index 00000000..d20212d0 --- /dev/null +++ b/xsltproc/Makefile.am @@ -0,0 +1,15 @@ +INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/libxslt -I$(top_srcdir)/libexslt \ + $(LIBXML_CFLAGS) $(CFLAGS) + + +bin_PROGRAMS = xsltproc + +DEPS = $(top_builddir)/libxslt/libxslt.la $(top_builddir)/libexslt/libexslt.la +LDADDS = -L. $(top_builddir)/libxslt/libxslt.la \ + $(top_builddir)/libexslt/libexslt.la $(EXTRA_LIBS) + +xsltproc_SOURCES = xsltproc.c +xsltproc_LDFLAGS = +xsltproc_DEPENDENCIES = $(DEPS) +xsltproc_LDADD = $(LDADDS) + diff --git a/xsltproc/xsltproc.c b/xsltproc/xsltproc.c new file mode 100644 index 00000000..290743d3 --- /dev/null +++ b/xsltproc/xsltproc.c @@ -0,0 +1,510 @@ +/* + * xsltproc.c: user program for the XSL Transformation 1.0 engine + * + * See Copyright for the status of this software. + * + * daniel@veillard.com + */ + +#include "libxslt/libxslt.h" +#include "libexslt/exslt.h" +#ifdef HAVE_STRING_H +#include +#endif +#ifdef HAVE_SYS_TIME_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_STDLIB_H +#include +#endif +#include +#include +#include +#include +#ifdef LIBXML_DOCB_ENABLED +#include +#endif +#ifdef LIBXML_XINCLUDE_ENABLED +#include +#endif +#ifdef LIBXML_CATALOG_ENABLED +#include +#endif +#include +#include +#include +#include +#include +#include + +#ifdef WIN32 +#ifdef _MSC_VER +#include +#pragma comment(lib, "ws2_32.lib") +#define gettimeofday(p1,p2) +#endif /* _MS_VER */ +#else /* WIN32 */ +#include +#endif /* WIN32 */ + +extern int xmlLoadExtDtdDefaultValue; + +static int debug = 0; +static int repeat = 0; +static int timing = 0; +static int novalid = 0; +static int noout = 0; +#ifdef LIBXML_DOCB_ENABLED +static int docbook = 0; +#endif +#ifdef LIBXML_HTML_ENABLED +static int html = 0; +#endif +#ifdef LIBXML_XINCLUDE_ENABLED +static int xinclude = 0; +#endif +static int profile = 0; +static int nonet; +static xmlExternalEntityLoader defaultLoader = NULL; + +static struct timeval begin, end; +static const char *params[16 + 1]; +static int nbparams = 0; +static const char *output = NULL; + +static xmlParserInputPtr +xsltNoNetExternalEntityLoader(const char *URL, const char *ID, + xmlParserCtxtPtr ctxt) { + if (URL != NULL) { + if ((!xmlStrncasecmp((const xmlChar *) URL, + (const xmlChar *) "ftp://", 6)) || + (!xmlStrncasecmp((const xmlChar *) URL, + (const xmlChar *) "http://", 7))) { + fprintf(stderr, "Attempt to load network entity %s \n", URL); + if (nonet) + return(NULL); + } + } + if (defaultLoader != NULL) { + return(defaultLoader(URL, ID, ctxt)); + } + return(NULL); +} + +static void +xsltProcess(xmlDocPtr doc, xsltStylesheetPtr cur, const char *filename) { + xmlDocPtr res; + +#ifdef LIBXML_XINCLUDE_ENABLED + if (xinclude) { + if (timing) + gettimeofday(&begin, NULL); + xmlXIncludeProcess(doc); + if (timing) { + long msec; + + gettimeofday(&end, NULL); + msec = end.tv_sec - begin.tv_sec; + msec *= 1000; + msec += (end.tv_usec - begin.tv_usec) / 1000; + fprintf(stderr, "XInclude processing %s took %ld ms\n", + filename, msec); + } + } +#endif + if (timing) + gettimeofday(&begin, NULL); + if (output == NULL) { + if (repeat) { + int j; + + for (j = 1; j < repeat; j++) { + res = xsltApplyStylesheet(cur, doc, params); + xmlFreeDoc(res); + xmlFreeDoc(doc); +#ifdef LIBXML_HTML_ENABLED + if (html) + doc = htmlParseFile(filename, NULL); + else +#endif +#ifdef LIBXML_DOCB_ENABLED + if (docbook) + doc = docbParseFile(filename, NULL); + else +#endif + doc = xmlParseFile(filename); + } + } + if (profile) { + res = xsltProfileStylesheet(cur, doc, params, stderr); + } else { + res = xsltApplyStylesheet(cur, doc, params); + } + if (timing) { + long msec; + + gettimeofday(&end, NULL); + msec = end.tv_sec - begin.tv_sec; + msec *= 1000; + msec += (end.tv_usec - begin.tv_usec) / 1000; + if (repeat) + fprintf(stderr, + "Applying stylesheet %d times took %ld ms\n", + repeat, msec); + else + fprintf(stderr, + "Applying stylesheet took %ld ms\n", msec); + } + xmlFreeDoc(doc); + if (res == NULL) { + fprintf(stderr, "no result for %s\n", filename); + return; + } + if (noout) { + xmlFreeDoc(res); + return; + } +#ifdef LIBXML_DEBUG_ENABLED + if (debug) + xmlDebugDumpDocument(stdout, res); + else { +#endif + if (cur->methodURI == NULL) { + if (timing) + gettimeofday(&begin, NULL); + xsltSaveResultToFile(stdout, res, cur); + if (timing) { + long msec; + + gettimeofday(&end, NULL); + msec = end.tv_sec - begin.tv_sec; + msec *= 1000; + msec += (end.tv_usec - begin.tv_usec) / 1000; + fprintf(stderr, "Saving result took %ld ms\n", + msec); + } + } else { + if (xmlStrEqual + (cur->method, (const xmlChar *) "xhtml")) { + fprintf(stderr, "non standard output xhtml\n"); + if (timing) + gettimeofday(&begin, NULL); + xsltSaveResultToFile(stdout, res, cur); + if (timing) { + long msec; + + gettimeofday(&end, NULL); + msec = end.tv_sec - begin.tv_sec; + msec *= 1000; + msec += + (end.tv_usec - begin.tv_usec) / 1000; + fprintf(stderr, + "Saving result took %ld ms\n", + msec); + } + } else { + fprintf(stderr, + "Unsupported non standard output %s\n", + cur->method); + } + } +#ifdef LIBXML_DEBUG_ENABLED + } +#endif + + xmlFreeDoc(res); + } else { + xsltRunStylesheet(cur, doc, params, output, NULL, NULL); + if (timing) { + long msec; + + gettimeofday(&end, NULL); + msec = end.tv_sec - begin.tv_sec; + msec *= 1000; + msec += (end.tv_usec - begin.tv_usec) / 1000; + fprintf(stderr, + "Running stylesheet and saving result took %ld ms\n", + msec); + } + xmlFreeDoc(doc); + } +} + +static void usage(const char *name) { + printf("Usage: %s [options] stylesheet file [file ...]\n", name); + printf(" Options:\n"); + printf(" --version or -V: show the version of libxml and libxslt used\n"); + printf(" --verbose or -v: show logs of what's happening\n"); + printf(" --output file or -o file: save to a given file\n"); + printf(" --timing: display the time used\n"); + printf(" --repeat: run the transformation 20 times\n"); + printf(" --debug: dump the tree of the result instead\n"); + printf(" --novalid: skip the Dtd loading phase\n"); + printf(" --noout: do not dump the result\n"); + printf(" --maxdepth val : increase the maximum depth\n"); +#ifdef LIBXML_HTML_ENABLED + printf(" --html: the input document is(are) an HTML file(s)\n"); +#endif +#ifdef LIBXML_DOCB_ENABLED + printf(" --docbook: the input document is SGML docbook\n"); +#endif + printf(" --param name value : pass a (parameter,value) pair\n"); + printf(" --nonet refuse to fetch DTDs or entities over network\n"); + printf(" --warnnet warn against fetching over the network\n"); +#ifdef LIBXML_CATALOG_ENABLED + printf(" --catalogs : use the catalogs from $SGML_CATALOG_FILES\n"); +#endif +#ifdef LIBXML_XINCLUDE_ENABLED + printf(" --xinclude : do XInclude processing on document intput\n"); +#endif + printf(" --profile or --norman : dump profiling informations \n"); +} + +int +main(int argc, char **argv) +{ + int i; + xsltStylesheetPtr cur = NULL; + xmlDocPtr doc, style; + + if (argc <= 1) { + usage(argv[0]); + return (1); + } + + xmlInitMemory(); + + LIBXML_TEST_VERSION + + defaultLoader = xmlGetExternalEntityLoader(); + if (novalid == 0) /* TODO XML_DETECT_IDS | XML_COMPLETE_ATTRS */ + xmlLoadExtDtdDefaultValue = 6; + else + xmlLoadExtDtdDefaultValue = 0; + for (i = 1; i < argc; i++) { + if (!strcmp(argv[i], "-")) + break; + + if (argv[i][0] != '-') + continue; +#ifdef LIBXML_DEBUG_ENABLED + if ((!strcmp(argv[i], "-debug")) || (!strcmp(argv[i], "--debug"))) { + debug++; + } else +#endif + if ((!strcmp(argv[i], "-v")) || + (!strcmp(argv[i], "-verbose")) || + (!strcmp(argv[i], "--verbose"))) { + xsltSetGenericDebugFunc(stderr, NULL); + } else if ((!strcmp(argv[i], "-o")) || + (!strcmp(argv[i], "-output")) || + (!strcmp(argv[i], "--output"))) { + i++; + output = argv[i++]; + } else if ((!strcmp(argv[i], "-V")) || + (!strcmp(argv[i], "-version")) || + (!strcmp(argv[i], "--version"))) { + printf("Using libxml %s, libxslt %s and libexslt %s\n", + xmlParserVersion, xsltEngineVersion, exsltLibraryVersion); + printf + ("xsltproc was compiled against libxml %d, libxslt %d and libexslt %d\n", + LIBXML_VERSION, LIBXSLT_VERSION, LIBEXSLT_VERSION); + printf("libxslt %d was compiled against libxml %d\n", + xsltLibxsltVersion, xsltLibxmlVersion); + printf("libexslt %d was compiled against libxml %d\n", + exsltLibexsltVersion, exsltLibxmlVersion); + } else if ((!strcmp(argv[i], "-repeat")) + || (!strcmp(argv[i], "--repeat"))) { + if (repeat == 0) + repeat = 20; + else + repeat = 100; + } else if ((!strcmp(argv[i], "-novalid")) || + (!strcmp(argv[i], "--novalid"))) { + novalid++; + } else if ((!strcmp(argv[i], "-noout")) || + (!strcmp(argv[i], "--noout"))) { + noout++; +#ifdef LIBXML_DOCB_ENABLED + } else if ((!strcmp(argv[i], "-docbook")) || + (!strcmp(argv[i], "--docbook"))) { + docbook++; +#endif +#ifdef LIBXML_HTML_ENABLED + } else if ((!strcmp(argv[i], "-html")) || + (!strcmp(argv[i], "--html"))) { + html++; +#endif + } else if ((!strcmp(argv[i], "-timing")) || + (!strcmp(argv[i], "--timing"))) { + timing++; + } else if ((!strcmp(argv[i], "-profile")) || + (!strcmp(argv[i], "--profile"))) { + profile++; + } else if ((!strcmp(argv[i], "-norman")) || + (!strcmp(argv[i], "--norman"))) { + profile++; + } else if ((!strcmp(argv[i], "-warnnet")) || + (!strcmp(argv[i], "--warnnet"))) { + xmlSetExternalEntityLoader(xsltNoNetExternalEntityLoader); + } else if ((!strcmp(argv[i], "-nonet")) || + (!strcmp(argv[i], "--nonet"))) { + xmlSetExternalEntityLoader(xsltNoNetExternalEntityLoader); + nonet = 1; +#ifdef LIBXML_CATALOG_ENABLED + } else if ((!strcmp(argv[i], "-catalogs")) || + (!strcmp(argv[i], "--catalogs"))) { + const char *catalogs; + + catalogs = getenv("SGML_CATALOG_FILES"); + if (catalogs == NULL) { + fprintf(stderr, "Variable $SGML_CATALOG_FILES not set\n"); + } else { + xmlLoadCatalogs(catalogs); + } +#endif +#ifdef LIBXML_XINCLUDE_ENABLED + } else if ((!strcmp(argv[i], "-xinclude")) || + (!strcmp(argv[i], "--xinclude"))) { + xinclude++; + xsltSetXIncludeDefault(1); +#endif + } else if ((!strcmp(argv[i], "-param")) || + (!strcmp(argv[i], "--param"))) { + i++; + params[nbparams++] = argv[i++]; + params[nbparams++] = argv[i]; + if (nbparams >= 16) { + fprintf(stderr, "too many params\n"); + return (1); + } + } else if ((!strcmp(argv[i], "-maxdepth")) || + (!strcmp(argv[i], "--maxdepth"))) { + int value; + + i++; + if (sscanf(argv[i], "%d", &value) == 1) { + if (value > 0) + xsltMaxDepth = value; + } + } else { + fprintf(stderr, "Unknown option %s\n", argv[i]); + usage(argv[0]); + return (1); + } + } + params[nbparams] = NULL; + + /* + * Replace entities with their content. + */ + xmlSubstituteEntitiesDefault(1); + + /* + * Register the EXSLT extensions + */ + exslRegisterAll(); + + for (i = 1; i < argc; i++) { + if ((!strcmp(argv[i], "-maxdepth")) || + (!strcmp(argv[i], "--maxdepth"))) { + i++; + continue; + } else if ((!strcmp(argv[i], "-o")) || + (!strcmp(argv[i], "-output")) || + (!strcmp(argv[i], "--output"))) { + i++; + continue; + } + if ((!strcmp(argv[i], "-param")) || (!strcmp(argv[i], "--param"))) { + i += 2; + continue; + } + if ((argv[i][0] != '-') || (strcmp(argv[i], "-") == 0)) { + if (timing) + gettimeofday(&begin, NULL); + style = xmlParseFile((const char *) argv[i]); + if (timing) { + long msec; + + gettimeofday(&end, NULL); + msec = end.tv_sec - begin.tv_sec; + msec *= 1000; + msec += (end.tv_usec - begin.tv_usec) / 1000; + fprintf(stderr, "Parsing stylesheet %s took %ld ms\n", + argv[i], msec); + } + if (style == NULL) { + fprintf(stderr, "cannot parse %s\n", argv[i]); + cur = NULL; + } else { + cur = xsltLoadStylesheetPI(style); + if (cur != NULL) { + /* it is an embedded stylesheet */ + xsltProcess(style, cur, argv[i]); + xsltFreeStylesheet(cur); + exit(0); + } + cur = xsltParseStylesheetDoc(style); + if (cur != NULL) { + if (cur->indent == 1) + xmlIndentTreeOutput = 1; + else + xmlIndentTreeOutput = 0; + i++; + } + } + break; + + } + } + + /* + * disable CDATA from being built in the document tree + */ + xmlDefaultSAXHandlerInit(); + xmlDefaultSAXHandler.cdataBlock = NULL; + + if ((cur != NULL) && (cur->errors == 0)) { + for (; i < argc; i++) { + doc = NULL; + if (timing) + gettimeofday(&begin, NULL); +#ifdef LIBXML_HTML_ENABLED + if (html) + doc = htmlParseFile(argv[i], NULL); + else +#endif +#ifdef LIBXML_DOCB_ENABLED + if (docbook) + doc = docbParseFile(argv[i], NULL); + else +#endif + doc = xmlParseFile(argv[i]); + if (doc == NULL) { + fprintf(stderr, "unable to parse %s\n", argv[i]); + continue; + } + if (timing) { + long msec; + + gettimeofday(&end, NULL); + msec = end.tv_sec - begin.tv_sec; + msec *= 1000; + msec += (end.tv_usec - begin.tv_usec) / 1000; + fprintf(stderr, "Parsing document %s took %ld ms\n", + argv[i], msec); + } + xsltProcess(doc, cur, argv[i]); + } + xsltFreeStylesheet(cur); + } + xsltUnregisterAllExtModules(); + xmlCleanupParser(); + xmlMemoryDump(); + return (0); +} + -- cgit v1.2.3