On 15 Dec 2013, at 22:50, Ihe Onwuka <ihe.onwuka@gmail.com> wrote:

This is how to do it.


I would like Saxon to go away instead of barf if it has no input and to be silent rather than insist on outputting something if there is nothing to say because it makes life tough for imperative pipe-oriented shell scripting.

Saxon is constrained by what the XSLT specification says.

I'm not sure exactly what you mean by "if it has no input" - do you mean there is no file specified on the command line, or there is a file specified that doesn't exist, or there is a file that is empty?

By "there is nothing to say" I guess you mean that the result tree is a document node with no children. I'm afraid the specifications are clear as to how that should be serialized (either an XML declaration on its own, or an empty string, depending on the omit-xml-declaration property). Saxon really has no option other than writing this serialization to the output file.

Michael Kay