summaryrefslogtreecommitdiff
path: root/t/26predicate.t
blob: 8312c0a8f655bf40412fa548f5ded5325fc38a61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use Test;
BEGIN { plan tests => 4 }

use XML::XPath;
ok(1);

my $xp = XML::XPath->new(ioref => *DATA);
ok($xp);

my @bbb = $xp->findnodes('//a/b[2]');
ok(@bbb, 2);

@bbb = $xp->findnodes('(//a/b)[2]');
ok(@bbb, 1);

__DATA__
<xml>
    <a>
        <b>some 1</b>
        <b>value 1</b>
    </a>
    <a>
        <b>some 2</b>
        <b>value 2</b>
    </a>
</xml>