On Mon, 21 Jan 2002, Olaf [x-unknown] P�schel wrote:
> Aaaarrrggh. User to stupid error!
>
> Done that, got more sensible output, but still not correct.
>
> whether I do a top/testcode setting prechild or sub/testcode setting pre,
> I still get no numbers, just blanks. Which seem clear to me in case of the
> top/testcode variant because the findvalue is executed in the context
> of the top element. But doing sub/testcode setting pre sould evaluate the
> findvalue in the context of each sub, so I should get the rigth thing!?
>
> My code in question look this:
>
> <%
> $t->{'top'}{pre} = "A List\n\n";
> $t->{'sub'}{testcode} = sub {
> my ($node, $t) = @_;
> my $pos = $node->findvalue('position()');
> $t->{pre} = $pos . ") ";
> return 1;
> };
OK, one more try:
$t->{'top'}{testcode} = sub {
my ($node, $t) = @_;
$t->{pre} = "A List\n\n";
my $pos = 1;
foreach my $kid ($node->findnodes('./node()')) {
if ($kid->isElementNode && $kid->getName eq 'sub') {
$t->{pre} .= "$pos) ";
$pos++;
}
$t->{pre} .= apply_templates($kid);
}
return DO_SELF_ONLY;
}
--
<!-- Matt -->
<:->Get a smart net</:->
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]