Re: Options or parameters

/ Alessandro Vernet <avernet@orbeon.com> was heard to say:
| Going one step further: given the lack of use cases asking for all
| parameters in scope to be passed to a step, why don't we keep things
| simple, and make parameters binding alway explicit?

I'm on the fence about whether or not always passing them all is the
right answer. Henry argues that the case of parameter collision is
marginal, I concede that there are workarounds (if ugly ones).

And it is consistent with the environment analogy which I think I can
get used to it. But the use case for passing unknown parameters is
easy to make.

Consider this pipeline:

<p:pipeline name="pipeline"
	    xmlns:p="http://www.w3.org/2007/03/xproc"
	    xmlns:px="http://xproc.org/2007/03/xproc/ex">
<p:input port="source"/>
<p:option name="format" value="html"/>

<p:xslt>
  <p:input port="stylesheet">
    <p:document href="db4-to-db5.xsl"/>
  </p:input>
</p:xslt>

<p:namespace-rename>
  <p:option name="from" value=""/>
  <p:option name="to" value="http://docbook.org/ns/docbook"/>
</p:namespace-rename>

<p:validate-relax-ng>
  <p:input port="schema">
    <p:document href="schema/docbook.rng"/>
  </p:input>
</p:validate-relax-ng>

<p:xslt>
  <p:input port="stylesheet">
    <p:document href="db5-normalize.xsl"/>
  </p:input>
</p:xslt>

<p:choose>
  <p:when test="$format = 'html'">
    <p:xslt name="xform-to-html">
      <p:input port="stylesheet">
	<p:document href="html/docbook.xsl"/>
      </p:input>
    </p:xslt>

    <p:store>
      <p:input port="source">
	<p:pipe step="xform-to-html" port="result"/>
	<p:pipe step="xform-to-html" port="secondary"/>
      </p:input>
    </p:store>
  </p:when>

  <p:when test="$format = 'fo'">
    <p:xslt name="xform-to-fo">
      <p:input port="stylesheet">
	<p:document href="fo/docbook.xsl"/>
      </p:input>
    </p:xslt>

    <p:xsl-formatter/>
  </p:when>

  <p:otherwise>
    <p:error>
      <p:option name="description" value="Invalid format specified"/>
    </p:error>
  </p:otherwise>
</p:choose>

</p:pipeline>

It's a useful pipeline, one that I'll actually write and use a lot
eventually. It transforms DocBook 4 markup into DocBook 5 markup, if
appropriate, makes sure all the elements are in the right namespace,
validates, and then formats either HTML or PDF.

This pipeline isn't going to be generally useful unless I can pass any
of the (at last count 634) DocBook stylesheet parameters to the
pipeline for the stylesheet. I certainly don't want to have to write
all of those explicitly.

                                        Be seeing you,
                                          norm

-- 
Norman Walsh <ndw@nwalsh.com> | If you run after wit you will succeed
http://nwalsh.com/            | in catching folly.-- Montesquieu

Received on Friday, 4 May 2007 12:01:40 UTC