Templates, loops, dynamically list 1 or more lines

I have to write a template so that I can produce the following - queue physicalName can vary in quantity, and may have 1 2 or 3 entries typically. This seems to be the challenge. I can do a more static version with - { ‘x’:‘y’, ‘z’:‘a’ } but then I can’t figure out how to dynamically list more than 1 entry for physicalName without affecting every line in my output - I have 30 queues to set up like this.

I’m at loss how to do this. I could paste numerous examples of what I’ve done, but I feel it’s a tad pointless as I feel I’m so far away from having something remotely credible. Sorry!

Jinja2 questions should be pretty easy, though to understand better, what are the variable inputs coming into the template?

I’m frequently finding myself at lost in jinja2. Petros example worked ( i can’t see it here!?!) , and I’m back on track - thanks!

The composite queues are fuse mq queues our infrastructure can subscribe to. Physical queues forward copies of messages, logstash or mule for example.

Without some examples of what the variables are I’m afraid I can’t provide further help.

The looping and such is pretty straightforward so it would be easy to offer examples.

It seems the response I’m referring to is not on the thread - here it is:

"You can define your data like this:

queues:
logstash:
name: 1P.LOGSTASH
something:
name: 1P.SOMETHING
foo:
name: 1P.FOO
bar:
name: 1P.BAR

composite_queues:
- name: 1P.EMAIL
queues:
- logstash
- name: 1P.IP_EVT
queues:
- logstash
- something
- name: 1P.IP_BLAH
queues:
- logstash
- foo
- bar

Then your template would look like this:

{% for composite_queue in composite_queues %}
<compositeQueue name="{{ [composite_queue.name](http://composite_queue.name/) }}" forwardOnly="false">
<forwardTo>
{% for queue in composite_queue.queues %}
``` {% endfor %} {% endfor %}`