I have an xml snippet with a many-to-many relation through id attributes, an example would be like so:
<root>
<foolist name="firstlist">
<foo barid="1" someval="some"/>
<foo barid="1" someval="other"/>
<foo barid="2" someval="third"/>
</foolist>
<foolist name="secondlist">
<!-- there might be more foo's here that reference the same
bars, so foo can't be a child of bar -->
</foolist>
<bar id="1" baz="baz" qux="qux"/>
<bar id="2" bax="baz2" qux="qux2"/>
</root>
Say I want to get out the following:
baz-some-qux
baz-other-qux
baz2-third-qux2
(that is, insert the value of someval between the values of baz and qux from the referenced item), how should I do this? If I want to use a template for bar, I would need two different ones. I’m probably missing something really basic here, so my apologies in advance.
(EDIT: expanded example)
This should do the trick: