Hi all,
I am now using functions as argument in BaseX for the first time, borrowing the way to do that from some old list archive contribution. Apparently you have to use the name of the function followed by #1 like this:
let $a := local:someFunc($nodeSet, local:someOtherFunc#1)
But it is unclear to me if this is indeed the right way to do it. The #1 suggests that there may also be a #2, #3 etc. (and possibly a #0). I could not find the documentation on using functions as argument on the Wiki pages. (I am happy to see that it works as expected though)
Paul
Hi Paul,
Apparently you have to use the name of the function followed by #1 like this:
let $a := local:someFunc($nodeSet, local:someOtherFunc#1)
But it is unclear to me if this is indeed the right way to do it.
This is called a named function reference. The digit represents the number of arguments of your function.
I could not find the documentation on using functions as argument on the Wiki pages.
This is true. Would anyone out there be interested in extending our Higher Order Functions article [1]?
Here are two external references that may be of interest for you, though:
* The slides of our XML Technologies course (No 4: "XQuery: More than Just a Query Language", Page 12) [2] * Priscilla Walmsley’s new book on XQuery [3]
Hope this helps, Christian
[1] http://docs.basex.org/wiki/Higher-Order_Functions [2] http://phobos103.inf.uni-konstanz.de/xml15/ [3] https://books.google.de/books?id=wZ0bCwAAQBAJ&pg=PA360&dq=%22The+ari..."
Thanks Christian. Now it makes sense.
Quite interesting, that "XQuery: More than Just a Query Language" presentation.
Paul
Hi Paul,
Apparently you have to use the name of the function followed by #1 like this:
let $a := local:someFunc($nodeSet, local:someOtherFunc#1)
But it is unclear to me if this is indeed the right way to do it.
This is called a named function reference. The digit represents the number of arguments of your function.
I could not find the documentation on using functions as argument on the Wiki pages.
This is true. Would anyone out there be interested in extending our Higher Order Functions article [1]?
Here are two external references that may be of interest for you, though:
- The slides of our XML Technologies course (No 4: "XQuery: More than
Just a Query Language", Page 12) [2]
- Priscilla Walmsley’s new book on XQuery [3]
Hope this helps, Christian
[1] http://docs.basex.org/wiki/Higher-Order_Functions [2] http://phobos103.inf.uni-konstanz.de/xml15/ [3] https://books.google.de/books?id=wZ0bCwAAQBAJ&pg=PA360&dq=%22The+ari..."
basex-talk@mailman.uni-konstanz.de