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

RE: Option inheritance

From: Toman, Vojtech <vojtech.toman@emc.com>
Date: Wed, 6 Feb 2013 05:56:58 -0500
To: "public-xml-processing-model-wg@w3.org" <public-xml-processing-model-wg@w3.org>
Message-ID: <F3C7EBECE80AC346BE4D1C5A9BB4A41F2F43C75A61@MX11A.corp.emc.com>

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:with-option name="parameters" select="map{'foo' := 'x'}"/>
  <p:with-option name="parameters" select="map{'bar' := 'y'}"/>

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:option name="parameters" type="map(*)"/>
    <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'}"/>

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'.


Vojtech Toman
Consultant Software Engineer
EMC | Information Intelligence Group

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:input port="source">
  <p:output port="result"/>
  <p:option name="parameters" autobind="true" type="map(*)"/>

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

Bertrand Russell in a footnote of Principles of Mathematics
Received on Wednesday, 6 February 2013 10:57:47 UTC

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