Re: Handling Configuration File Parameters -- Historical Unrefined Approach Just for Discussion

James Sulak <jsulak@gmail.com> writes:
> An eval-pipeline step has been mentioned before, but as far as I know
> no one's implemented it as an extension function.

There's a cx:eval step in XML Calabash, though I had failed to document
it at http://xmlcalabash.com/extension/steps/#cx.eval. Here's an
example:

<p:declare-step version='1.0' xmlns:p="http://www.w3.org/ns/xproc" name="main"
                xmlns:cx="http://xmlcalabash.com/ns/extensions"
                xmlns:c="http://www.w3.org/ns/xproc-step">
  <p:output port="result"/>

  <p:import href="http://xmlcalabash.com/library/eval.xpl"/>

  <cx:eval detailed="true">
    <p:input port="source">
      <p:inline><cx:document port="source"><doc>Here I am</doc></cx:document></p:inline>
      <p:inline><cx:document port="parameters"/></p:inline>
    </p:input>
    <p:input port="pipeline">
      <p:inline>
        <p:pipeline version="1.0">
          <p:identity/>
        </p:pipeline>
      </p:inline>
    </p:input>
    <p:input port="parameters"><p:empty/></p:input>
    <p:input port="options"><p:empty/></p:input>
  </cx:eval>

</p:declare-step>

Version 0.9.18 will fix the annoyance where you have to specify the empty
parameters port explicitly. So post 0.9.18, the following simpler version
will also work:

<p:declare-step version='1.0' xmlns:p="http://www.w3.org/ns/xproc" name="main"
                xmlns:cx="http://xmlcalabash.com/ns/extensions"
                xmlns:c="http://www.w3.org/ns/xproc-step">
  <p:output port="result"/>

  <p:import href="http://xmlcalabash.com/library/eval.xpl"/>

  <cx:eval>
    <p:input port="source">
      <p:inline><doc>Here I am</doc></p:inline>
    </p:input>
    <p:input port="pipeline">
      <p:inline>
        <p:pipeline version="1.0">
          <p:identity/>
        </p:pipeline>
      </p:inline>
    </p:input>
    <p:input port="parameters"><p:empty/></p:input>
    <p:input port="options"><p:empty/></p:input>
  </cx:eval>

</p:declare-step>

                                        Be seeing you,
                                          norm

-- 
Norman Walsh <ndw@nwalsh.com> | As long as a word remains unspoken, you
http://nwalsh.com/            | are its master; once you utter it, you
                              | are its slave.--Solomon Ibn Gabirol

Received on Monday, 1 March 2010 14:58:13 UTC