From 6e4d7223876c90b76d444b625b975d2e942fdb76 Mon Sep 17 00:00:00 2001 From: "kvisco%ziplink.net" Date: Tue, 7 Nov 2000 10:42:35 +0000 Subject: [PATCH] Not part of regular build. Added fix for expressions starting with '/' --- extensions/transformiix/source/xpath/PathExpr.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/extensions/transformiix/source/xpath/PathExpr.cpp b/extensions/transformiix/source/xpath/PathExpr.cpp index d7c66d68233..de6fc262a2c 100644 --- a/extensions/transformiix/source/xpath/PathExpr.cpp +++ b/extensions/transformiix/source/xpath/PathExpr.cpp @@ -29,7 +29,7 @@ * - foo//bar would not match properly if there was more than * one node in the NodeSet (nodes) on the final iteration * - * $Id: PathExpr.cpp,v 1.3 2000-05-29 07:15:17 kvisco%ziplink.net Exp $ + * $Id: PathExpr.cpp,v 1.4 2000-11-07 10:42:35 kvisco%ziplink.net Exp $ */ #include "Expr.h" @@ -239,7 +239,11 @@ MBool PathExpr::matches(Node* node, Node* context, ContextState* cs) { case PARENT_OP: { Node* parent = cs->getParentNode(node); - if (parent) return pxi->pExpr->matches(node, parent, cs); + if (parent) { + //-- make sure node is Document node + if (parent->getNodeType() == Node::DOCUMENT_NODE) + return pxi->pExpr->matches(node, parent, cs); + } break; } default: @@ -285,6 +289,11 @@ MBool PathExpr::matches(Node* node, Node* context, ContextState* cs) { { Node* parent = cs->getParentNode(tnode); if (parent) { + + //-- make sure we have a document node if necessary + if ( !iter->hasNext() ) + if (parent->getNodeType() != Node::DOCUMENT_NODE) break; + if (pxi->pExpr->matches(tnode, parent, cs)) tmpNodes.add(parent); }