[xquery-talk] What does [.] do.
g at 28.io
Mon Jan 27 05:59:04 PST 2014
You are right that it is a filter expression.
However, I think [.] is not very common in "real world" code, except maybe for very precise use cases (like filtering out empty strings, etc). Usually you would put either a position or a boolean predicate inside a filter expression -- not just a context item expression.
What [.] does, if I am not missing anything, is that it only keeps:
1. Numerics equal to their position in the left-hand-side sequence
2. Non-numerics that have an Effective Boolean Value of true, like non-empty strings, nodes, the true boolean, etc.
(1, 2, 4, 3, 5, "", "foo", <a/>, true, false)[.]
1 (position matches)
2 (position matches)
5 (position matches)
foo (EBV = true)
<a/> (EBV = true)
true (EBV = true)
I hope it helps.
Dr. Ghislain Fourny
On 27 Jan 2014, at 12:46, Ihe Onwuka <ihe.onwuka at gmail.com> wrote:
> As in ('','8')[.]
> What is it called and where is it documented
> talk at x-query.com
More information about the talk