I observed a slightly surprising behaviour of function 'fn:document-uri' (and it is the same for 'fn:base-uri'):
a) when the document in question has been retrieved with a file name as URI (e.g.: doc("c:/a/b/c")), then fn:document-uri echoes that file path, rather than returning a URI with scheme file://
b) when the document in question has been retrieved with a file URI using one or three slashes after 'file:', then fn:document-uri returns a file URI with one slash
c) when two documents are retrieved, one using the file name, the other using the equivalent file URI, two separate document nodes are delivered.
So I wonder if
a) the URI normalization should not have three slashes, rather than one (that is: file:///c:a/b/c)
(at least according to http://en.wikipedia.org/wiki/File_URI_scheme )
b) if fn:document-uri should not always return a URI, rather than a file name
c) if the implementation of fn:doc should not recognize the equivalence of a file name and the corresponding file URI, and therefore deliver the same document node in both cases
The interest behind the questions is to what extend values returned by fn:document-uri can be treated as normalized representations of document identity.
With kind regards,
-- Hans-Juergen
   let $doc1 := doc("c:/user/xworks/ml/xml/doc.xml")
   let $doc2 := doc("file:/c:/user/xworks/ml/xml/doc.xml")
   let $doc3 := doc("file:///c:/user/xworks/ml/xml/doc.xml")
   return (