This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 5688 - [FO] doc(), doc-available(), and invalid URIs
Summary: [FO] doc(), doc-available(), and invalid URIs
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Functions and Operators 1.0 (show other bugs)
Version: Recommendation
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: Michael Kay
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-05-14 11:03 UTC by Michael Kay
Modified: 2008-06-04 11:16 UTC (History)
0 users

See Also:


Attachments

Description Michael Kay 2008-05-14 11:03:04 UTC
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
Comment 1 Michael Kay 2008-06-04 10:51:48 UTC
The WG considered this bug at its meeting on 20 May 2008. The resolution was as follows:

(a) doc-available() should return FALSE if the argument is an empty sequence.

(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". Accepted as an editorial change.

(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: Resolved to change "MUST" to "MAY" allowing flexbility of interpreting xs:anyURI differently in different environments and platforms.

Erratum E26 will be raised to reflect these decisions.