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)?


There is an answer to this question back in the Java API forum:

An even better answer to this is here: