cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vadim Gritsenko <vadim.gritse...@verizon.net>
Subject Re: [RT] Using pipeline as sitemap components (long)
Date Fri, 22 Nov 2002 19:53:33 GMT
Christian Haul wrote:

...

>A last thought: would it be necessary to have those pipelines match a
>pattern or would it be sufficiant to have them names?
>  
>

After reading it second time... And seems that Christian also has 
concern about syntax... There are two ways to understand word "pipeline" 
and Sylvain's proposal.


    First Way: A-la Cocoon Source
    --------------------------------

Figurally speaking: ProcessingPipeline which "extends" 
another ProcessingPipeline invokes sitemap (as cocoon source usually 
do), builds ProcessingPipeline object, and "inserts" it in place of own 
"pipeline"-typed component. Note: When sitemap is processed, all 
<pipeline> tags are scanned until complete ProcessingPipeline is built.

Example sitemap:
    <pipeline>
      <match pattern="*.xml">
        <generate type="file" src="docs/{1}.xml"/>
        <serialize type="xml"/>
      </match>
      <match pattern="*.jpg">
        <read mime-type src="images/{1}.jpg"/>
      </match>
    </pipeline>
  
    <pipeline>
      <match pattern="*.html">
        <generate type="pipeline" src="{1}.xml"/>
        <transform src="xml2html.xslt"/>
        <serialize type="html"/>
      </match>
    </pipeline>

Pipeline built after execution of "test.html" request:
        <generate type="file" src="docs/test.xml"/>
        <transform src="xml2html.xslt"/>
        <serialize type="html"/>



    Second Way: A-la Text Substitution
    ------------------------------------

Figurally speaking: <pipeline> which "extends" another <pipeline> finds 
named <pipeline> tag and inserts the whole its content in place of 
"pipeline"-typed component. Note: only named <pipeline> is used, all 
other pipeline tags are ignored.

Example sitemap (differs from the above!):
    <pipeline name="mypipeline">
      <match pattern="*.html">
        <generate type="file" src="docs/{1}.xml"/>
        <serialize type="xml"/>
      </match>
      <match pattern="*.jpg">
        <read mime-type src="images/{1}.jpg"/>
      </match>
    </pipeline>
  
    <pipeline>
      <match pattern="*.html">
        <generate type="pipeline" src="mypipeline"/>
        <transform src="xml2html.xslt"/>
        <serialize type="html"/>
      </match>
    </pipeline>

After expansion is made (and serializer is removed):
    <pipeline>
      <match pattern="*.html">
        <match pattern="*.html">
          <generate type="file" src="docs/{1}.xml"/>
        </match>
        <match pattern="*.jpg">
          <read mime-type src="images/{1}.jpg"/>
        </match>
        <transform src="xml2html.xslt"/>
        <serialize type="html"/>
      </match>
    </pipeline>

Pipeline built after execution of "test.html" request:
        <generate type="file" src="docs/test.xml"/>
        <transform src="xml2html.xslt"/>
        <serialize type="html"/>


Results are the same, but please note the differences.

Implementation via the first way is better named as "cocoon"-type 
components, second way can be named as "pipeline"-type components.


Vadim



>	Chris.
>  
>



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


Mime
View raw message