Re: pipeline or declare-step?

On Sat, Dec 13, 2008 at 1:47 PM, Dave Pawson <dave.pawson@gmail.com> wrote:
>
> When should we choose one over the other?
>
> Section 4.1 http://www.w3.org/TR/xproc/#p.pipeline notes
> All p:pipeline pipelines have an implicit primary input port named
> "source" and an implicit primary output port named "result". Any input
> or output ports that the p:pipeline declares explicitly are in
> addition to those ports and may not be declared primary.
>
> so that immediately puts some restrictions on the use of source and
> result ports.
>
> Are there any other gotchas here please?

one gotcha is related to the default handling of sequences between the
two forms.

the default input and outputs on pipeline have their sequence
attribute set to 'false', which means a p:pipeline like thus:

<p:pipeline xmlns:p="http://www.w3.org/ns/xproc">
   <p:identity/>
</p:pipeline>

given an input of a sequence of xml documents would fail which might
not be what users expect.

so in situations where sequences are desired for primary input/output
you would need to resort to using the p:declare-step form, which
explicitly sets their sequence attributes to 'true' as follows:

<p:declare-stepxmlns:p="http://www.w3.org/ns/xproc">
    <p:input port="source" sequence="true"/>
    <p:output port="result" sequence="true"/>
    <p:identity/>
</p:declare-step>

to process and output a sequence.

not such a big thing, but somewhat non-intuitive .. I think we should
consider changing the default input/output ports to accept sequences
to avoid ... seems to be aligned with how xpath 2 and xquery work.

hth, Jim Fuller

Received on Saturday, 13 December 2008 13:02:00 UTC