so

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"
                xmlns:p="http://www.w3.org/ns/xproc"
                xmlns:cx="http://xmlcalabash.com/ns/extensions"
                name="main">
  <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:declare-step>

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

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

</p:declare-step>

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.

Please provide your name and email address. Your email address will not be displayed and I won’t spam you, I promise. Your name and a link to your web address, if you provide one, will be displayed.

Your name:

Your email:

Homepage:

Do you comprehend the words on this page? (Please demonstrate that you aren't a mindless, screen-scraping robot.)

What is seven minus six?  (e.g. six plus two is 8)

Enter your comment in the box below. You may style your comment with the CommonMark flavor of Markdown.

All comments are moderated. I don’t promise to preserve all of your formatting and I reserve the right to remove comments for any reason.