Is it not possible to capture the generated output and remove the newlines before outputing?
...we iterate through a variety of items, and output some HTML when the condition is met. The problem is in the finally rendered code-excessive amounts of whitespace occurs. Normally, this isn't a huge problem... with from 1-10 lines showing up in normal .tpls with small amounts of iteration. However, when we created a templated page from the code fragment below-we receive over 900 blank lines. Initially I was looking for a tag attribute that tells iw_iterate to ignore whitespace and to render everything without. Not much luck there, so I thought I'd post here and see what other solutions arise.
Another option is to clean up the white space with a Perl script.This can either be one that runs at generation and removes 'bad' white space from the generated HTML or, if you have a seperate branch for developing/mastering your TPL's it could tidy your TPLs when you deploy them to the production branch.The second option is quite eligant as you keep the readability of your TPL's in your development/mastering branch but have white-space free TPL's (generating white-space free HTML) in your production branches.
I've always found keeping an eye on where you put your <![CDATA[ ]]> tags makes for a reasonable compromise.<iw_something><![CDATA[ <html_tag>]]>Will tend to give you two line feeds before the <html_tag>.<iw_something><![CDATA[ <html_tag>]]>Just gives one
<iw_something><![CDATA[ <html_tag>]]>
<iw_something><html_tag>