Hi,
I have stambled upon an unexpected issue concerning the value of a variable (in BaseX 10.6), which seems to be affected by an independent function. I have a function like
page:open-url($an1)
which takes a url as a parameter and opens a document. The url usually consists of an invariable part + a final number that identifies different documents. If I only pass the final number of the url, the function, as expected, returns an error (because it tries to resolve a relative path pointing to no document). However, if I change the script into
let $f := page:documents($an1, $an2) return page:open-url($an1)
the function page:open-url($an1) works properly (i.e., the presence of the independent let clause seems to affect the value of the variable $an1): I would not expect this in a functional programming language like XQuery. I have posted a gist here [1], where there are more details (look at the very end of the script)
Ciao, Giuseppe
—— [1] https://gist.github.com/gcelano/31ef1880ac8439398c7f6de1de6d78d3
Hi Giuseppe,
However, if I change the script into
let $f := page:documents($an1, $an2) return page:open-url($an1)
the function page:open-url($an1) works properly (i.e., the presence of the independent let clause seems to affect the value of the variable $an1): I would not expect this in a functional programming language like XQuery. I have posted a gist here [1], where there are more details (look at the very end of the script)
Could you elaborate on what »works properly« means? What output do you get? Which error do you get in the first case?
Could you possibly provide us with a minimal test case, ideally without the RESTXQ facade?
Thanks in advance, Christian
basex-talk@mailman.uni-konstanz.de