limit in xquery


I need to implement an XQuery which will return a subset of the whole data. in sql it would look like:

select * from table LIMIT 5;

how can this be done via XQuery (or the Java API)?


Hello Brian,
I do not know the LIMIT expression.
Maybe you mean not getting the complete
result sequence of a query but only a defined
number of items. This can be achieved by a cursor. In the Java API this is done
by an XQuery method with an additional

TResponse xquery(TXQuery xquery,int quantity)

or by appending the following filter to a query

(for $i in input()/ADoctype
return $i
[position() > 10 and position() < 20 ]

Is that what you mean?


Hi Walter

Thanks for the info. That seems to help a lot. I am facing a further problem now when trying to sort the data. I am trying to run the following query, but tamino seems to crash when trying to run it. what is the prob?

declare namespace tf=“

for $l in input()/schedule/locality/locality_name
where $l/…/…/island = ‘island’
and (
tf:containsText($l, “")
or tf:containsText($l, "
or tf:containsText($l, tf:phonetic(“k”))


{ $l/…/pre/name }

sort by (locality)
) [position() >= 1 and position() < 11 ]