Help with sort by please

Hello,

I’m just a newbie with Tamino and XQuery, and I’m in a hurry to solve this:

I need to get some information from a XML document with linguistic information. I’m usig this query working perfectly:

declare namespace tf="http://namespaces.softwareag.com/tamino/TaminoFunction\"
for $a in input()/agrupacion/documento/oracion/tokens/token2
let $ref := tf:createTextReference($a/…/…/texto_oracion,“sen embargo”)
where tf:containsText($a,“sen embargo”)
return

{ $a/…/…/…/…/cabeceira_agrupacion/titulo }
{ $a/…/…/…/…/cabeceira_agrupacion/autor }
{ $a/…/…/…/…/cabeceira_agrupacion/editorial }
{ $a/…/…/…/…/cabeceira_agrupacion/medio }
{ $a/…/…/…/…/cabeceira_agrupacion/ano_publicacion }
<area_tematica>
{ $a/…/…/…/area_tematica/codigo }
{$a/…/…/…/area_tematica/subcodigo }
</area_tematica>

{ $a/…/…/…/autor }

{ $a/…/…/@tipo }


{tf:highlight($a/…/…/texto_oracion, $ref, “High”)}

But I need to sort the results by ano_publicacion, medio and area_tematica/codigo. I’ve tried somethings with a sort by just at the end of the query (after ) but it seems to not sort. I’m really lost and in a hurry. Any quick help will be highly wellcome.

Kind regards,
Moli.

At the end of your query, add

sort by (cabecera/ano_publicacion, cabecera/medio, cabecera/area_tematica/codigo)

Yeah, finaly I managed to the same solution.

Thank you very much for your reply.

Kind regards,
Moli.