Re: [xslt] "|" operator



Well, I think I have fixed it...

Ron Burk wrote:

>> suggestions would be welcome.
>
> Seems like it might be an optimization bug. For example,
> in xmlXPathCtxtCompile() in xpath.c, simply changing the
> first "#ifdef XPATH_STREAMING" to a "#if 0" appears to
> eliminate the bad behavior. Indeed, even in the case
> of "one|.", I am somewhat puzzled to see the execution
> path going to compiling a step pattern rather than doing
> the normal XPath compilation, leaving me wondering if
> that expression is only accidentally producing the
> correct answer.
>
> I was not knowledgeable enough to make out exactly what
> the test at the beginning of xmlXPathTryStreamCompile()
> is intending to identify. It looks like an attempt to
> check for predicates, but not a reasonable one, so
> probably I don't understand the overall design.

The "streaming" code (much of which is shared with the schemas
implementation) is an attempt to provide a more efficient execution of
XPath expressions.  During parsing of XPath expressions, checks are
made to see if the expression can be "streamed" (or, more precisely,
whether the code thinks it might be able to generate a stream).  If
so, the stream is generated and, at execution time, it is executed
(see xmlXPathRunStreamEval).

The problem was in two parts.  First, when the "." pattern was
detected in the expression, a special optimisation was enacted,
forcing all of the nodes "associated" with the element (e.g.
properties, attributes, text, etc.) to be included for consideration
by the remainder of the stream.  Second, during the cleanup code after
the stream was executed, an assumption was made about one of the
variables associated with the stream which was not correct for this
"special optimisation".

Changed code (libxml2/pattern.c) is in SVN rev 3752.

I note that, despite my initial request, no bug report was ever opened
for this :-(.

Bill





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]