W3C home > Mailing lists > Public > public-xml-processing-model-wg@w3.org > April 2007

Re: Option or parameter?

From: Jeni Tennison <jeni@jenitennison.com>
Date: Wed, 25 Apr 2007 09:11:07 +0100
Message-ID: <462F0D1B.4060509@jenitennison.com>
To: public-xml-processing-model-wg <public-xml-processing-model-wg@w3.org>

Alessandro Vernet wrote:
> When should a component designer use an option vs. a parameter?
> The spec reads (2.3): "The distinction between options and parameters
> is simply that options are used by the XProc processor to configure
> the step; the step never sees them. Parameters are passed to the step
> for its use, the XProc processor does not use them."
> What does "passed to the step" mean here? If the value of an option
> wasn't passed to the corresponding step, it wouldn't be of much use,
> would it?

I agree with Alex V. that we should make the distinction between options 
and parameters a lot clearer.

At a theoretical level, I propose that we say that options are used when 
the names of arguments are known in advance (at the design of the 
component), and that parameters are used when the names of arguments 
aren't known in advance. Since you can't know what parameter names are 
going to be passed in to a pipeline, you shouldn't rely on particular 
parameters being present.

At a practical level, I propose that we say that parameters can never be 
accessed using variable references within XPath expressions. So you can do:

   <p:option name="schema-uri" />
     <p:option name="href" select="$schema-uri" />

but can't do:

   <p:parameter name="schema-uri" />
     <p:option name="href" select="$schema-uri" />

That means the only way you can pass parameters into steps is through 
<p:import-parameter>. You can turn options into parameters, but you 
can't turn parameters into options.

The consequences would be:

  * it's OK for an option and a parameter to have the same name
  * the eventual target for all parameters will be an atomic step that
    accepts parameters, such as p:xslt
  * pipelines will mostly use options rather than parameters


Jeni Tennison
Received on Wednesday, 25 April 2007 08:11:17 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:32:42 UTC