Dynamic value for collation in FLWOR?
Friday, 5 October 2018 · 2 messages
AM
Andreas Mixich5 Oct 2018 22:46 #
Hi,
this:
for $i in $item
let $lang := concat("?lang=", $item/@xml:lang/string())
order by $i collation $lang
return $idoes not work: "[XPST0003] Expecting quote, found '$'."
Any way to do this dynamically?
Wouldn't
order by $i collation $item/@xml:lang/string()
make sense?
--
Goody Bye, Minden jót, Mit freundlichen Grüßen,
Andreas Mixich
CG
Christian Grün5 Oct 2018 23:01 #
Hi Andreas,
the
fn:sort function [1] allows you to specify a dynamic collation string. Note, however, that you can only specify one collation string per sort operation, just as you cannot change any other sort property (such as e.g. the sort order) in a single sort.
Best,
Christian
[1] http://docs.basex.org/wiki/XQuery_3.1#fn:sort
Andreas Mixich <mixich.andreas at gmail.com> schrieb am Fr., 5. Okt. 2018, 22:46:Quoted text · Andreas Mixich · 23 lines
> Hi, > > this: > > for $i in $item > let $lang := concat("?lang=", $item/@xml:lang/string()) > order by $i collation $lang > return $i > > does not work: "[XPST0003] Expecting quote, found '$'." > Any way to do this dynamically? > > Wouldn't > > order by $i collation $item/@xml:lang/string() > > make sense? > > -- > Goody Bye, Minden jót, Mit freundlichen Grüßen, > Andreas Mixich > >
Written for BaseX 9.0. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery