Re: p:for-each

Norm,

On 7/29/06, Norman Walsh <Norman.Walsh@sun.com> wrote:
> p:for-each iterates over a document sequence or the nodes matched
> by an XPath expression in a document sequence.
>
> <p:for-each name="QName">
>   <p:declare-input ref-each="reference" select="//..." .../>
>   <p:declare-output .../>

Any reason why you are using 'ref-each' for the attribute name instead
of 'ref' here?

Also, note the difference between your <p:declare-input> in the
<p:for-each> and the <p:declare-input> in the <p:pipeline>. The former
reads from somewhere and declares a name that can be referenced inside
the <p:for-each>. The later only provide a name that be referenced
inside the pipeline.

The input of <p:for-each> reads from somewhere like a step input and
declares a name like a pipeline declare-input. It does both and is not
exactly the same as any of those. IMHO it would be wise to choose an
element name that is different from <p:declare-input> and <p:input> to
avoid the confusion, e.g.:

<p:for-each >
   <p:for-each-input ref="documents-to-import" select="..."
name="source-document"/>
   <p:for-each-output name="sequence-of-errors" ref="error"/>

    Steps with references to source-document and declaring the name error
</p:for-each>

> (I don't think there's consensus on combining loop-over-these-nodes
> and loop-over-these-documents, but personally I think the semantics
> I've described are reasonable and easy to understand.)

I agree and also think combining the loop-over-these-nodes and
loop-over-these-documents is a good idea.

Alex
-- 
Blog (XML, Web apps, Open Source):
http://www.orbeon.com/blog/

Received on Thursday, 3 August 2006 01:30:47 UTC