Split Pipeline into two and recombine
Example of a pipeline with two parallel channels that recombine
Index > Books > Cocoon 2 NetKernel Adaption Kit > Example Pipelines > Split Pipeline into two and recombine


<idoc>
  <comment>Initialise Cocoon if necessary</comment>
  <instr>
    <type>cocoon.Initialise</type>
    <operand>cocoon.xconf</operand>
  </instr>
  <comment>Create a directory listing of current directory</comment>
  <instr>
    <type>cocoon.generator.DirectoryGenerator</type>
    <src>file:.</src>
    <param>
      <map:parameters xmlns:map="http://apache.org/cocoon/sitemap/1.0">
        <map:parameter name="depth" value="1" />
      </map:parameters>
    </param>
    <target>var:listing</target>
  </instr>
  <comment>create HTML template</comment>
  <instr>
    <type>copy</type>
    <operand>
      <html>
        <head>
          <link href="/xlib/styles/xmlverbatim.css" rel="stylesheet" type="text/css" />
        </head>
        <body>
          <table border="0">
            <tr>
              <td valign="top">
                <h2>Directory Listing</h2>
                <listing-table />
              </td>
              <td valign="top">
                <h2>Raw Output</h2>
                <listing-raw />
              </td>
            </tr>
          </table>
        </body>
      </html>
    </operand>
    <target>var:template</target>
  </instr>
  <comment>Style as a table</comment>
  <instr>
    <type>cocoon.transformer.TraxTransformer</type>
    <src>directory_table.xsl</src>
    <operand>var:listing</operand>
    <target>var:template#xpointer(//listing-table)</target>
  </instr>
  <comment>Style as a xmlverbatim raw XML</comment>
  <instr>
    <type>cocoon.transformer.TraxTransformer</type>
    <src>ffcpl:/xlib/styles/xmlverbatim.xsl</src>
    <operand>var:listing</operand>
    <target>var:template#xpointer(//listing-raw)</target>
  </instr>
  <comment>declare as HTML (so NetKernel can automatically serialize to HTML)</comment>
  <instr>
    <type>cast</type>
    <operand>var:template</operand>
    <operator>
      <cast>
        <mimetype>text/html</mimetype>
      </cast>
    </operator>
    <target>this:response</target>
  </instr>
</idoc>
© 2003,2004, 1060 Research Limited
1060 registered trademark, NetKernel trademark of 1060 Research Limited