cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefano Mazzocchi <stef...@apache.org>
Subject Re: Cocoon-view, Cocoon-sitemap documentation
Date Tue, 06 Nov 2001 10:01:34 GMT
giacomo wrote:

> I've talked to Stefano (he is my guest for some days here) about the
> map:label stuff and we found that the approach was wrong. It should be
> an attribute.

Let me give you more details about why I think an element is wrong.

A "label" indicates the exit point that is matched by the view handler.

For example (again from the cocoon site sitemap):

   <map:generator  
     name="file"        
     src="org.apache.cocoon.generation.FileGenerator" 
     label="content"
   />

the file generator is implicitly given the label "content".

  <map:view name="content" from-label="content">
   <map:serialize type="xml"/>
  </map:view>

This "view" connects to the label "content". It means that if you ask
for the "content" view of a resource, the pipeline will stop the regular
processing as soon as it encounters a "content" label, either implicit
or explicit. Then continue the processing defined in the <map:view> tag
(which normally includes some transformers and a serializer).

   <map:match pattern="...">
    <map:aggregate ...>
     <map:part src="..."/>
     <map:part src="..."/>
    </map:aggregate>
    <map:transform .../>
    <map:transform .../>
    <map:serialize .../>
   </map:match>

there are cases where the "content" is generated out of aggregating
(say, on a news page) and other cases where the content is simply one of
the aggregated parts (like in the case where you aggregate a document
with the sitebar).

In all cases, a label (either implicitly defined in the component
declaration) must be matched to exit the regular pipeline and go to the
"view" one that terminates the processing on that resource for that
particular view.

So, I believe it's much easier to say understand something like

   <map:match pattern="...">
    <map:aggregate ... label="content">
     <map:part src="..."/>
     <map:part src="..."/>
    </map:aggregate>
    ...
   </map:match>

than it is for

   <map:match pattern="...">
    <map:label name="content">
     <map:aggregate ...>
      <map:part src="..."/>
      <map:part src="..."/>
     </map:aggregate>
    </map:label>
    ...
   </map:match>

or even worse compare this

   <map:match pattern="...">
    <map:label name="label1">
     <map:generator.../>
     <map:label name="label2">
      <map:transform .../>
      <map:label name="label3">
       <map:transform .../>
      </map:label>
     </map:label>
    </map:label>
    <map:serialize .../>
   </map:match>

with this

   <map:match pattern="...">
    <map:generator... label="label1"/>
    <map:transform ... label="label2"/>
    <map:transform ... label="label3"/>
    <map:serialize .../>
   </map:match>

which provide the "exact" same information.

Now, I don't see any drawback in this approach, but if you see any it's
the best time to tell since views will place an vital role in the future
of Cocoon we must do out best effort to make it a very solid contract
with our users.

If we choose to go the attribute way (and hopefully we do), there are
two options:

 1) use the undefined namespace
 2) use the sitemap namespace

so, either

 <map:generator ... label="..."/>

or

 <map:generator ... map:label="..."/>

but since we never used the sitemap namespace for attributes, I'd
suggest 1)

What do you think?

-- 
Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<stefano@apache.org>                             Friedrich Nietzsche
--------------------------------------------------------------------



---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message