Generating sequence number for enumeration

Hi,

I have a Xquery for Tamino 4.2.1 that should generate a list of items like


foo
bar
bar



My problem is the enumeration in the no attribute that
I need to generate with the Xquery. I tried something like
"for $i at $d in" which works with saxon but not with Tamino.
My next try was like

let $d:= input()//item
for $i in 1 to count($d)

But Tamino appears to have no support for range operator “to” as well. I also had no success playing with the position() function.

Can anybody enlighten me how to solve this?

Thanks very much,

Ben

Hi,

I?m afraid that there is no general way in Tamino to express your query. Assuming that your input sequence can be sorted by value and does not contain any duplicates a work around is possible that looks like this:

let $d:= input()//item sort by(.)
for $i in $d
let $p := count($d[. <= $i])
return {data($i)}

Best regards,

Thorsten Fiebig

Hi Thorsten,

I have suspected something like that ;-), but your solution works with my kind of data!

Thanks a lot,

Ben