#!/usr/bin/perl use strict; use Test; BEGIN { plan tests => 2, todo => []; } use XML::XPathScript; do { my $xps = new XML::XPathScript( xml => <<'XML', XML stylesheet => <<'STYLE' ); <% $t->{'linkinter'}{pre} = ''; $t->{'linkinter'}{post} = ''; $t->{'link'}{testcode} = sub { my ($currentnode, $t) = @_; my $url = $currentnode->getAttribute('url'); $t->{pre}=""; $t->{post}=''; return 1; }; %><%= apply_templates() %> STYLE my $buf="ABC"; $xps->process(\$buf); ok($buf, <<'EXPECTED'); EXPECTED }; do { my $xps = new XML::XPathScript( xml => <<'XML', XML stylesheet => <<'STYLE' ); <% # by default, we interpolate die unless get_interpolation(); # set to 1 (no-op) die unless set_interpolation(1); # recheck die unless get_interpolation(); # set to 0 die if set_interpolation(0); # re-check die if get_interpolation(); # set to 0 again die if set_interpolation(0); die if get_interpolation(); $t->{'link'}{pre} = ''; $t->{'link'}{post} = ''; %><%= apply_templates() %> STYLE my $buf=""; $xps->process(\$buf); ok($buf, <<'EXPECTED'); EXPECTED };