aha! many thanks. The memory usage was exactly what I was trying to avoid. I just had a brain fade and forgot about the $loop variable. I started to put my own
incrementing counter inside the <xtree></xtree> loop, but thought there **had** to be a better way.