Unnecessary and non-standard ( file: functions are not XQuery standard, but are EXPath functions).
Use: file:children( file:resolve-path( $folder ) ) If you give file:children an absolute path, that will be included in results, so just resolve the relative folder path first. — Steve M. > On Feb 11, 2022, at 1:40 PM, Hans-Juergen Rennau <hren...@yahoo.de> wrote: > > Dear BaseX people, > > I have a feature request: > > a function which does the same as file:list, but returns the full paths. (In > the explanation, I call it "file:list2") > > Rationale: > (a) It is the full paths what we need in order to parse the files (doc(), > json:doc(), csv:doc(), html:doc()). > (b) The combination of file listing and parsing in a single expression is of > matchless elegance and expressiveness > Just think about how we can extend this into a single > list+parse+navigate+report expression, like: > > file:list2($folder, true(), $fname) ! doc(.) ! //returnCode[. ne > 0]/concat(base-uri(.), ': ', .) > > (Wow! Is there any language or tool competing with this compactness and > readability?) > > Currently, if I don't overlook something, I have to do this: > file:list($dir, false(), $fname) ! concat($dir, '/', .) ! doc(.) => count() > > I emphasize the psychological aspect. Every time I have the pleasure to give > a workshop about XQuery, I show off how elegant it is to parse a whole file > system tree into a forest of nodes in a single expression. And I am always > embarrassed about this clumsy fumbling montage of a path. It's as if Mozart > had fallen asleep while writing his xquery sonata, knocked over the inkwell > and now there is this splash smeared out on the score. You would be my heroes > if you can spare us that. > > Kind regards, > Hans-Jürgen
smime.p7s
Description: S/MIME cryptographic signature