This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
Consider the following snippet: <xsl:variable name="foo" type="text()"> <xsl:text>text</xsl:text> </xsl:variable> <xsl:value-of select="document("relative.xml", $foo)" /> The specification says: For an item in $uri-sequence that is an instance of xs:string, xs:anyURI, or xs:untypedAtomic, the value is cast to xs:anyURI. If the resulting URI reference is an absolute URI reference then it is used as is. If it is a relative URI reference, then it is resolved against the base URI of $base-node if supplied, or against the base URI from the static context otherwise (this will usually be the base URI of the stylesheet module). A relative URI reference is resolved against a base URI using the rules defined in [RFC3986]. In this case resolving the URI against the base URI of $base-node does not technically make sense - what does it mean to resolve a URI against a URI that doesn't exist? Similarly the node could be passed in from the outside world and have a relative base URI. Resolving against this does not give an absolute URI.
A similar undefined case is: <xsl:variable name="foo" type="text()"> <xsl:text>relative-uri</xsl:text> </xsl:variable> <xsl:value-of select="document($foo)" />
You're right that there are some nodes, for example parentless text nodes, that have no base URI. (In practice, there are whole documents that have no base URI because they are parsed from an anonymous input stream, but I'm not sure the specs acknowledge that case.) We're had the debate about base URIs being relative before, and I don't recall the outcome. We're very casual about using the term "relative URI", but technically, a relative reference is not a URI. (And it's not just us: I see XML Base says "The terms base URI and relative URI are used in this specification as they are defined in [RFC 3986]." - but the term "relative URI" is explicitly discouraged in RFC 3986!). My understanding is that the base URI of a node is always an absolute URI.
You're right about the case of relative URIs - we have code that ensures that any node that touches the query processor does not have a relative base URI. The case of an empty URI is still a problem though.
The Working Group decided that it should indeed be a dynamic error if the second parameter is passed and is a node with no base URI. I don't think we need to say anything here about the base URI being absolute.
This change has been applied to the spec. Oliver, can you close please?
I agree with this fix and am marking the bug CLOSED.