Date: 2005-03-01T13:50:55
   Editor: LarsHuttar
   Wiki: Cocoon Wiki
   Page: CocoonProtocolExample
   URL: http://wiki.apache.org/cocoon/CocoonProtocolExample

   no comment

Change Log:

------------------------------------------------------------------------------
@@ -1,47 +1,47 @@
 Here is a sitemap snippet that shows how the cocoon:/ protocol can be used to 
modularize pipelines and aggregate data from multiple sources. -- 
BertrandDelacretaz
 
-{{{
-<!-- assuming the required components are correctly configured -->
-
-<!-- for the body use an XMLized HTML file -->
-<map:match pattern="body-*.xml">
-  <map:generate type="html" src="body/{1}.html"/>
-  <map:serialize type="xml"/>
-</map:match>
-
-<!-- for the heading use a database query -->
-<map:match pattern="head-*.xml">
-  <map:generate src="sql-query.xml"/>
-  <map:transform type="sql">
-    <map:parameter name="use-connection" value="my_pool"/>
-  </map:transform>
-  <map:transform src="format-query-results.xsl"/>
-  <map:serialize type="xml"/>
-</map:match>
-
-<!-- combine head and body in XML -->
-<map:match pattern="fulldoc-*.xml">
-  <map:aggregate element="fulldoc"> 
-    <map:part src="cocoon:/head-{1}.xml"/>
-    <map:part src="cocoon:/body-{1}.xml"/>
-  </map:aggregate>
-  <map:serialize type="xml"/>
-</map:match>
-
-<!-- here's the HTML version -->
-<map:match pattern="fulldoc-*.html">
-  <map:generate src="cocoon:/fulldoc-{1}.xml"/>
-  <map:transform src="xml-to-html.xsl"/>
-  <map:serialize type="html"/>
-</map:match>
-
-<!-- and the RTF version -->
-<map:match pattern="fulldoc-*.rtf">
-  <map:generate src="cocoon:/fulldoc-{1}.xml"/>
-  <map:transform src="xml-to-fo.xsl"/>
-  <map:serialize type="fo2rtf"/>
-</map:match>
-
+{{{
+<!-- assuming the required components are correctly configured -->
+
+<!-- for the body use an XMLized HTML file -->
+<map:match pattern="body-*.xml">
+  <map:generate type="html" src="body/{1}.html"/>
+  <map:serialize type="xml"/>
+</map:match>
+
+<!-- for the heading use a database query -->
+<map:match pattern="head-*.xml">
+  <map:generate src="sql-query.xml"/>
+  <map:transform type="sql">
+    <map:parameter name="use-connection" value="my_pool"/>
+  </map:transform>
+  <map:transform src="format-query-results.xsl"/>
+  <map:serialize type="xml"/>
+</map:match>
+
+<!-- combine head and body in XML -->
+<map:match pattern="fulldoc-*.xml">
+  <map:aggregate element="fulldoc"> 
+    <map:part src="cocoon:/head-{1}.xml"/>
+    <map:part src="cocoon:/body-{1}.xml"/>
+  </map:aggregate>
+  <map:serialize type="xml"/>
+</map:match>
+
+<!-- here's the HTML version -->
+<map:match pattern="fulldoc-*.html">
+  <map:generate src="cocoon:/fulldoc-{1}.xml"/>
+  <map:transform src="xml-to-html.xsl"/>
+  <map:serialize type="html"/>
+</map:match>
+
+<!-- and the RTF version -->
+<map:match pattern="fulldoc-*.rtf">
+  <map:generate src="cocoon:/fulldoc-{1}.xml"/>
+  <map:transform src="xml-to-fo.xsl"/>
+  <map:serialize type="fo2rtf"/>
+</map:match>
+
 }}}
 
 Note that the various parts can be tested separately, by requesting them 
directly like "body-xyz.xml". This is very useful when debugging or testing 
complex pipelines (although it can also be done with views).
@@ -55,15 +55,15 @@
 While the body part depends on the page requested, the head is always 
extracted with the same query (sql-query.xml).[[BR]]
 The fulldoc-*.xml pipeline, after having aggregated the results of the head 
and of the body pipeline, return the content to the main pipeline from where we 
started which transform the content to rtf.[[BR]]
 The pipeline flow can be represented as follow:
-{{{ 
-fulldoc-*.rtf  --> fulldoc-*.xml --> head-*.xml -->  fulldoc-*.xml --> 
fulldoc-*.rtf
-                                     body-*.xml --^
+{{{ 
+fulldoc-*.rtf  --> fulldoc-*.xml --> head-*.xml -->  fulldoc-*.xml --> 
fulldoc-*.rtf
+                                     body-*.xml --^
 }}}
 
 === cocoon:/? ===
 If your cocoon structure is divided into sub sitemaps you will be interested 
in the fact that you can call pipeline in others sitemaps by calling the right 
path:
  *  cocoon:/aPipeline ask the results of the pipeline "aPipeline" which 
resides in the current sitemap
- *  cocoon://aPipeline ask the results of the pipeline "aPipeline" which 
resides in the '''main''' sitemap
+ *  cocoon://aPipeline ask the results of the pipeline "aPipeline" which 
resides in the '''main''' (i.e. the Cocoon top-level) sitemap (or, of course, a 
subsitemap that it mounts)
 
 === See also ===
 

Reply via email to