- From: Jeni Tennison <jeni@jenitennison.com>
- Date: Tue, 22 May 2007 22:16:54 +0100
- To: public-xml-processing-model-wg@w3.org
Norman Walsh wrote:
> / Jeni Tennison <jeni@jenitennison.com> was heard to say:
> |> Do you have any use case in mind ?
> |
> | An optional pre/post-processing step. If the 'preprocess' step has a
> | document on it, use it to transform the source prior to the other
> | processing; if not, then just use the source as-is.
>
> How do you do that?
Currently, I'd do:
<p:pipeline>
<p:input port="source" />
<p:input port="preprocess" sequence="yes" />
<p:count name="nPreprocess">
<p:input port="source">
<p:pipe source="preprocess" />
</p:input>
</p:count>
<p:choose name="preprocessed">
<p:xpath-context>
<p:pipe source="nPreprocessed" />
</p:xpath-context>
<p:when test=". = 1">
<p:output port="result" />
<p:xslt>
<p:input port="source">
<p:pipe source="source" />
</p:input>
<p:input port="stylesheet">
<p:pipe source="preprocess" />
</p:input>
</p:xslt>
</p:when>
<p:otherwise>
<p:output port="result" />
<p:identity>
<p:input port="source">
<p:pipe source="source" />
</p:input>
</p:identity>
</p:otherwise>
</p:choose>
... processing of preprocessed/result ...
</p:pipeline>
I'm forced to specify the 'preprocess' port as a sequence despite the
fact that I only want it to hold a maximum of one document.
> | Another example is
> | the 'source' input on the p:xslt2 step: not all transformations
> | require source documents.
>
> I had expected the xslt2 step to require either exactly one source
> document or an initial template name, or both. I would have expected a
> source with no documents on it to be an error.
>
> I'm not sure that's justified, but it's what I would have expected.
(In fact, the way p:xslt2 is specified is a lot better than either of
our expectations, but let's pursue this...) It sounds like you agree
that steps might have optional inputs. The problem is
(a) there isn't a required attribute allowed on <p:input>
(b) all inputs must be specified or the step no longer matches its signature
As I said to Mohamed, I think that using the cardinality of an input is
a lot less disruptive than introducing the concept of non-required inputs.
Jeni
--
Jeni Tennison
http://www.jenitennison.com
Received on Tuesday, 22 May 2007 21:17:00 UTC