RE: document is not an element, is it?

> The document function is defined in "XQuery 1.0: An XML Query 
> Language" as follows: "The fn:document function, when its 
> first argument is a string containing a single URI that 
> refers to an XML document, converts that document to a Data 
> Model representation and returns its document node." So I was 
> (and still am) assuming that the return type of the 
> document() function is of  type 'document' and not 'element', 
> since the document node is not a element node, is it?

Actually the document() function in the current working drafts allows the
URI to contain a fragment identifier, and if it does, the returned value may
be an element node rather than a document node. This is the way document()
is defined in XSLT 1.0.

We've made a recent decision, which (if all goes smoothly) will be reflected
in the next working drafts, to use a simplified version of the document()
function for XQuery. This will not allow fragment identifiers and will not
allow multiple URIs; it will always return either a document node, or
nothing.

Michael Kay

Received on Tuesday, 11 March 2003 16:48:04 UTC