[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xalan-c-users
Subject:    RE: caching while evaluating xpath
From:       david_n_bertoni () us ! ibm ! com
Date:       2005-05-09 17:44:39
Message-ID: OF27A6AB17.8BE428CA-ON88256FFC.005F4DDB-88256FFC.00617701 () lotus ! com
[Download RAW message or body]

> is always going to yeild the same result. because from all b elements
> we're going to the ancestor a element (this is going to be the same for
> all the b elements since we're traversing only the first a element),
> then going to all the d elements and fetching the e attrib. this is
> always going to be same, aint it?

No, because the result depends on the context node list when "a/b" is 
evaluated.  You may know it's going to be the same always, but the 
processor doesn't know that when it compiles the expression.

There's no straightforward way to do this, although you could use a 
variable if we support variable bindings in the XPathEvaluator.  You could 
create an enhancement request in Jira, if you really need this.  Then, you 
could evaluate "ancestor::a/d/@e", store it in a variable, and refer to it 
in your expression:

"a/b[@c = $a]"

Dave
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic