[FLWOR] order by doesn´t work?

Hi,

I try to get some data from an XML-Database using the following FLWOR-Code:


<Projekte>
    {let $projekt := 
      for $p in collection("/db/bka/projects/current")//STM_Projekt
      order by $p/STM_Kurzbezeichnung
      return $p,
     $count := count($projekt),
     $begin := 1,
     $max := 10,
     $end := if($count >= $max) then $max else $count
     for $i in $begin to $end
     return
     <Projekt>
     <STM_Kurzbezeichnung href="index.php?nav=p.prwart.stmdat&project={item-at($projekt/../@ProjektID, $i)}">{item-at($projekt/STM_Kurzbezeichnung/text(), $i)}</STM_Kurzbezeichnung>
     <STM_Projektbezeichnung href="false">{item-at($projekt/STM_Projektbezeichnung/text(), $i)}</STM_Projektbezeichnung>
</Projekt>
    }
</Projekte>

But the DB answers with an error: “Operation not supported”. Without the Line " order by $p/STM_Kurzbezeichnung" it works. I want the list to be ordered before the line “for $i in $begin to $end”. Is this possible?

Thanks in advance,
Baerlie

I suspect that “sort by” may do what you want.

“sort by” causes an error:

Error found: error found while executing eval expression: unexpected token: sort

The format of the query is:


declare namespace tf = "http://namespaces.softwareag.com/tamino/TaminoFunction"
for $a in input()/A
let $lm :=tf:getLastModified(root($a))
return <X lastmodified="{$lm}">{$a}</X> sort by (./@lastmodified)