in the expression a/[EMAIL PROTECTED] = ancestor::a/d/@e] the sub-expression ancestor::a/d/@e
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? but, xpath is going to evaluate the sub expression multiple times, ie, for evey b element. there should be a way to optimize this. comments? Thanks Jaspreet -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Sunday, May 08, 2005 1:46 AM To: [EMAIL PROTECTED] Subject: Re: caching while evaluating xpath > a/[EMAIL PROTECTED] = ancestor::a/d/@e] > > the result of the sub-expression is going to be the same for all b > elements. sok how can i cache this result so that its not evaluated > for every b? I think you need to be more specific about what the exact sub-expression you are referring to, and why you know it has no context dependencies. There is no general mechanism in the XPath engine to incorporate caching results of particular expressions. The only way you'll be able to optimize this with knowledge of the context is to re-write the expression. Dave
