The normal way to solve this is to generate each of the output documents in turn, rather than trying to produce them in parallel. Yes, this may require walking the input document repeatedly, but XSLT can do so.
______________________________________ "... Three things see no end: A loop with exit code done wrong, A semaphore untested, And the change that comes along. ..." -- "Threes" Rev 1.1 - Duane Elms / Leslie Fish ( http://www.ovff.org/pegasus/songs/threes-rev-11.html)