A recent assignment required me to write a set of command-line applications to convert (many) XML documents into various derivatives, some in XML, some in other formats. XProc, especially the recent 3.0 version, seemed to be a perfect fit for this. Being well acquainted with the language, and with Achim’s excellent Morgana XProc processor freely available, I decided to use it for the application’s core.
But would it also be possible to build the application logic in XProc? For example things like command line handling, doing things based on command line options, file and directory handling, etc.? And do this well, in a satisfying way? After some experimentation I came up with two “design patterns” that are probably more widely applicable.
This paper and the accompanying presentation does not contain ready-made solutions. Instead it explores the two “design patterns” that proved useful in writing such an application: job tickets and command-line wrappers. There are some data and code examples for inspiration and to help you on your way, but no definitive, ready-to-run stuff.