Commit de1fca61 authored by Nick Wellnhofer's avatar Nick Wellnhofer

Fix for compiled XPath helpers

The helper functions added in commit c618db4b didn't restore context size
and position. Unfortunately, xmlXPathCompiledEval changes these values
in some rare cases.
parent daab56af
......@@ -353,10 +353,12 @@ xsltPreCompEval(xsltTransformContextPtr ctxt, xmlNodePtr node,
xmlXPathContextPtr xpctxt;
xmlNodePtr oldXPContextNode;
xmlNsPtr *oldXPNamespaces;
int oldXPNsNr;
int oldXPProximityPosition, oldXPContextSize, oldXPNsNr;
xpctxt = ctxt->xpathCtxt;
oldXPContextNode = xpctxt->node;
oldXPProximityPosition = xpctxt->proximityPosition;
oldXPContextSize = xpctxt->contextSize;
oldXPNsNr = xpctxt->nsNr;
oldXPNamespaces = xpctxt->namespaces;
......@@ -377,6 +379,8 @@ xsltPreCompEval(xsltTransformContextPtr ctxt, xmlNodePtr node,
res = xmlXPathCompiledEval(comp->comp, xpctxt);
xpctxt->node = oldXPContextNode;
xpctxt->proximityPosition = oldXPProximityPosition;
xpctxt->contextSize = oldXPContextSize;
xpctxt->nsNr = oldXPNsNr;
xpctxt->namespaces = oldXPNamespaces;
......@@ -398,10 +402,12 @@ xsltPreCompEvalToBoolean(xsltTransformContextPtr ctxt, xmlNodePtr node,
xmlXPathContextPtr xpctxt;
xmlNodePtr oldXPContextNode;
xmlNsPtr *oldXPNamespaces;
int oldXPNsNr;
int oldXPProximityPosition, oldXPContextSize, oldXPNsNr;
xpctxt = ctxt->xpathCtxt;
oldXPContextNode = xpctxt->node;
oldXPProximityPosition = xpctxt->proximityPosition;
oldXPContextSize = xpctxt->contextSize;
oldXPNsNr = xpctxt->nsNr;
oldXPNamespaces = xpctxt->namespaces;
......@@ -422,6 +428,8 @@ xsltPreCompEvalToBoolean(xsltTransformContextPtr ctxt, xmlNodePtr node,
res = xmlXPathCompiledEvalToBoolean(comp->comp, xpctxt);
xpctxt->node = oldXPContextNode;
xpctxt->proximityPosition = oldXPProximityPosition;
xpctxt->contextSize = oldXPContextSize;
xpctxt->nsNr = oldXPNsNr;
xpctxt->namespaces = oldXPNamespaces;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment