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

Re: For-each question

From: Jeni Tennison <jeni@jenitennison.com>
Date: Tue, 25 Jul 2006 20:49:59 +0100
Message-ID: <44C675E7.6050102@jenitennison.com>
To: public-xml-processing-model-wg@w3.org


Alex Milowski wrote:
> Jeni Tennison wrote:
>> My reasons for arguing against declaring all the inputs required by a 
>> <p:for-each> (or <p:choose>) are:
>> 1. It's unnecessary (implementations can work out what extra inputs 
>> are required for themselves)
> OK.  And extra outputs?  What happens to those?  Do they go to the bit
> bucket or do they produce a collection?

Well, you need to declare the outputs that you want to use (in order to 
give them a name). So if you produce another output, then either it's an 
error or it goes to the bit bucket: it depends on what our policy is for 
undeclared outputs in pipelines generally.

>> 2. It's tedious for users
> I'm not convinced that it is that onerous.

I'm thinking of something like:

<p:pipeline name="validate-and-transform">
   <p:declare-input name="documents" />
   <p:declare-input name="schema" />
   <p:declare-input name="stylesheet" />
   <p:declare-output name="results" />

   <p:for-each name="loop">
     <p:declare-input name="document"
                      ref-each="#validate-and-transform/documents" />
     <p:declare-input name="schema"
                      ref="#validate-and-transform/schema" />
     <p:declare-input name="stylesheet"
                      ref="#validate-and-transform/stylesheet" />
     <p:declare-output name="results"
                       ref="#validate-and-transform/results" />
     <p:step kind="p:xsd" name="validate">
       <p:input name="document" ref="#loop/document" />
       <p:input name="schema" ref="#loop/schema" />
       <p:output name="result" />
     <p:step kind="p:xslt" name="transform">
       <p:input name="document" ref="#validate/result" />
       <p:input name="stylesheet" ref="#loop/stylesheet" />
       <p:output name="result" ref="#loop/results" />

It seems tedious to me to have to (re)declare the schema and stylesheet 
pipeline inputs as inputs for the for-each. The more inputs and 
parameters we have, the more tedious it gets.

>> 3. It's unlike iteration in other languages (you don't have to define 
>> all the variables used within a for loop in, say, Java)
> Unlike iteration in other languages, that input must be replayed for
> each iteration.

I don't understand what you mean by 'replayed'? You mean that behind the 
scenes, the processor has to make copies of the other inputs? Why should 
the user care about what the processor has to do behind the scenes?


Jeni Tennison
Received on Wednesday, 26 July 2006 08:04:49 UTC

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