Dear Edward,
the correct syntax is:
(2 to 100)[position() = 5 to 20]
(sequence)[5] is only a shorthand for (sequence*)[position() eq 5] wher 'eq' compares two _single_ items for equality.
With [positon() = 5 to 20] we perform a general comparison, such that the predicate evaluates to true if comparison of any of the items inside both sequences evaluates to true. Thus position() = (5,6,7,…,20) evaluates to true if position() is between 5 and 20, while position() eq (5 to 20) throws an error, as eq is not allowed to compare single items with sequences.
Hope this helped clear things up a little, s/o please correct me if my explanation was faulty :-)
Thanks Michael Am 05.11.2011 um 03:54 schrieb 方立厅:
Hi, I'm using BaseX first time. and using 7.0.1. about 5000 org.xml was loaded into the db in my test enviroment.
But I got an error msg instead of the result i want when I was excuting an simple xquery '(/org)[1 to 5]' in GUI: Query: (/org)[1 to 5] Error: [FORG0006] (1 to 5) not allowed as condition type.
The xquery '(/org)[position() > 2 and position() < 5]' excuted very well.
Thanks, Edward
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk