Various changes that help shifting the control flow towards Java

I try to limit the use of XProc to what it's good at, namely chaining together XML processing steps. In order to make the system more powerful, as much as possible of the control flow needs to be implemented in Java.

<!---
@huboard:{"order":5.0,"milestone_order":1,"custom_state":""}
-->