cocoon-docs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From da...@cocoon.zones.apache.org
Subject [DAISY] Updated: Modularize Cocoon apps (Using blocks)
Date Mon, 28 May 2007 16:28:05 GMT
A document has been updated:

http://cocoon.zones.apache.org/daisy/documentation/1291.html

Document ID: 1291
Branch: main
Language: default
Name: Modularize Cocoon apps (Using blocks) (unchanged)
Document Type: Cocoon Document (unchanged)
Updated on: 5/28/07 4:27:58 PM
Updated by: Reinhard Pötz

A new version has been created, state: publish

Parts
=====

Content
-------
This part has been updated.
Mime type: text/xml (unchanged)
File name:  (unchanged)
Size: 7881 bytes (previous version: 5391 bytes)
Content diff:
(143 equal lines skipped)
    
    <p>The previous example showed how you can call a pipeline from another block.
    But here is even more you can do! A sitemap can also provide pipeline fragements
--- that can be used by other blocks.<br/>
--- Add this pipeline to <tt>myblock2</tt>. It provides a transformation service
--- that consists of two XSLT transformation steps:</p>
+++ that can be used by other blocks:</p>
    
--- <pre>TBD</pre>
+++ <pre>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
+++ &lt;map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0"&gt;
+++   &lt;map:pipelines&gt;
+++     &lt;map:pipeline&gt;
+++       &lt;map:match pattern="callingTransformationService"&gt;
+++         &lt;map:generate src="demo/welcome.xml"/&gt;
+++         <strong>&lt;map:transform type="servletService"&gt;
+++           &lt;map:parameter name="service" 
+++            value="servlet:myBlock2:/myXsltTransformation-service"/&gt;
+++         &lt;/map:transform&gt;</strong>
+++         &lt;map:serialize type="xml"/&gt;
+++       &lt;/map:match&gt;
+++     &lt;/map:pipeline&gt;
+++   &lt;/map:pipelines&gt;
+++ &lt;/map:sitemap&gt;</pre>
    
--- <p>Now it can be used from myBlock1</p>
+++ <p>When the requests arrives at <tt>callingTransformationService</tt>
pipeline,
+++ the generator produces SAX events of <tt>demo/welcome.xml</tt>. There is nothing
+++ special here. The interesting part comes with the following transformer of type
+++ <tt>servletService</tt>. It calls a transformation service which is provided
by
+++ <tt>myBlock2</tt>.</p>
    
--- <pre>TBD</pre>
+++ <p>Add this service to the sitemap of myBlock2
+++ (<tt>getting-started-app/myBlock2/src/main/resources/COB-INF/sitemap.xmap)</tt>.
+++ It consists of one XSLT transformation step:</p>
    
--- <p>...</p>
+++ <pre>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
+++ &lt;map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0"&gt;
+++   &lt;map:pipelines&gt;
+++     &lt;map:pipeline&gt;
+++       &lt;map:match pattern="<strong>myXsltTransformation-service</strong>"&gt;
+++         &lt;map:generate src="<strong>service-consumer:</strong>"/&gt;
+++         &lt;map:transform src="myXsltTransformation.xslt"/&gt;
+++         &lt;map:serialize type="xml"/&gt;
+++       &lt;/map:match&gt;
+++     &lt;/map:pipeline&gt;
+++   &lt;/map:pipelines&gt;
+++ &lt;/map:sitemap&gt;</pre>
    
+++ <p>The generator uses the service-consumer protocol which initializes the
+++ service. Then the pipeline continues with an XSLT transformation
+++ <tt>myXsltTranformation.xslt</tt>, which has to be put into the same directory
+++ as the <tt>myBlock2</tt> sitemap:</p>
+++ 
+++ <pre>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
+++ &lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
+++   &lt;xsl:template match="/"&gt;
+++     &lt;html&gt;
+++       &lt;head&gt;
+++         &lt;title&gt;Output of the XSLT transformation service.&lt;/title&gt;
+++       &lt;/head&gt;
+++       &lt;body&gt;
+++         Output of the XSLT transformation service.
+++       &lt;/body&gt;
+++     &lt;/html&gt;
+++   &lt;/xsl:template&gt;
+++ &lt;/xsl:stylesheet&gt;
+++ </pre>
+++ 
+++ <p>Point your browser at
+++ <tt>http://localhost:8888/myBlock1/callingTransformationService</tt> and see
the
+++ output of the pipeline.</p>
+++ 
+++ <p class="note">Beside transformation services there are also generation and a
+++ serialization services.</p>
+++ 
    </body>
    </html>


Mime
View raw message