[Bug 3173] [F+O, DM] A difficulty with document-uri()

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





------- Comment #3 from mike@saxonica.com  2006-05-09 17:55 -------
We discussed this today. I'll try and explain in a little more detail the
implementation problems I was having, and see if this has any resonances.

I'm currently passing the XQTS tests on document-uri(): to achieve this I
adopted the strategy of scanning the parameters to the query or stylesheet, and
if any of them is a document node, looking at the "system ID" of the document
node, and if it is an absolute URI, adding it to the URI->document mapping
table maintained by the doc() function. The document-uri() function looks in
this mapping table, and returns null if the document node isn't in there. The
"system ID" is derived from the systemId property of the JAXP source object.
One of the problems is that this is overloading the semantics of the JAXP
interface (this property is also used to control the base URI of the document
node, which isn't necessarily the same thing as the document URI). Another
problem is in deciding what to do if two documents have the same system ID (it
could break existing applications to make this an error). 

This approach avoids the problem of a document having multiple URIs. You just
get one of them back, chosen arbitrarily.

I think the main feedback on the specification is that to make this work, I'm
getting the value of document-uri() from available-documents in the dynamic
context, and not from any property of the document node itself (except in the
case of documents that arrive other than through the doc() function).

Perhaps the change we need to the spec is:

(a) in the data model description of the document-uri property, some
acknowledgement that the property must be unique across all the documents used
in a query or transformation

(b) in the description of available-documents in the dynamic context, a
recognition that there is a consistency constraint: if a document D used in the
query or transformation has a document-uri of U, then available-documents must
include a mapping from U to D.

Received on Tuesday, 9 May 2006 17:55:16 UTC