Commit 0cb8d449 authored by Kenneth Leiter's avatar Kenneth Leiter

BUG: Fix bug causing nested xincludes to not work properly.

Fix a bug in the reader that caused xincludes to not work properly when
nested. The xinclude needs to be evaluated in the local context rather
than the global context.
parent 734d4cf0
......@@ -135,7 +135,7 @@ public:
currAttribute = currAttribute->next;
}
xmlXPathContextPtr context = mXPathContext;
xmlXPathContextPtr oldContext = mXPathContext;
if(href) {
xmlDocPtr document;
xmlChar * filePath = xmlBuildURI(href, mDocument->URL);
......@@ -149,11 +149,11 @@ public:
document = iter->second;
}
context = xmlXPtrNewContext(document, NULL, NULL);
mXPathContext = xmlXPtrNewContext(document, NULL, NULL);
}
if(xpointer) {
xmlXPathObjectPtr result = xmlXPtrEval(xpointer, context);
xmlXPathObjectPtr result = xmlXPtrEval(xpointer, mXPathContext);
if(result && !xmlXPathNodeSetIsEmpty(result->nodesetval)) {
for(int i=0; i<result->nodesetval->nodeNr; ++i) {
this->readSingleNode(result->nodesetval->nodeTab[i],
......@@ -164,9 +164,11 @@ public:
}
if(href) {
xmlXPathFreeContext(context);
xmlXPathFreeContext(mXPathContext);
}
mXPathContext = oldContext;
}
else {
// Normal reading
......
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