use Xquery or XSLT?

I have extremely large (over 300 MB) XML file and tens of thousands of small xml files generated after applying various XSLT on the one big XML file.

Is Xquery or XSLT is better solution for this problem?
Query each text node in the big xml file and verify that this content is present in one of the results xml files. Based on this information generate a report that shows which content is present and in which file and in a separate section which content was not found in result xml files and also show this content parent element or other markup to indicate its position in the big xml file.

All the small xml files are stored as flat files in various directories on Windows File system although most files are in one directory.

Any comments or suggestions?
Thank you

Hi Alan,

generally, XSLT is better for solving problems where an XML
document is processed completely and the outcome is more or
less the whole document in a redesigned manner.
XQuery is rather meant to pick selected data items from a
file and present these in a form that does not have anything
to do with the original arrangement.

From a first glance your problem seems to require two passes
anyway. In a first pass, select all the big XML’s text nodes
that are represented in a small file also and output these.
A second pass selects the non-represented ones.

Have you considered using first XQuery and lateron XSLT ?
XQuery can easily fetch all information in an appropriate
sequence of result-nodes:

position description

XSLT might use this information to print a nice report.
The precondition for all things using position descriptors
is that the files do not change between the passes.

With version 4.2 Tamino offers a technique to do this via
using the XSLT.transform output handler. So Tamino deals with
XQuery and a subsequent step uses an XSLT stylesheet for

If you prefer using only one technology either will do. In
XQuery you must use two seperate for statements for running
through the texts, one for fetching the found-texts and one
fetching the non-found ones. In XSLT you probably need two
apply-templates in the template looping through text-nodes.