The output is not returned to standard out, it is returned as a result sequence and rendered appropriately by the caller, whether that is the REST Server, Admin Client or your own application.
How are you calling the XQuery will determine your options for getting the result into a file. Also you dont mention whether you mean a file on the filesystem, a file in the database or a file delivered over HTTP?
From: email@example.com on behalf of firstname.lastname@example.org
Sent: Thu 11/30/2006 3:19 AM
Subject: [Exist-open] output to file?
Pardon a very basic question.
It looks like the "return" statement normally returns the output to standard out. How do you direct the output of an XQuery to a file?
Could you provide a simple example?