[Bug 3486] [XQuery] relative base URI

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

           Summary: [XQuery]  relative base URI
           Product: XPath / XQuery / XSLT
           Version: Candidate Recommendation
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XQuery
        AssignedTo: chamberl@almaden.ibm.com
        ReportedBy: davidc@nag.co.uk
         QAContact: public-qt-comments@w3.org


XQuery defines the term "Base URI" to be an absolute URI both in the definition
of the ststic context

http://www.w3.org/TR/xquery/#dt-base-uri

and in the glossary

http://www.w3.org/TR/xquery/#GLdt-base-uri

However no error condition or code is described if a non-absolute URI is given
as the URILiteral in a Base URI Declaration.

Several other parts of XQuery appear to assume that the base URI is absolute
eg the doc() function

http://www.w3.org/TR/xpath-functions/#func-doc

says ... it is resolved relative to the value of the base URI property from the
static context. The resulting absolute URI ...

In the analogous situation in XSLT which uses xml:base to specify a non-default
base URI, it is legal to specify a relative URI but it's resolved against the
existing (absolute) URI to ensure that the base URI in the static context is
always absolute (or an error is raised if an absolute URI can not be
determined)

This affects several XQuery Test Suite tests, including at least base-URI-11
12,13,15,17,18,19,20,21,23,24.

-11 for example expects fn:static-base-uri() to return the relative URI
"abc123"
yet fn:static-base-uri is defined to return a Base URI, and Base URI are
defined to be absolute.


I would propose that XQuery follow XSLT here and allow the declaration to
specify a relative URI but ensure that the base URI in the static context is
always absolute.  (Apart from anything else, the definition of the resolution
of  relative URI against a base URI is as far as I can see not defined
anywhere, the URI RFCs only define the case of an absolute base.)

This would mean that the output of base-URI-11.xq as currently written would be
highly system dependent.

the output would be the string
..../abc123
where .... is the initial base URI of the Query text (which may typically be a
file::// URI reflecting the location of the query on the filesystem)

David

Received on Wednesday, 19 July 2006 15:51:45 UTC