Re: [xslt] [PATCH] Bug: xsltCompilePattern : failed to compile '@node()'



Hi Nick!

Nick Wellnhofer schrieb:
I have always used match="@*" which works as expected.

Of course, that's the conventional and canonical form. The pattern
@node() is, however, a legal expression, even though there is never
any need to use it.

But, being curious, I had a deeper look at xsltCompileStepPattern. The
problem is that "@node()", "attribute::node()", "child::node()" and
"node()" are all handled in different code paths and only the latter
works.

Well, @node() and attribute::node() are exactly equivalent; and so are
node() and child::node().

I'm leaving the C stuff to more knowledgeable people to comment on.

Attached is a patch against trunk that fixes all these issues. It
merges the parsing of NodeTests in StepPatterns into a single code
path keeping track of the axis that has been specified previously. The
patch also contains some test cases.

I can confirm that this patch fixes the issue at hand here, i.e. the
compilation of @node() in a match pattern.

Michael Ludwig


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