I got "Document must not contain null namespace" error?

Well yeah. GENE is based on namespaces - it builds transformation graph and chooses exporters based on the information provided by namespaces. So, if document contains at least one element with null namespace then GENE cannot decide what to do with such element.

To get rid of the problem just declare a correct namespace for the document. For example, for namespaceless DocBook XML just add xmlns="http://docbook.org/ns/docbook" attribute to root element.

Why my XSLT receives/produces something totally unexpected?

Chances are that Saxon 6.5.x got registered as the default transformer provider. For example, using the gene-docbook plugin uses Saxon to transform docbook because Xalan is not able to process Norman Walsh's stylesheets.

There is known bug #548228 in Saxon. In short, when you pass a DocumentFragment instance in a DOMSource to Saxon, the transformer completely ignores the source node and processes DOMSource.getNode.getOwnerDocument() instead. Because GENE makes extensive use of DocumentFragments, this is most likely to happen.

A similar bug is present in Xalan that comes bundled with J2SE 5.0 aswell - instead of processing the fragment contents it simply processes an empty document (document with no nodes). So don't even think to create factory like TransformerFactory factory = new com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl(); unless you plan to use SAX source purely.

There are some ways how to circumvent this error:

  • Tell GENE that the exporter/coordinator to accept SAX sources only - just modify ExporterInfo/CoordinatorInfo retured by your exporter/coordinator.
  • Clone the fragment and put it in a new document.
  • Instantiate the TransformerFactory directly, for example: TransformerFactory factory = new org.apache.xalan.processor.TransformerFactoryImpl(); - this will use Xalan's factory directly. I didn't tested it with Xalan 2.7.0 though, but it might just work.