summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--libxslt/documents.c15
-rw-r--r--libxslt/keys.c12
-rw-r--r--libxslt/transform.c30
-rw-r--r--libxslt/transform.h11
-rw-r--r--libxslt/xsltInternals.h2
-rw-r--r--libxslt/xsltproc.c1
7 files changed, 69 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 80fc0813..40760ce9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Fri Jun 15 18:29:29 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
+
+ * libxslt/keys.c: avoid a possibility of an uninitialized variable
+ * libxslt/documents.c libxslt/transform.[ch] libxslt/transform.h
+ libxslt/xsltInternals.h libxslt/xsltproc.c: Implement Raphael Hertzog
+ request to have xinclude processing done on document() if requested
+
Thu Jun 14 20:52:13 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
* libxslt/Makefile.am: applied patch from Sander Vesik for -j2
diff --git a/libxslt/documents.c b/libxslt/documents.c
index f06e4bc0..35c62635 100644
--- a/libxslt/documents.c
+++ b/libxslt/documents.c
@@ -10,6 +10,7 @@
#include <string.h>
+#include <libxml/xmlversion.h>
#include <libxml/xmlmemory.h>
#include <libxml/tree.h>
#include <libxml/hash.h>
@@ -19,11 +20,14 @@
#include "documents.h"
#include "keys.h"
+#ifdef LIBXML_XINCLUDE_ENABLED
+#include <libxml/xinclude.h>
+#endif
+
#ifdef WITH_XSLT_DEBUG
#define WITH_XSLT_DEBUG_DOCUMENTS
#endif
-
/************************************************************************
* *
* Module interfaces *
@@ -158,6 +162,15 @@ xsltLoadDocument(xsltTransformContextPtr ctxt, const xmlChar *URI) {
if (doc == NULL)
return(NULL);
+ if (ctxt->xinclude != 0) {
+#ifdef LIBXML_XINCLUDE_ENABLED
+ xmlXIncludeProcess(doc);
+#else
+ xsltGenericError(xsltGenericErrorContext,
+ "xsltLoadDocument(%s) : XInclude processing not compiled in\n",
+ URI);
+#endif
+ }
ret = xsltNewDocument(ctxt, doc);
return(ret);
}
diff --git a/libxslt/keys.c b/libxslt/keys.c
index 23082b38..16b5b17a 100644
--- a/libxslt/keys.c
+++ b/libxslt/keys.c
@@ -338,16 +338,16 @@ xsltInitCtxtKey(xsltTransformContextPtr ctxt, xsltDocumentPtr doc,
* Evaluate the nodelist
*/
- if (keyd->comp == NULL)
- goto error;
- if (keyd->usecomp == NULL)
- goto error;
-
+ oldXDoc= ctxt->xpathCtxt->doc;
oldPos = ctxt->xpathCtxt->proximityPosition;
oldSize = ctxt->xpathCtxt->contextSize;
oldInst = ctxt->inst;
oldDoc = ctxt->document;
- oldXDoc= ctxt->xpathCtxt->doc;
+
+ if (keyd->comp == NULL)
+ goto error;
+ if (keyd->usecomp == NULL)
+ goto error;
ctxt->document = doc;
ctxt->xpathCtxt->doc = doc->doc;
diff --git a/libxslt/transform.c b/libxslt/transform.c
index 692f5c01..f66a7c3c 100644
--- a/libxslt/transform.c
+++ b/libxslt/transform.c
@@ -108,6 +108,35 @@ PUSH_AND_POP(static, xsltStackElemPtr, vars)
/************************************************************************
* *
+ * XInclude default settings *
+ * *
+ ************************************************************************/
+
+static int xsltDoXIncludeDefault = 0;
+
+/**
+ * xsltSetXIncludeDefault:
+ * @xinclude: whether to do XInclude processing
+ *
+ * Set whether XInclude should be processed on document being loaded by default
+ */
+void
+xsltSetXIncludeDefault(int xinclude) {
+ xsltDoXIncludeDefault = xinclude;
+}
+
+/**
+ * xsltGetXIncludeDefault:
+ *
+ * Returns whether XInclude should be processed on document being loaded
+ */
+int
+xsltGetXIncludeDefault(void) {
+ return(xsltDoXIncludeDefault);
+}
+
+/************************************************************************
+ * *
* handling of transformation contexts *
* *
************************************************************************/
@@ -192,6 +221,7 @@ xsltNewTransformContext(xsltStylesheetPtr style, xmlDocPtr doc) {
docu->main = 1;
cur->document = docu;
cur->inst = NULL;
+ cur->xinclude = xsltDoXIncludeDefault;
return(cur);
}
diff --git a/libxslt/transform.h b/libxslt/transform.h
index 562ec400..46ed133c 100644
--- a/libxslt/transform.h
+++ b/libxslt/transform.h
@@ -16,8 +16,14 @@
extern "C" {
#endif
-/*
- * Interfaces
+/**
+ * XInclude default processing
+ */
+void xsltSetXIncludeDefault (int xinclude);
+int xsltGetXIncludeDefault (void);
+
+/**
+ * Private Interfaces
*/
xmlDocPtr xsltApplyStylesheet (xsltStylesheetPtr style,
xmlDocPtr doc,
@@ -94,6 +100,7 @@ void xsltForEach (xsltTransformContextPtr ctxt,
xmlNodePtr node,
xmlNodePtr inst,
xsltStylePreCompPtr comp);
+
#ifdef __cplusplus
}
#endif
diff --git a/libxslt/xsltInternals.h b/libxslt/xsltInternals.h
index 38868466..58ef1c2e 100644
--- a/libxslt/xsltInternals.h
+++ b/libxslt/xsltInternals.h
@@ -364,6 +364,8 @@ struct _xsltTransformContext {
xmlHashTablePtr globalVars; /* the global variables and params */
xmlNodePtr inst; /* the instruction in the stylesheet */
+
+ int xinclude; /* should XInclude be processed */
};
/**
diff --git a/libxslt/xsltproc.c b/libxslt/xsltproc.c
index 32c1244c..ccf7b7bf 100644
--- a/libxslt/xsltproc.c
+++ b/libxslt/xsltproc.c
@@ -188,6 +188,7 @@ main(int argc, char **argv) {
} else if ((!strcmp(argv[i], "-xinclude")) ||
(!strcmp(argv[i], "--xinclude"))) {
xinclude++;
+ xsltSetXIncludeDefault(1);
#endif
} else if ((!strcmp(argv[i], "-param")) ||
(!strcmp(argv[i], "--param"))) {