Looping in .xml.builder

In my show.xml.builder I have following code.

xml.events {

<% @events.each do |event| %>
   xml.event event.name
   xml.id event.id
<% end %>
  }

But the above code doesn't work. Anyone knows how to incorporate looping
in .xml.builder file.

Thanks

builder isn't erb: there are no <% or <%=

xml.events {
  @events.each do |event|
   xml.event event.name
   xml.id event.id
  end
}
should work (although i suspect that's not the output you wanted.

Fred