Mark,
I have never seen an Xlate add unwanted line feeds or carriage returns.
This may be just me, but an Xlate would have been my first choice of action. You may still need some Tcl within the Xlate depending on your requirements.
If you do not want to use the Xlate, then start testing your Tcl proc in anger to see where it is broken.
Jim Kosloskey
email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.