Re: "Fixing parameters"

"Henry S. Thompson" <ht@inf.ed.ac.uk> writes:
>> 2. Instead of specifying input ports, steps declare that they accept
>>    parameters in a manner analogous to options:
>>
>>    <p:declare-step type="p:xslt" xml:id="xslt">
>>       . . .
>>       <p:parameters name="parameters"/> <!-- *** -->
>
> So the value of 'name' is the name of a pseudo-option?

Yes.

>> 3. Steps accept parameters just like options:
>>
>>    <p:xslt parameters="{$parameters}"> ...
>
>              ^^^^^^^^^^
> That has to match the name declared with p:parameters, right?

Yes. Parameters become a special kind of option. They can *almost* be
ordinary options, except...they have to have that magic inheritance.

> What about
>
>      <[some step]>
>       <p:with-option name="parameters" select="...."/>
>
> or do we not need that given {}?
> or do we add
>       <p:with-parameters name="..." select="...."/>
>
> That has the advantage of allowing several. . .

I don't think we should overload with-option. I suppose for completeness
we should add p:with-parameters though I'd sort of hoped to avoid it.

>>    <p:xslt parameters="{map:put(map:new(), 'output-format', 'xhtml')}"> ...
>>
>>    I think maps basically have to be in variables, so we don't need
>>    to support a <p:with-parameters> instruction.
>
> Well, see above for a possible counter-reason.

I'm not sure what you mean by several. Several maps for the same
parameters-pseudo option? Or several different parameter
pseudo-options?

>> 4. If a step has no bindings for any of its parameters, and its enclosing
>>    pipeline has a parameters with the same name, then those parameters
>>    are passed in automatically. You can explicitly disable this with
>>    parameters="{()}".
>
> 'Enclosing' runtime, or lexically?  Need an example.

Lexically:


  <p:declare-step name="run-xslt">
    <p:input port="source"/>
    <p:parameters name="parameters"/>
    <p:parameters name="alt-parameters"/>

    <p:xslt name='stage1'>
      <p:input port="stylesheet">
        <p:document href="style1.xsl"/>
      </p:input>
    </p:xslt>

    <p:xslt name='stage2' parameters="{$alt-parameters}">
      <p:input port="stylesheet">
        <p:document href="style.xsl"/>
      </p:input>
    </p:xslt>
  </p:declare-step>

The p:xslt step named stage1 automagically gets any parameters passed
to the pipeline in the 'parameters' map (but not the 'alt-parameters'
map). The p:xslt step named stage2 gets the parameters (if any) passed
on the 'alt-parameters' map but not the ones passed on the 'parameters'
map.

                                        Be seeing you,
                                          norm

-- 
Norman Walsh
Lead Engineer
MarkLogic Corporation
Phone: +1 512 761 6676
www.marklogic.com

Received on Friday, 14 September 2012 20:30:51 UTC