Nest noop in the Output template

Hi Experts
I created a nest loop in the output template:
%loop dlist1%
%value $index% <!–(1)–>
%loop dlist2%
%value $index <1–(2)–>
The first %value $index% return the correct index of the outside loop. The second %value $index% always return -1.
How can I let the outside loop remember its index after a inside loop.

Thanks in advance