File: 46context.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 (30 lines) | stat: -rw-r--r-- 813 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
use strict;
use warnings;

use Test::More;
use XML::XPath;

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

ok($xp);

# Debian bug #187583, http://bugs.debian.org/187583
# Check that evaluation doesn't lose the context information

my $nodes = $xp->find("text/para/node()[position()=last() and preceding-sibling::important]");
ok("$nodes", " has a preceding sibling.");

$nodes = $xp->find("text/para/node()[preceding-sibling::important and position()=last()]");
ok("$nodes", " has a preceding sibling.");

done_testing();

__DATA__
<text>
  <para>I start the text here, I break
the line and I go on, I <blink>twinkle</blink> and then I go on
    again.
This is not a new paragraph.</para><para>This is a
    <important>new</important> paragraph and
    <blink>this word</blink> has a preceding sibling.</para>
</text>