shannon     2002/06/06 09:55:39

  Added:       src/documentation/xdocs/snippet
                        snippet-internal-pipeline.xml
  Log:
  first snippet example
  
  Revision  Changes    Path
  1.1                  
xml-cocoon2/src/documentation/xdocs/snippet/snippet-internal-pipeline.xml
  
  Index: snippet-internal-pipeline.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" 
"../dtd/document-v10.dtd">
  
  <document>
   <header>
    <title>Internal Pipeline Snippet</title>
    <authors>
     <person name="Diana Shannon" email="[EMAIL PROTECTED]"/>
    </authors>
   </header>
  
   <body>
  
    <s1 title="Overview">
  <p>
  This Snippet shows how to create and use an internal pipeline in the sitemap. An 
internal pipeline processes a request from another pipeline in a sitemap. It then 
returns a pipeline fragment to the requesting pipeline for additional processing. The 
pipeline fragment produced by an internal pipeline cannot be accessed externally, for 
example, from an explicit browser request. An internal pipeline is distinguished from 
other pipelines by the value of its internal-only attribute which is set to true.
  </p>
    </s1>
  
    <s1 title="Version">
  <p>
  At the time of this writing, this Snippet was tested against the current release 
version, 2.0.3, and head version, 2.1, of Cocoon.
  </p>
    </s1>
  
    <s1 title="Example">
      <source>
  <![CDATA[
  <map:pipeline internal-only="true">
  
    <map:match pattern="salad">
      <!-- do something -->
    </map:match>
  
    <map:match pattern="soup">
      <!-- do something else -->
    </map:match>
  
  </map:pipeline>
  
  
  <map:pipeline>
     <map:match pattern="meal">
        <map:aggregate element="lunch">
           <map:part src="cocoon:/salad"/>
           <map:part src="cocoon:/soup"/>
        </map:aggregate>
       <map:transform src="stylesheets/lunch2html.xsl"/>
       <map:serialize/>
     </map:match>
  </map:pipeline>
  ]]>
      </source>
  
    </s1>
    
    <s1 title="Discussion">
  <p>
  In the above snippet example, you'll find two pipelines. The first is an internal 
pipeline which provides XML content to the second pipeline upon request. The second 
pipeline makes requests of the first internal pipeline through the <code>cocoon:/ 
protocol</code>. For example, when a request such 
<code>http://localhost:8080/meal</code> is received, the second pipeline, whose 
<code>map:match</code> element contains the value "meal," is matched. This pipeline 
begins processing by making two internal requests of the internal pipeline: one for 
<code>cocoon:/salad</code> and another for <code>cocoon:/soup</code>. It then 
aggregates the fragments returned by the internal pipeline within a lunch element. It 
continues processing by transforming and serializing the result. 
  </p>
  
  </s1>
  
    <s1 title="Tips">
  <p>
  You may need to check the pipeline fragments returned by your internal pipelines by 
calling them externally, for example, in your browser. If so, change the 
<code>internal-only</code> attribute of the pipeline to false until your testing is 
complete. In the above snippet, you could evaluate the pipeline fragment for soup with 
the following request: <code>http://localhost:8080/soup</code>. Once your testing is 
complete, make sure to change the value of the <code>internal-only</code> attribute 
back to true.
  </p>
  </s1>
  
    <s1 title="Comments">
  <p>
  Care to comment on this Snippet? Got another tip? Help keep this Snippet relevant by 
passing along any useful feedback to the author, <link 
href="mailto:[EMAIL PROTECTED]";>Diana Shannon.</link>
  </p>
  </s1>
  
  
  </body>
  </document>
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     [EMAIL PROTECTED]
To unsubscribe, e-mail:          [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to