From Code to Community: Sponsoring The Perl and Raku Conference 2025 Learn more
|
plan( tests => 5);
ok(1);
my $parser = XML::DOM::Parser->new;
my $t = $parser ->parse( \ *DATA );
ok( $t );
my @nodes ;
@nodes = $t ->findnodes( '//BBB[position() mod 2 = 0 ]' );
ok( @nodes , 4);
@nodes = $t ->findnodes('//BBB
[ position() = floor( last () div 2 + 0.5)
or
position() = ceiling( last () div 2 + 0.5) ]');
ok( @nodes , 2);
@nodes = $t ->findnodes('//CCC
[ position() = floor( last () div 2 + 0.5)
or
position() = ceiling( last () div 2 + 0.5) ]');
ok( @nodes , 1);
|