[erlang-questions] getting rid of whitespace from ErlTL rendered xml

Bryan Fink bryan.fink@REDACTED
Tue Feb 17 18:54:18 CET 2009


2009/2/17 Salonee Sinha Roy <ssroy1979@REDACTED>:
> Hello All
> I have an ErlTl template defined as follows
>
> <%? {Users} = Data %><friends><% [user(User) || User <- Users] %></friends>
> <%@ user %>
> <%? {Uid,Name} = Data %>
> <friend><uid><% Uid %></uid><name><% Name %></name></friend>
>
> When I compile and render it using a list of friends, it always puts 2
> newline characters before each entry of the <friend> tag.
>
> I would like to know if there is a way of getting rid of the white space
> completely. Any help would be appreciated

Hi, Salonee.  It has been a little while since I wrote any ErlTL, but
if memory serves, the only way to get rid of whitespace in your output
is to get rid of whitespace in your input.  That is, write the whole
'user' function definition on one line:

<%@ user %><%? {Uid,Name} = Data %><friend>...</friend>

You may also be able to play games with ErlTL comments.  Something like:

<%@ user %><%!
%><%? {Uid,Name} = Data %><%!
%><friend>...</friend>

but, I don't remember.

-Bryan



More information about the erlang-questions mailing list