[xml] Problem with xsltParseStylesheetImportedDoc / xsltGatherNamespaces



Hi,

I just upgraded to libxslt-1.1.17 and found what appears to be a bug in the the stylesheet creation. In version 1.1.15, the code in xsltParseStylesheetImportedDoc was:

    ...
    ret->doc = doc;
    ret->parent = style;        /* needed to prevent loops */
    xsltGatherNamespaces(ret);
    ...

and the current code (removing the ifdefs) is:

    retStyle->parent = parentStyle;
    ...
    xsltGatherNamespaces(retStyle);
    retStyle->doc = doc;

In xsltGatherNamespaces, it collects all the namespaces from the ->doc which it can no longer do because the doc has not been set before calling it.

The attached patch fixes the problem by setting the doc before calling the gather function. I included an #ifndef on the assumption that it should not be set in the new refactoring code (but that was just a guess).

Cheers,
Chris.

--
Christopher R. Palmer                     palmer vivisimo com
Chief Technology Officer                  www.vivisimo.com
Vivisimo, Inc.                            412-422-2499 ext. 118
diff --unified -r orig/libxslt-1.1.17/libxslt/xslt.c libxslt-1.1.17/libxslt/xslt.c
Index: libxslt-1.1.17/libxslt/xslt.c
--- orig/libxslt-1.1.17/libxslt/xslt.c  2006-06-01 08:29:11.000000000 -0400
+++ libxslt-1.1.17/libxslt/xslt.c       2006-08-28 10:17:14.000000000 -0400
@@ -6207,6 +6207,11 @@
     * TODO: Eliminate xsltGatherNamespaces(); we must not restrict
     *  the stylesheet to containt distinct namespace prefixes.
     */
+
+#ifndef XSLT_REFACTORED
+    retStyle->doc = doc;
+#endif
+
     xsltGatherNamespaces(retStyle);
 
 #ifdef XSLT_REFACTORED
@@ -6321,7 +6326,6 @@
     /*
     * Old behaviour.
     */
-    retStyle->doc = doc;
     xsltParseStylesheetProcess(retStyle, doc);
     if (retStyle != NULL) {
        if (retStyle->errors != 0) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]