1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-07-30 22:43:14 +03:00

- testXPath.c xpath.c: fixing the XPath union expressions problem

reported by  Martin Vidner <martin@artax.karlin.mff.cuni.cz>
Daniel
This commit is contained in:
Daniel Veillard
2001-01-03 15:24:58 +00:00
parent 4a6845df29
commit 081089848c
3 changed files with 14 additions and 3 deletions

11
xpath.c
View File

@ -4730,12 +4730,13 @@ xmlXPathEvalUnionExpr(xmlXPathParserContextPtr ctxt) {
xmlXPathEvalPathExpr(ctxt);
CHECK_ERROR;
SKIP_BLANKS;
if (CUR == '|') {
xmlXPathObjectPtr obj1,obj2;
while (CUR == '|') {
xmlXPathObjectPtr obj1,obj2, tmp;
CHECK_TYPE(XPATH_NODESET);
obj1 = valuePop(ctxt);
valuePush(ctxt, xmlXPathNewNodeSet(ctxt->context->node));
tmp = xmlXPathNewNodeSet(ctxt->context->node);
valuePush(ctxt, tmp);
NEXT;
SKIP_BLANKS;
@ -4745,6 +4746,10 @@ xmlXPathEvalUnionExpr(xmlXPathParserContextPtr ctxt) {
obj2 = valuePop(ctxt);
obj1->nodesetval = xmlXPathNodeSetMerge(obj1->nodesetval,
obj2->nodesetval);
if (ctxt->value == tmp) {
tmp = valuePop(ctxt);
xmlXPathFreeObject(tmp);
}
valuePush(ctxt, obj1);
xmlXPathFreeObject(obj2);
SKIP_BLANKS;