[Bug 5688] doc(), doc-available(), and invalid URIs

http://www.w3.org/Bugs/Public/show_bug.cgi?id=5688

           Summary: doc(), doc-available(), and invalid URIs
           Product: XPath / XQuery / XSLT
           Version: Recommendation
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Functions and Operators
        AssignedTo: mike@saxonica.com
        ReportedBy: mike@saxonica.com
         QAContact: public-qt-comments@w3.org


The summary of both doc() and doc-available() states:

If $uri is not a valid xs:anyURI, an error is raised [err:FODC0005].

(a) The function signature allows the argument to be an empty sequence. A
literal reading suggests that if an empty sequence is supplied, the function
should raise FODC0005, because the empty sequence is not a valid xs:anyURI. 

For doc(), the spec goes on to clarify this by saying that if $uri is (), the
function returns (). But there is no corresponding statement for
doc-available(). I find it hard to believe that an error was intended; it seems
to me that the expectation is to return false in this case.

There are other problems with the sentence. 

(b) The argument $uri is of type xs:string, so it can never be a valid
xs:anyURI; the intent I think is "if $uri is not castable to xs:anyURI".

(c) The rules for the value space of xs:anyURI are notoriously fuzzy, and many
implementations exploit this by allowing things that are not strictly URIs, for
example Windows file names or jar: scheme URLs. XML Schema 1.1 recognizes this
by making the value space of xs:anyURI the same as xs:string. I think we should
acknowledge reality by removing the implicit "MUST" requirement to detect
invalid URIs.

(d) In any case, it's not clear that the user is well-served by having
doc-available() throw an error - though that observation in itself does not
justify an erratum.

Arose from consideration of test K2-SeqDocAvailableFunc-1

Received on Wednesday, 14 May 2008 11:03:38 UTC