Thankyou very much for your response mhkay.
Unfortunately I don't really understand the solution you're describing. Maybe it would be clearer if I were more specific.
I have an array of languages that looks like:
Code:
<lang>
<value>fr-fr</value>
<value>es-es</value>
<value>en-gb</value>
</lang>
which I'm storing in a variable called $lang.
I then have the data object which looks like:
Code:
<data>
<id>1</id>
<priority>0</priority>
<Translation>
<en-gb>
<id>1</id>
<title>Hello</title>
<lang>en-gb</lang>
</en-gb>
<es-es>
<id>1</id>
<title>Hola</title>
<lang>es-es</lang>
</es-es>
</Translation>
</data>
How can I write a single XPath query to get the first available translation from the Translation node which matches languages in order from $lang, retrieve the title, and only get the first one?
Thanks again!