While working on an XProc implementation, and especially after using XProc in real-life and seeing its true power, I am more and more confident that XProc will soon become one of the most popular (and useful) XML technologies out here. For me, the reasons are simple:
- XProc integrates a whole plethora of XML technologies, ranging from XPath, XSL and XSLT, to XInclude processing, schema validation and XQuery support. The good thing about XProc is that you don’t have to learn the details of the different programming APIs and models. XProc shields you from that. To me, this is the most significant benefit of using XProc – and in fact, it is the very reason why XProc exists after all. Make manipulating XML content simple, transparent, and easy to understand.
- XProc can make application development simpler, and faster. No more tedious XML programming (I guess we all know that
how many times did I write this code before?feeling…), no more low-level dances around constructing/navigating/updating the DOM tree. Not any more: Here, this my XProc pipeline, run it and give me the results I want.
- XProc can make applications more reliable and less buggy (once the XProc processor get good enough, of course :). This is related to the previous point. You see, manual XML programming is potentially dangerous, especially in the hands of unexperienced developers who are not aware of all the nifty details. I have seen too many examples of badly written code for performing an XSLT transformation, or for just parsing an XML document… And I am really glad that finally there is a tool that, to put it bluntly, can shield us from crappy programming. And once there are visual tools for building XProc pipelines – and I am sure there will be some soon – we will be even safer.
- XProc is simple. Querying content using XQuery, transforming the results to XSL-FO, and generating a final PDF document has never been easier:
<p:declare-step> <p:input port="source"/> <p:input port="parameters" kind="parameter"/> <p:xquery> <p:input port="query"> <p:data href="stats.xq" content-type="application/xquery"/> </p:input> </p:xquery> <p:xslt> <p:input port="stylesheet"> <p:document href="stats2fo.xsl"/> </p:input> </p:xslt> <p:xsl-formatter href="out/stats.pdf"/> </p:declare-step>
- XProc is extensible. XProc comes with a library of standard steps, but one of the core features of the language is that it allows you to declare custom steps that provide more complex (or not supported by default) functionality. You can organize your custom steps in libraries, which you can then import in your XProc pipelines in a way similar to importing stylesheets in XSLT.
<p:pipeline> <p:import href="sq-library.xpl"/> ... <sq:get-stock-quote ticker="GOOG" xmlns:sq="http://www.foo.com/sq/ns/"/> ... </p:pipeline>
- …and finally, XProc is fun!