Dear BaseX team,

perhaps you have a recommendation concerning the use of the file module.

The issue at hand is this. The function file:list (like any function in the 
file module, per EXPath specification) resolves relative paths against the 
current working directory. But the fn:doc function, on the other hand, resolves 
(per default) relative URIs against the static base URI of the containing 
XQuery module. 

If an application receives relative directories as external parameters and then 
obtains file names via file:list - how can one access the listed files, not 
knowing what the current working is, thus not knowing how to resolve those 
relative paths? As far as I can see, neither XQuery nor the file module offer a 
way how to learn the current working directory.

One way out would be this pattern: avoid passing to file:list relative paths as 
supplied from without; but pass to the function always the result of resolving 
any relative paths against the static base URI of the tool. And, of course, 
specify your application to resolve relative paths against the tool URI, rather 
than against the working directory.

It is a bit awkward to ask the user to specify relative paths against the tool 
location, but the only alternative which I now see would be to ask the user to 
supply the working directory explicitly.

But perhaps I overlook something? Do you have a better solution to the general 
problem?

Kind regards,
Hans-Juergen

_______________________________________________
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk

Reply via email to