+Wed Nov 24 10:51:51 HKT 2004 William Brack <wbrack@mmm.com.hk>
+
+ * libxslt/variables.c, libxslt/xsltInternals.h: enhanced the
+ evaluation of global variables to take account of possible
+ changes to the current document (bug 158372).
+
Mon Nov 22 08:10:18 HKT 2004 William Brack <wbrack@mmm.com.hk>
* libxslt/pattern.c: small change to previous fix for bug 153137,
if ((ctxt == NULL) || (elem == NULL))
return(NULL);
- if (elem->computed)
+ /* For pre-computation, need to correlate with the current document */
+ if ((elem->computed) && (elem->doc == ctxt->xpathCtxt->doc))
return(elem->value);
"Evaluating global variable %s\n", elem->name));
#endif
+ /* If document has changed, destroy the old value */
+ if (elem->value != NULL) {
+ xmlXPathFreeObject(elem->value);
+ elem->value = NULL;
+ }
+
#ifdef WITH_DEBUGGER
if ((ctxt->debugStatus != XSLT_DEBUG_NONE) &&
elem->comp && elem->comp->inst)
if (result != NULL) {
elem->value = result;
elem->computed = 1;
+ elem->doc = ctxt->xpathCtxt->doc;
}
elem->name = name;
return(result);
const xmlChar *select; /* the eval string */
xmlNodePtr tree; /* the tree if no eval string or the location */
xmlXPathObjectPtr value; /* The value if computed */
+ xmlDocPtr doc; /* The document used to compute the value */
};
/*