#359 current() in pattern

v8.4
closed
Michael Kay
5
2012-10-08
2005-05-11
Michael Kay
No

When the current() function is called in a predicate of
a pattern, other than a predicate in the last step of
the pattern, it returns the wrong node. Specifically,
it returns the node being matched by that step of the
pattern rather than the node being matched by the
pattern as a whole.

For example, the pattern

match="[name()=name(current())]/"

should match all elements that have the same name as
their parent element. In fact it matches all elements
that have a parent element, because the predicate
name()=name(current()) always evaluates to true.

This bug is present in 8.4 and all known previous
releases since the current() function was allowed in
patterns.

No source patch is available since the design changes
to fix this are quite extensive. Test case: cnfr30.

Discussion