Hi Christian,

Thanks for the very quick response!
Your example is definitely a step forward (I now see how I can export the results to a CSV file directly from the XQuery).

My followup question is therefore - Is there a way I can run a batch command (e.g: Make_CSV.exe input.xml output.csv) where the XQuery would run taking as commands the input file name, output file name, and run?

Thanks,
Noam

On Tue, May 26, 2015 at 10:17 PM, Christian Grün <christian.gruen@gmail.com> wrote:
Dear Noam,

Welcome to the list. I guess the answer on your question mainly
depends on what you have done so far, so feel free to give us some
more information (e.g. the XQuery expression you wrote).

The following XQuery expression reads two XML documents, navigates to
a certain path, serializes the resulting nodes as CSV and writes the
result to a file:

  for $doc in ('one.xml', 'two.xml')
  let $result := doc($doc)/any/path
  let $csv := csv:serialize($result)
  return file:write-text($doc || '.csv', $csv)

All the best,
Christian (Grün)



On Tue, May 26, 2015 at 8:59 PM, Noam Green <green.noam@gmail.com> wrote:
> Hi,
>
> I'm new to BaseX, so apologize if this is a repetitive question.
> I have created an XQuery which currently runs on a specific XML file.
> What I'd like to do is to be able to create a batch command, which would
> receive as input a different XML source file, run the XQuery command, and
> save the results in a CSV file.
>
> Is there a way to do such a process?
>
> Thanks,
> Noam