I have an XQuery that I want to run on the command-line.  It is in the form of a function call with the argument set to a global variable:


declare function myfunc($in as element(inType)) as element(outType)  {….}

declare variable $in as element(inType) external;



In order to run this XQuery, the variable $in has to be set.  It should be set to the root node in the input XML file, but I haven’t been able to figure out the right syntax to do this.


I am able to set global variables to untyped values, like:


java –cp saxon.jar net.sf.saxon.Query transform.xq param=value


But how do I pass in a document node for “param”?  I have tried using {doc(‘in.xml’}/in} (where in.xml is the input file, and in is the root node), but this expression gets passed in as a string.


What’s the right way to do this?  Is it even possible on the command-line?





This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited.