There are three main ways of supplying an input file to a query:


(a)     as the context item. (-s on the command line.) This allows one input only

(b)     as the value of an external variable. This allows any number. Declare the variables in the query using “declare variable $input1 external;” and supply the value from Java using setParameter() in the dynamic context.

(c)     Using the doc() function. This is the simplest approach when the files are in filestore as the calling application doesn’t need to get involved, the query just accesses the file using doc(file:///input1.xml)


Michael Kay




From: [] On Behalf Of shreyas
Sent: 15 April 2006 18:47
Subject: [saxon] xquery taking two xml files as inputs



I have a question regarding giving 2 xml docs as input to the saxon xquery engine?

How do you write to code (in java) to give two xml files as input to an xquery and how should the 2 files be accessed in the xquery?