W3C home > Mailing lists > Public > xproc-dev@w3.org > May 2009

Re: xproc as an alternative to Apache ant

From: James Sulak <jsulak@gmail.com>
Date: Mon, 25 May 2009 11:07:53 -0500
Message-ID: <7cb78b3b0905250907r4e7297ft2e993188e209779f@mail.gmail.com>
To: Dave Pawson <dave.pawson@gmail.com>
Cc: xproc-dev@w3.org
I like what Vojtech suggested (using an external c:param-set
document).  No need to reinvent the wheel like I did.  But the problem
remains of how to assign them to variables so you can access them in
non-xslt steps.  You can explicitly assign them, like Vojtech said,
using the p:parameters step:

<p:variable name="output_folder"
   <p:pipe port="parameters" step="pipeline"/>

But that gets clunky fast if you have a lot of options you want to assign.

The proposed exproc config schema suggests the following:

  <pxpc:with-option name="output_folder" value="/home/jsulak/output" />
  <pxpc:with-option name="stylesheet" value="docbook-xproc-introduction.xslt" />

Which is an alternative to passing command-line options to an xproc

Digging around calabash, it looks like Norm uses basically the same
schema with a different namespace
(http://svn.xmlcalabash.com/calabash/schemas/configuration.rnc).  But
the following pipeline fails, saying that I have not specified a value
for the required option:

<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" name="pipeline">

    <p:input port="source" primary="true" sequence="true">
    <p:output port="result" primary="true"  sequence="true" />

    <p:option name="new-name" required="true" />

    <p:rename match="/foo">
        <p:with-option name="new-name" select="$new-name" />


with the following option document (options.xml):

<xproc-config xmlns:cc="http://com.xmlcalabash/ns/configuration">
    <cc:with-option name="new-name" value="bar" />

with the following command line parameters:

calabash -c options.xml pipeline.xpl

Norm, am I doing something wrong here?

I think is what Dave really wants (correct me if I'm wrong).  I hadn't
really thought of it until Dave brought it up, but having this sort of
options file, like an Ant properties file, would be incredibly useful
for making configurable pipelines.  Almost essential for certain
applications.  It really needs to be done with options or variables;
parameters sets are only immediately useful for XSLT and similar steps
(without jumping through additional hoops to turn them into variables
or refer to them through XPath).  So I hope that that exproc
configuration schema gets widely adopted.


On Mon, May 25, 2009 at 3:11 AM, Dave Pawson <dave.pawson@gmail.com> wrote:
> 2009/5/25  <Toman_Vojtech@emc.com>:
>> My example pipeline had only one parameter input port, but you can have as many you want in your pipelines.
> Nice!
>>> Next question, how do I refer to the values set in
>>> the external file? Is there some syntax for this?
>>> E.g. I want to run an XSLT transform using
>>> parameter $xslt_stylesheet as the stylesheet for the transform.
>> I think you have to use p:parameters to read the parameters document first. Then you can apply XPath expressions to the generated c:param-set document and use the results in, for instance, XProc variables or options, or in choose/when statements.
> Not so nice :-(
> No lessons learned from xslt?  $param-name to get the value?
> regards
> --
> Dave Pawson
> Docbook FAQ.
> http://www.dpawson.co.uk
Received on Monday, 25 May 2009 16:08:38 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:03:05 UTC