It’s getting real!

Volume 2, Issue 25; 23 Oct 2018

Something completely different. And a few words on the steady progress towards XProc 3.0.

Let me begin with a few words about progress on the XProc specification: there’s been quite a bit! The editorial team and our stalwart band of supporters have been meeting regularly. The current plan is to have a “last call” draft of the core specification ready in time for XML Prague (February, 2019) and a last call draft of the standard step library ready in time for MarkupUK (June, 2019). Ideally, we can address last call comments on the core specification in June, last call comments on the steps in the Septemberish time frame, and put a bow on it all before the end of the year.

On the implementation front, Achim and I have both been making good progress. We have a test suite and are working our way through the specification. (Contributions to the test suite would be most welcome, just in case you’re wondering.) At the moment, my implementation passes just a little over half the test suite. (Take that figure with a grain of salt, the test suite is far from complete and the number of tests that I pass varies widely from day to day.)

I plan to write a few posts about my implementation, but let me just leave this here for now. This is a completely valid and working pipeline:

<p:declare-step version="3.0"
  <p:output port="result"/>

  <p:declare-step type="cx:javascript">
    <p:input port="script"/>
    <p:output port="result"/>
    <p:option name="parameters" as="map(*)"/>

  <p:variable name="data" select="map { 'name': 'Norman',
                                        'born': 1967 }"/>

  <cx:javascript parameters="$data">
      <p:inline content-type="text/plain" expand-text="false">
        var foo = "Hello";
        var obj = { "greeting": foo + ",  " + name,
                    "age": 2018 - born }


It produces:

{ "greeting": "Hello, Norman",
  "age": 51 }

The JavaScript extension step is a total cheek (it’s just a wrapper around Rhino) but I thought it would make an eye catching example.

It is meant to show that you can load arbitrary documents and process them more-or-less arbitrarily. In this case, the $data map gets passed to the step. The step produces a map which is serialized as JSON.

If anyone has ideas for a useful library of JSON-related or binary-related steps, I’d be curious to hear them.