RE: [xsl] Use document() function to get a reference to the input doc

Subject: RE: [xsl] Use document() function to get a reference to the input doc
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 18 Jul 2006 06:38:15 +0100
> If you're interested in the subtleties you might like to follow the
> discussion at
> 
> http://www.w3.org/Bugs/Public/show_bug.cgi?id=3173 
> 
> which is not yet resolved, but which I think is heading in 
> the direction of
> relaxing the requirement that
> 
> doc(document-uri(D)) is D
> 

As another little twist on this, 

document("", /) 

fetches a document using the base URI of the document node / (not its
document URI). XML Base says "The base URI of a document entity or an
external entity is determined by RFC 2396 rules, namely, that the base URI
is the URI used to retrieve the document entity or external entity." For the
document() function, in a JAXP context, it's unclear whether the base URI of
the returned node should be the (absolutized) URI that was passed to the
URIResolver, or the SystemId of the Source object that was returned by the
URIResolver. RFC 2396 says:

   "Note that if the retrieval was the
   result of a redirected request, the last URI used (i.e., that which
   resulted in the actual retrieval of the document) is the base URI."

and one could interpret this as meaning the SystemId of the returned Source
should be used; on this interpretation there is no guarantee that if this
URI is passed back to the document() function, the same document will be
retrieved. 

To emphasize that this is a practical issue and not just theoretical,
consider what happens when an OASIS catalog resolver is used to redirect the
actual URI used by the application to a local URI held in a catalog. Which
of the two URIs should be used (a) as the base-uri, and (b) as the
document-uri?

Michael Kay
http://www.saxonica.com/

Current Thread