cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nicola Ken Barozzi <nicola...@apache.org>
Subject Re: [RT] reconsidering pipeline semantics
Date Mon, 08 Jul 2002 13:06:43 GMT


Stefano Mazzocchi wrote:
> Sylvain Wallez wrote:
 >
>>Consider the same sitemap with just
>>an additional "what" attribute to <import> :
>>
>><sitemap>
>>  <pipeline name="doc2html">
>>    <generate src="{doc}.xml"/>
>>    <transform src="doc2html.xsl"/>
>>    <serialize type="html"/>
>>  </pipeline>
>>
>>  <pipeline>
>>    <match pattern="faq.html">
>>      <generate src="faq.xml"/>
>>      <transform src="faq2doc.xsl"/>
>>      <import name="doc2html" what="transform, serialize">
>>        <parameter name="doc" value="dummy"/>
>>      </import>
>>    </match>
>>
>>    <match pattern="*.html">
>>      <import name="doc2html" what="all">
>>        <parameter name="doc" value="{1}"/>
>>      </import>
>>    </match>
>>  </pipeline>
>></sitemap>
>>
>>I don't pretend this notation is nice, but it carries the required
>>information : this simple attribute has removed all ambiguities, and we
>>are able to know exactly what will happen.
>>
>>Has this triggered something in your synapses ?
> 
> 
> No, not really :/

Let me see if my neurons collaborate ;-)
I /think/ that Sylvain wants to convey the same feeling I have.

Pipelines contain Generators, Transformers, Serializers.

  -1 Generator.
  -* Transformers.
  -1 Serializer.

If you add things to a pipeline, it would naturally be assumed that you 
add Transformers, right?

Bzzz... wrong.

It could be that your stream is Serialized, reGenerated someway, and 
processing continues.
Or that The serializet contant is XMLed somewhat, bypassing the second 
Generation phase, and retransformed.

What Sylvain says:
 >>      <import name="doc2html" what="transform, serialize">
 >>        <parameter name="doc" value="dummy"/>
 >>      </import>

Tells to import only the transform and serializer explicitly.

Resource pipelines were thought of being common used endpoints.
Named pipelines are more seen as reusable Transformer snippets.
This creates some confusion.

We could just decide that pipelines imported at the beginning give 
Generator+Transformers but no Serializer.
In the center only the Transformers.
At the end Transformer + Serializer.

ie:

<sitemap>
   <pipeline name="doc2html">
     <generate src="{doc}.xml"/>
     <transform src="doc2html.xsl"/>
     <serialize type="html"/>
   </pipeline>

   <pipeline>
     <match pattern="faq.html">
       <import name="doc2html"> (*implicitly generater+transformer*)
         <parameter name="doc" value="dummy"/>
       </import>
       <transform src="faq2doc.xsl"/>
     <serialize type="html"/>
     </match>

     <match pattern="*.html">
       <import name="doc2html"> (*implicitly all*)
         <parameter name="doc" value="{1}"/>
       </import>
     </match>

     <match pattern="faq.html">
       <generate src="faq.xml"/>
       <transform src="faq2doc.xsl"/>
       <import name="doc2html"> (*implicitly transformer+serializer*)
         <parameter name="doc" value="dummy"/>
       </import>
     </match>
    </pipeline>
</sitemap>


What could make all of this declaration more explicit is creating 
something like:

   <transformer-pipeline name="doc2html">
     <transform src="doc2html.xsl"/>
   </transformer-pipeline>

   <generator-pipeline name="doc2html-G">
     <generate src="{doc}.xml"/>
     <import-transformer-pipeline name="doc2html">
        <parameter name="doc" value="dummy"/>
     </import>
   </generator-pipeline>

   <serializer-pipeline name="doc2html-S">
     <import-transformer-pipeline name="doc2html">
        <parameter name="doc" value="dummy"/>
     </import>
     <serialize type="html"/>
   </serializer-pipeline>

and use:

   <pipeline>
     <match pattern="faq.html">
       <import-generator name="doc2html-G">
         <parameter name="doc" value="dummy"/>
       </import-generator>
       <transform src="faq2doc.xsl"/>
       <serialize type="html"/>
     </match>

   etc...

    </pipeline>

But it really gets verbose...

-- 
Nicola Ken Barozzi                   nicolaken@apache.org
             - verba volant, scripta manent -
    (discussions get forgotten, just code remains)
---------------------------------------------------------------------


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


Mime
View raw message