RE: Option inheritance

Alex,

Good question, I didn't go that far in my initial proposal. Perhaps we could
use p:with-option for that, if we allowed multiple p:with-option for the same
option, like this:

<p:xslt>
  <p:with-option name="parameters" select="map{'foo' := 'x'}"/>
  <p:with-option name="parameters" select="map{'bar' := 'y'}"/>
</p:xslt>

The semantics would be that the p:with-option would be processed in the document
order and the resulting value of the option would be a 'concatenation' of the
resulting sequence of values. The exact semantics of this 'concatenation' would
depend on the data type of the option. Some immediate ideas:

- For maps, you would get an union (where each map in the sequence overwrites
  the colliding key/value pairs already present in the result map).

- For sequences, you would get a concatenation of the values.

- For scalars, you would get a dynamic error (or a sequence??).


Given the above, something similar to our current way of overriding parameters
from a parameter input port could then be achieved by doing this:

<p:declare-step>
  <p:option name="parameters" type="map(*)"/>
  ...
  <p:xslt>
    <p:with-option name="parameters" select="map{'foo' := 'x'}"/>
    <!-- potentially overrides the value for the key 'foo' -->
    <p:with-option name="parameters" select="$parameters"/>
    <!-- inserts/overrides the value for the key 'bar' -->
    <p:with-option name="parameters" select="map{'bar' := 'y'}"/>
  </p:xslt>
  ...
</p:declare-step>

In my 'option inheritance' proposal, specifying a p:with-option (or using the
shortcut option syntax) for OPT disables the 'autobinding' for OPT. This is more
or less in line with our current situation in XProc 1.0 with parameter input
ports and p:with-param: if a p:with-param is present, the processor does not
connect to the parameter input port of the owner pipeline.

Similar to the 'option inheritance' proposal, I think the idea described here
would work and might be useful for options of any type, not just 'parameters'.

Regards,
Vojtech

--
Vojtech Toman
Consultant Software Engineer
EMC | Information Intelligence Group
vojtech.toman@emc.com
http://developer.emc.com/xmltech

From: Alex Milowski [mailto:alex@milowski.com]
Sent: Friday, February 01, 2013 7:07 PM
To: public-xml-processing-model-wg@w3.org
Subject: Re: Option inheritance


On Tue, Jan 29, 2013 at 4:48 AM, Toman, Vojtech <vojtech.toman@emc.com<mailto:vojtech.toman@emc.com>> wrote:

Application of autobinding to parameters
========================================

Suppose we model parameters as an XSLT 3.0 map. With the autobinding facility,
we could make the p:pipeline shortcut equivalent to:

<p:declare-step>
  <p:input port="source">
  <p:output port="result"/>
  <p:option name="parameters" autobind="true" type="map(*)"/>
  ...
</p:declare-step>

How do we explicitly set specific parameters for steps like XSLT on the step invocation?

That is, do with still have p:with-param ?

--
--Alex Milowski
"The excellence of grammar as a guide is proportional to the paucity of the
inflexions, i.e. to the degree of analysis effected by the language
considered."

Bertrand Russell in a footnote of Principles of Mathematics

Received on Wednesday, 6 February 2013 10:57:47 UTC