for loop sorted output in a template

Hi,

I’ve had this problem came up a few times and hope someone here has a solution for it.

I have a basic for loop in a template where multiple lines are printed per loop. The problem is that I’d like similar lines to be grouped.

Example:

myvar:
- {name: one, value: 1}
- {name: two, value: 2}

{% for v in myvar %}
name is {{v.name}}
val is {{v.value}}
{% endfor %}

That generates:

name is one
value is one
name is two
value is two

What I would like:

name is one
name is two

value is two

value is one

is this possible without a double loop each one containing a line?

thanks,

Spike