Hello,
 
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
 
PS:
Query:
<result>{
   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 (
      <duri1>{document-uri($doc1)}</duri1>,
      <duri2>{document-uri($doc2)}</duri2>,
      <duri3>{document-uri($doc3)}</duri3>,
      <count12>{count(($doc1,$doc2)/.)}</count12>,
      <count23>{count(($doc2,$doc3)/.)}</count23>
   )
}</result>
 
Returns:
<result>
   <duri1>c:/user/xworks/ml/xml/doc.xml</duri1>
   <duri2>file:/c:/user/xworks/ml/xml/doc.xml</duri2>
   <duri3>file:/c:/user/xworks/ml/xml/doc.xml</duri3>
   <count12>2</count12>
   <count23>1</count23>
</result>