bug fix for 'too many nested loops'

Converted f:iterateTokens to an xslt template to allow
tail-recursion optimisation