Martin,
Thanks for the hint, looks like a little bug (that has actually been caused by the redefinition of this function). Until this has been fixed, the two following alternatives should do the job:
fn:sort((5, 3, 4, 1))
fn:sort((5, 3, 4, 1), default-collation(), function($e) { $e })
Best, Christian
On Wed, Mar 22, 2017 at 4:24 PM, Martin Honnen martin.honnen@gmx.de wrote:
According to https://www.w3.org/TR/xpath-functions-31/#func-sort the sort function allows one or two or three arguments, however when doing
sort((5, 3, 4, 1), default-collation())
in BaseX 8.6.2 I get an error
java.lang.ArrayIndexOutOfBoundsException: 2 at org.basex.query.func.fn.FnSort.iter(FnSort.java:34) at org.basex.query.QueryContext.iter(QueryContext.java:394) at org.basex.query.scope.MainModule.iter(MainModule.java:117) at org.basex.query.QueryContext.iter(QueryContext.java:330) at org.basex.query.QueryContext.cache(QueryContext.java:609) at org.basex.query.QueryProcessor.cache(QueryProcessor.java:113) at org.basex.core.cmd.AQuery.query(AQuery.java:86) at org.basex.core.cmd.XQuery.run(XQuery.java:22) at org.basex.core.Command.run(Command.java:257) at org.basex.core.Command.execute(Command.java:93) at org.basex.gui.GUI.exec(GUI.java:471) at org.basex.gui.GUI.access$300(GUI.java:44) at org.basex.gui.GUI$6.run(GUI.java:413)
A similar error occurs with
sort((5, 3, 4, 1), ())
Is BaseX 8.6.2 not yet in line with the freshly published spec?
Regards,
Martin Honnen