[xquery-talk] when to use document { }?

Martin Probst martin at x-hive.com
Tue Jul 26 10:49:13 PDT 2005


> What is the document constructor doing in this case? The query would
> generate perfectly good xhtml without it, would it not?
> What's the difference between the two cases?

I think that does largely depend on the way your serializer works, or if
it is even used. E.g. in X-Hive you usually get the results of a query
as an iterator (ahem, sequence :-)) of values. If you wrap your query
into a document constructor, then the outermost value will be something
that implements the org.w3c.dom.Document (and the XhiveDocumentIf)
interface. That can be helpful in some cases.
Still, if you serialize the results using toString() you would see no
difference between the queries.


More information about the talk mailing list