Hi Yitzhak,
 
thank you for reporting this. This is my fault, this change is causing it:
 
    https://github.com/BaseXdb/basex/commit/83acbb74f9419d50a4c03c5793647d449b5577c1
 
It was made to fix the behavior of duplicating the last part of the path. E.g. this query
 
    base-uri(doc('https://www.w3.org/TR/xml/'))
 
up to 11.7 used to return
 
    https://www.w3.org/TR/xml/xml
 
which is clearly wrong, and the above mentioned change fixes it to correctly return
 
    https://www.w3.org/TR/xml/
 
But as you noticed it obviously affects documents retrieved by fn:collection, and that slippped through our tests. Note that it does not affect documents retrieved by fn:doc, so in your case
 
    document-uri(doc("E:\Temp\Identity Transformation88\Input.xml"))
 
should still return the correct file URI.
 
Apologies for the oversight - I’ll investigate further.
 
Best regards,
Gunther
Gesendet: Freitag, 21. März 2025 um 15:36
Von: ykhabins@bellsouth.net
An: basex-talk@mailman.uni-konstanz.de
Betreff: [basex-talk] document-uri() and base-uri() functions in BaseX 11.8
Hello,

Congrats on the BaseX 11.8 release.

Was there a change in BaseX 11.8 to the document-uri() and base-uri()
functions behavior?
It seems that they are striping out a file name at the end of the fully
qualified file path on the file system!

Please find below a repro of it.

BaseX 11.7
==========
declare variable $base_dir as xs:string := 'e:\Temp\Identity
Transformation88\';

for $x at $i in collection($base_dir)
let $file := tokenize(document-uri($x), '/')[last()]
return (document-uri($x), $file)

Emits the following as expected:
file:///E:/Temp/Identity%20Transformation88/Input.xml
Input.xml
file:///E:/Temp/Identity%20Transformation88/Output.xml
Output.xml


BaseX 11.8
==========
The same XQuery emits the following:
file:///E:/Temp/Identity%20Transformation88/
file:///E:/Temp/Identity%20Transformation88/



Regards,
Yitzhak Khabinsky