in reply to Problems with Template Toolkit and ttree
[% FOREACH link = query_link.execute( $item.category ) %]
should be
[% FOREACH link = query_link.execute( item.category ) %]