fixed a problem of tree structure raised by the new libxml2 tree checking
authorDaniel Veillard <veillard@src.gnome.org>
Thu, 7 Oct 2004 14:14:13 +0000 (14:14 +0000)
committerDaniel Veillard <veillard@src.gnome.org>
Thu, 7 Oct 2004 14:14:13 +0000 (14:14 +0000)
* libxslt/transform.c: fixed a problem of tree structure raised
  by the new libxml2 tree checking code.
Daniel

ChangeLog
libxslt/transform.c

index 3b7c0db..ffa0205 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Thu Oct  7 16:15:15 CEST 2004 Daniel Veillard <daniel@veillard.com>
+
+       * libxslt/transform.c: fixed a problem of tree structure raised
+         by the new libxml2 tree checking code.
+
 Thu Sep 30 11:28:03 PDT 2004 William Brack <wbrack@mmm.com.hk>
 
        * libexslt/date.c: fixed problem with negative periods
index 4515bb8..90f1df5 100644 (file)
@@ -4174,14 +4174,24 @@ xsltApplyStylesheetInternal(xsltStylesheetPtr style, xmlDocPtr doc,
             XSLT_GET_IMPORT_PTR(doctypePublic, style, doctypePublic)
             XSLT_GET_IMPORT_PTR(doctypeSystem, style, doctypeSystem)
             if (((doctypePublic != NULL) || (doctypeSystem != NULL))) {
+               xmlNodePtr last;
                /* Need a small "hack" here to assure DTD comes before
                   possible comment nodes */
                node = res->children;
+               last = res->last;
                res->children = NULL;
+               res->last = NULL;
                 res->intSubset = xmlCreateIntSubset(res, doctype,
                                                     doctypePublic,
                                                     doctypeSystem);
-               res->children->next = node;
+               if (res->children != NULL) {
+                   res->children->next = node;
+                   node->prev = res->children;
+                   res->last = last;
+               } else {
+                   res->children = node;
+                   res->last = last;
+               }
            }
         }
     }