I want to do a join operation over MULTIPLE XML documents and also another over MULTIPLE DocumentInfo structure.
It's possible to do this ?
Yes, of course it's possible to access multiple documents in XSLT and join their contents.
General XSLT coding questions (that are not specific to the Saxon implementation) are best sent to the xsl-list at www.mulberrytech.com. Please be a little more specific in your question - explain what is in your input documents and what output you want.
thanks for your answer.
I'm developing a query execution engine for a mediator system. So, I have to develop some algorithms for typic operators (select, join ...) in order to evaluate the query plan. The first step in the plan evaluation is some calls to wrappers who access some Web sites and return xml documents. So, for example, if I have 4 wrappers A, B, C, and D that return xA, xB, xC and xD xml files respectively, the join between xA and xB (and the join between xC and xD) can be done directly over the xml Documents (xA and xB. and xC and xD)
the first question here is: Saxon's "using-xquery.html" doc page indicates that one could "build one or more trees representing XML documents" as input to a query. In the java code, where I must build the 2 trees ?? with 1 document the tree is built as:
DocumentInfo di = config.buildDocument(new StreamSource("data/books.xml"));
DynamicQueryContext dqc = new DynamicQueryContext(config);
DOMResult domResult1 = new DOMResult();
xqe.run(dqc, domResult1 , new Properties());
I want to do something like this, but with the two xml documents (xA and xB) (and the same thing with xC and xD), and later do a join with domResult1 and domResult2.
how can I do the join with xml files?, and with DOMResult?
thanks and sorry for my English
You can either build the trees in the Java app outside the query and pass them as parameters to the query, or you can access them from withing the query using the doc() function. The first approach sounds more suitable in your case. In the query prolog write:
declare variable $d1 as document-node() external;
declare variable $d2 as document-node() external;
and from the Java do
Don't use DOM with Saxon unless you have a very good reason - it's grossly inefficient. Instead, capture the query result as a tree in Saxon's native format. The simplest way to do that is, instead of using the xqe.run() method, use xqe.iterator() - the next() method on the iterator will return a NodeInfo representing the result of the query, assuming it constructs a single tree.