On Sat, 19 Jan 2002, Olaf P�schel wrote:

> Hi!
>
> Thank you for you advice Matt,
>
> > > Now I habe an XPathScript Stylesheet which I would presume to give the same
> > > outtput:
> > >
> > > <%
> > > $t->{'top'}{pre} = "A List\n\n";
> > > $t->{'sub'}{pre} = findvalue('position()') . ") ";
> >
> > This is not executed per element. If you want that behaviour, you need to
> > use testcode.
>
> but I still seem to dumb. I tried this:
>
> <%
> $t->{'top'}{pre} = "A List\n\n";
> $t->{'sub'}{testcode} = sub {
>   my ($node, $t) = @_;
>   my $pos = $node->findvalue('position()');
>   $t->{pre} = $pos . ") ";
> };
>
> print apply_templates();
> %>
>
> But it just gives an error. If I just print the value of $pos instead of
> assigning it to $t->{pre} I just get NaN's. Thats confusing.

That's because $node->findvalue('position()') will return the position of
the node from the context node, which happens to be this node. So you'll
have to use a testcode on the parent of <sub> and set $t->{prechildren}.

-- 
<!-- Matt -->
<:->Get a smart net</:->


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to