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

Re: p:for-each

From: Norman Walsh <Norman.Walsh@Sun.COM>
Date: Thu, 27 Jul 2006 10:28:44 -0400
To: public-xml-processing-model-wg@w3.org
Message-ID: <873bcnunoj.fsf@nwalsh.com>
/ Jeni Tennison <jeni@jenitennison.com> was heard to say:
|> Given that there must be exactly one, is there a compelling reason to
|> do this with a p:declare-input as opposed to simply allowing those
|> attributes on the p:for-each element?
|
| I have five reasons:
|
| 1. For symmetry with <p:declare-output> in <p:for-each>
| 2. To provide a place for the naming of the input, as opposed to the
| loop itself
| 3. For symmetry with <p:declare-input> in <p:choose> (if we have them)
| 4. For symmetry with <p:declare-input> for other inputs in
| <p:for-each> (if we have them)
| 5. For extensibility should we choose (in some future version) to
| allow multiple inputs over which we iterate
|
| I guess that 3 is the most compelling reason. If you use attributes on
| <p:for-each>, you end up with something like:
|
|   <p:for-each name="loop"
|               ref-each="#pipe/document"
|               select="//chapter"
|               input-name="chapter">
|     <p:declare-output port="validated" />
|     <p:declare-output port="errors" />
|
|     <p:step kind="validate" name="validate">
|       <p:input port="document" ref="#loop/chapter" />
|       <p:output port="validated" ref="#loop/validated" />
|       <p:output port="errors" ref="#loop/errors" />
|     </p:step>
|   </p:for-each>
|
| i.e. you need a @name to name the <p:for-each> and a @input-name to
| name the input. This is ugly.

Ok, I'm convinced.

|> It seems to me that you should declare all the inputs or none of them,
|> declaring only some just makes my head hurt.
|
| I'd be very happy if you could only declare the input that you're
| iterating over.

That's what I propose for now.

                                        Be seeing you,
                                          norm

-- 
Norman Walsh
XML Standards Architect
Sun Microsystems, Inc.

Received on Thursday, 27 July 2006 14:29:02 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:21:48 GMT