Hi all,
I have a query that makes use of the UCA collation with the "numeric" keyword [1] (e.g., for ensuring that "d2" sorts before "d12"), and I'm seeking a way to confirm that the icu4j library is available on the BaseX classpath before I run queries that depend on it. [2]
Even though I manually install the icu4j library into Basex's lib/custom directory as specified in [3], I have sometimes forgotten to do so when, for example, Homebrew upgraded BaseX, and as a result my query relying on this collation began producing unexpected results. I've tried to make use of the XQuery 4 fn:collation-available function [4], but so far I've been unsuccessful.
Specifically, using BaseX 11.9 or 12 with icu4j-77.1.jar on macOS 15.5 (on Apple Silicon), the following expression returns the expected result:
```
```
The result, as expected, is ("d12", "d2"), when the library is present and the opposite when it is absent.
But the following version, which introduces a conditional and the fn:collation-available function, always takes the "else" path:
```
```
I expected this expression to return ("d12", "d2") but instead received "UCA collation not present".
Am I misusing/misunderstanding how to use fn:collation-available?
Thanks!
Joe