Subject: | //elem[n] bug and no test |
In XSLT.pm, in "sub __try_a_step__", the case for //elem[n] appears to
be wrong.
elsif ( $path =~
s/^\/descendant\-or\-self\:\:node\(\)\/(child\:\:|)(\*|[\w\.\:\-]+)\[(\S+?)\]//
)
{
# //elem[n] #
$self->debug(qq{getting deep indexed element `$1' `$2' ("$path")});
$self->_outdent();
return &__indexed_element__( $self, $1, $2, $path, $node, $silent,
"deep" );
The regex has 3 matches. In all other cases, the match for (child::) is
ignored. Here it is not, and the 3rd match (the index) is ignored. I
believe the correct code should be to use $2 and $3 (not $1 and $2).
When I test the original code, the test suite shows no errors. When I
change the code and test it again, the test suite once more shows no
errors. Therefore, this code is not tested in the test suite.