XProc at work

Volume 10, Issue 49; 15 May 2007; last modified 08 Oct 2010

Baby steps beyond trivial examples and unit tests. (Look, ma, no make!)

I just finished my paper for XML Prague 2007 where I'll be speaking about XProc.I'm also speaking about DocBook on Sunday, though I'll be honest and admit I haven't actually figured out exactly what I'm going to talk about. If you're planning to attend and you have suggestions, I'm all ears.

I've been using Makefiles for years to build papers and presentations for conferences, but it would be wrong to use make to format a paper about XProc, right? Well, wrong for me, now, for this paper anyway, right? Right!

So with this library, constructed for an example in the paper:

<p:pipeline-library xmlns:p="http://www.w3.org/2007/03/xproc"

<p:pipeline name="docbook-to-html">
  <p:input port="source"/>
  <p:output port="result"/>


    <p:input port="schema">
      <p:document href="/home/ndw/docbook.org/xml/5.0CR3/rng/docbook.rng"/>

    <p:input port="stylesheet">
      <p:document href="/sourceforge/docbook/xsl2/base/html/docbook.xsl"/>


This pipeline was solely responsible for formatting my paper:

<p:pipeline xmlns:p="http://www.w3.org/2007/03/xproc"
<p:input port="source">
  <p:document href="xproc.xml"/>

<p:import href="library.xml"/>


<p:store name="store">
  <p:option name="href" value="xproc.html"/>

<px:tidy name="tidy">
  <p:option name="href" select="/*/@href">
    <p:pipe step="store" port="result"/>


For formatting my personal drafts, anyway. I don't know what the conference organizers are going to use for the proceedings. Probably not XProc. At least not this year.

Thus, my implementation has performed its first “real application”. And it only required fixing two bugs! Woo hoo!


Screen shots of command-line tools are rather dull, but I don't have a GUI for my XProc implementation. If I get adventerous about trying out one of the GUI building toolkits, I might put together something simple, but it's not very likely.

Dull or not, there might be some interest, so here it is:

      xproc pipeline.xml
Info: Running <<p:pipeline>>
Info: Running <<{http://nwalsh.com/xproc/pipelines}docbook-to-html>>
Info: Running <<p:xinclude>>
Info: Running <<p:validate-relax-ng>>
Info: Running <<p:xslt2>>
Info: Running <<{http://xproc.org/2007/03/xproc/ex}tidy "tidy">>
Info: Running: /usr/bin/tidy -q --doctype loose -utf8 -mn -asxhtml xproc.html

All the output (and debugging) messages need work.


Great! I'm very excited to try your implementation when it's ready.

—Posted by Dustin Whitney on 15 May 2007 @ 07:31 UTC #

Three cheers for the first practical and useful example. Can't wait for the release!

One usability question, is the output configurable (i.e. via log4j or similar)?

—Posted by Chris Scott on 16 May 2007 @ 05:09 UTC #

I found the format of the java.util.logging messages sort of suboptimal so I've done it a slightly different way, but I did retain the "logger", "level", "message" triple and I'll definitely provide an option that uses the logger instead of System.out.println :-)

—Posted by Norman Walsh on 16 May 2007 @ 05:32 UTC #