Then, *please* let us have this instead: file:list2($dir, false(), $fname) ! doc(.)
This is what I would write and recommend:
file:descendants($dir)[file:name(.) = $fname] ! doc(.)
Excellent, I had overlooked this possibility, however - currently file:children and file:descendants (which are not part of the EXPath standard) do not support a file name pattern, nor do they support the deep flag.
The two functions are candidates for the next version of the EXPath spec. The deep flag is not required, as we have two functions for that. In hindsight, I would have discarded file:list, as the standard XQuery strings functions are much more flexible and powerful, and as the "glob syntax" is used in no other module.