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

Re: Options or parameters

From: Jeni Tennison <jeni@jenitennison.com>
Date: Wed, 02 May 2007 09:16:12 +0100
Message-ID: <463848CC.7060208@jenitennison.com>
To: public-xml-processing-model-wg@w3.org

Norman Walsh wrote:
> I believe the following proposal addresses this issue:
> 
> 1. Add in-scope options to the environment; treat options and parameters
>    in exactly the same way with respect to scoping and shadowing.

Yes. Specifically, they are lexically scoped and must be passed 
explicitly into components.

> 2. Allow compound steps to declare both options and parameters.

I'm kinda happy with this for now. (I'll argue for renaming "p:option" 
to "p:variable" in this context later.)

> 3. Make variable references in XPath expressions refer to *options*
>    instead of parameters.

Yes.

> 4. Allow p:import-parameter to change the namespace of parameters.

Yes. I think this provides a reasonable way of passing separate bundles 
of name/value pairs into the pipeline without being stuck with those 
namespaces later.

(If parameter bundles were given names we wouldn't need to do this.)

> So, given:
> 
>    <p:pipeline xmlns:p="..." xmlns:config="...">
>      <p:option name="per-page" value="30"/>
> 
>      <p:group>
>        <p:parameter name="config:items-per-page" select="$per-page"/>
>        <p:xslt>
>          <p:import-parameter name="config:*" ns=""/>
>          ...
>        </p:xslt>
>      </p:group>
>    </p:pipeline>
> 
> The value of $per-page is 30 (or whatever was passed to the pipeline).
> The p:group calculates a parameter named config:items-per-page from
> the pipeline option value. What gets passed to the XSLT step is a
> parameter named "items-per-page" (in no namespace) with the value
> specified for config:items-per-page on the group.
> 
> The distinction between options and parameters then becomes simply that
> the names of options are all known in advance. The names of parameters
> may not be.
> 
> In particular, I might have passed other parameters in the config
> namespace to the pipeline and they would all get passed to the XSLT
> step even though the pipeline hasn't a clue what their actual names
> are before the pipeline is executed.

That sounds right to me, except that I think the pipeline should declare 
that it can accept parameters in the config namespace. Also, it could be 
rewritten without the <p:group>:

<p:pipeline xmlns:p="..." xmlns:config="...">
   <p:option name="per-page" value="30"/>
   <p:parameter name="config:*" />

   <p:xslt>
     <p:parameter name="items-per-page" select="$per-page" />
     <p:import-parameter name="config:*" ns=""/>
     ...
   </p:xslt>
</p:pipeline>

but I suspect you just included it to demonstrate a compound step.

Jeni
-- 
Jeni Tennison
http://www.jenitennison.com
Received on Wednesday, 2 May 2007 08:16:23 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:21:51 GMT