File: 49literal.t

package info (click to toggle)
libxml-xpath-perl 1.48-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 608 kB
  • sloc: perl: 4,444; xml: 34; makefile: 10
file content (31 lines) | stat: -rw-r--r-- 798 bytes parent folder | download | duplicates (3)
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
27
28
29
30
31
use Test::More;
use XML::XPath;
use XML::XPath::Parser;
use XML::XPath::XMLParser;

my $p = XML::XPath->new(filename => 'examples/test.xml');
ok($p);

my $pp = XML::XPath::Parser->new();
ok($pp);

$pp->parse("variable('amount', number(number(./rate/text()) * number(./units_worked/text())))");

my $path = $pp->parse('.//
           tag/
           child::*/
           processing-instruction("Fred")/
           self::node()[substr("33", 1, 1)]/
           attribute::ra[../@gunk]
                   [(../../@att="va\'l") and (@bert = "geee")]
                   [position() = child::para/fred]
                   [0 -.3]/
           geerner[(farp | blert)[predicate[@vee]]]');

ok($path);
ok($path->as_string);

my $nodes = $p->find('/timesheet//wednesday');
is($nodes->size, 2);

done_testing();