You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by vg...@apache.org on 2003/06/01 17:49:05 UTC

cvs commit: cocoon-2.1/src/documentation/xdocs/userdocs/flow api.xml book.xml continuations.xml how-does-it-work.xml index.xml jpath.xml jxtemplate.xml sitemap.xml using.xml velocity.xml views.xml

vgritsenko    2003/06/01 08:49:05

  Modified:    src/documentation/xdocs/userdocs/flow api.xml book.xml
                        continuations.xml how-does-it-work.xml index.xml
                        jpath.xml jxtemplate.xml sitemap.xml using.xml
                        velocity.xml views.xml
  Log:
  Fix line endings
  
  Revision  Changes    Path
  1.11      +176 -176  cocoon-2.1/src/documentation/xdocs/userdocs/flow/api.xml
  
  Index: api.xml
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/documentation/xdocs/userdocs/flow/api.xml,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- api.xml	30 May 2003 23:05:32 -0000	1.10
  +++ api.xml	1 Jun 2003 15:49:04 -0000	1.11
  @@ -1,176 +1,176 @@
  -<?xml version="1.0" encoding="UTF-8"?>
  -<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "../../dtd/document-v10.dtd">
  -
  -<document>
  -  <header>
  -    <title>Advanced Control Flow</title>
  -    <authors>
  -      <person name="Ovidiu Predescu" email="ovidiu@apache.org"/>
  -      <person name="Christopher Oliver" email="coliver@apache.org"/>
  -    </authors>
  -  </header>
  -
  -  <body>
  -    <s1 title="JavaScript API">
  -	  <p>Cocoon provides a JavaScript API to manage control flow based on an
  -        <link href="http://cvs.cocoondev.org/cgi-bin/viewcvs.cgi/?cvsroot=rhino">extended</link>
  -        version of <link href="http://www.mozilla.org/rhino">Mozilla Rhino</link> that supports continuations.</p>
  -    </s1>
  -    <s1 title="Functions">
  -    <s2 title = "sendPage"><anchor id="sendPage"/>
  -      <p>
  -      <em>Function</em> <code>sendPage([String] uri, [Object] bean)</code>
  -      </p>
  -      <p>
  -      Passes control to the Cocoon sitemap to generate the output page.
  -      </p>
  -      <p>
  -      <code>uri</code> is the relative URL of the page to be sent back to the client.
  -      </p>
  -      <p>
  -       <code>bean</code> is a context object which can be accessed inside this page to extract
  -       various values and place them in the generated page.
  -      </p>
  -    </s2>
  -    <s2 title = "sendPageAndWait"><anchor id="sendPageAndWait"/>
  -    <p>
  -    <em>Function</em> <code>[WebContinuation] sendPageAndWait([String] uri, [Object] bean, [Number] timeToLive)</code>
  -    </p>
  -     <p>
  -     Passes control to the Cocoon sitemap to generate the output page.
  -     </p>
  -     <p>The flow script is suspended after the page is generated and the whole execution stack
  -        saved in the WebContinuation object returned from this function. </p>
  -     <p><code>uri</code> is the relative URL of the page to be sent back to the client.
  -        <code>bean</code> is a context object which can be accessed inside this page to extract
  -        various values and place them in the generated page.</p>
  -     <p><code>timeToLive</code> is the time to live in milliseconds for the continuation created.</p>
  -     <p>The return value is the <link href="#WebContinuation">continuation</link> object.</p>
  -    </s2>
  -  </s1>
  -    <s1 title="Objects">
  -    <s2 title = "cocoon">
  -    <p>The <code>cocoon</code> object represents the current Cocoon sitemap and provides the following readonly properties:</p> 
  -    <s3 title="request">
  -    <p>The current Cocoon request:</p>
  -    <p>
  -    <em>Property</em> <code>[</code><link href="../../../api/java/org/apache/cocoon/environment/Request.html"><code>org.apache.cocoon.environment.Request</code></link><code>] request</code>
  -    </p>
  -    </s3>
  -    <s3 title="response">
  -    <p>The current Cocoon response:</p>
  -    <p>
  -    <em>Property</em> <code>[</code><link href="../../../api/java/org/apache/cocoon/environment/Response.html"><code>org.apache.cocoon.environment.Response</code></link><code>] response</code>
  -    </p>
  -    </s3>
  -    <s3 title="session">
  -    <p>The current Cocoon session:</p>
  -    <p>
  -    <em>Property</em> <code>[</code><link href="../../../api/java/org/apache/cocoon/environment/Session.html"><code>org.apache.cocoon.environment.Session</code></link><code>] session</code>
  -    </p>
  -    </s3>
  -    <s3 title="context">
  -    <p>The current Cocoon application context:</p>
  -    <p>
  -    <em>Property</em> <code>[</code><link href="../../../api/java/org/apache/cocoon/environment/Context.html"><code>org.apache.cocoon.environment.Context</code></link><code>] context</code>
  -    </p>
  -    </s3>
  -    <s3 title="environment">
  -    <p>The current Cocoon environment:</p>
  -    <p>
  -    <em>Property</em> <code>[</code><link href="../../../api/java/org/apache/cocoon/environment/Environment.html"><code>org.apache.cocoon.environment.Environment</code></link><code>] environment</code>
  -    </p>
  -    </s3>
  -    <s3 title="componentManager">
  -    <p>The current Sitemap's component manager:</p>
  -    <p>
  -    <em>Property</em> <code>[org.apache.avalon.framework.component.ComponentManager] componentManager</code>
  -    </p>
  -    </s3>
  -    <s3 title="parameters">
  -    <p>Any parameters passed to the script by the Sitemap:</p>
  -    <p>
  -    <em>Property</em> <code>[Array [org.apache.avalon.framework.parameters.Parameters]] parameters</code>
  -    </p>
  -    <p>The <code>cocoon</code> object also provides the following functions:</p>
  -    </s3>
  -    <s3 title="process">
  -    <p>
  -    <em>Function</em> <code>[Boolean] process([String] uri, [Object] bizData, [java.io.OutputStream] stream)</code></p>
  -    <p>
  -     Call the Cocoon sitemap for the given URI, sending the output of the
  -     eventually matched pipeline to the specified <code>OutputStream</code>.</p>
  -    <p><code>uri</code> is the URI for which the request should be generated.</p>
  -    <p><code>bizData</code> is the business data object
  -     to be made available to the forwarded pipeline</p>
  -     <p><code>stream</code> is an <code>OutputStream</code> where the output should be written to.</p>
  -     <p>Returns the result from the Cocoon processor.
  -     </p>
  -    </s3>
  -    <s3 title="createSession"><anchor id="createSession"/>
  -      <p><em>Function</em> <code>createSession()</code></p>
  -      <p>
  -        Associate the current set of JavaScript global variables with the user's session. This means
  -        that all invocations from the sitemap of a JavaScript function (using the
  -        <link href="sitemap.html#callFunction">&lt;map:call function="..."&gt;</link>), will share
  -        global JavaScript variables.
  -      </p>
  -    </s3>
  -    <s3 title="removeSession">
  -    <p>
  -    <em>Function</em> <code>removeSession()</code>
  -    </p>
  -    <p>
  -       Dissociate global JavaScript variables from the user's session.
  -    </p>
  -    </s3>
  -    <s3 title="load">
  -    <p><em>Function</em> <code>load([String] uri)</code></p>
  -    <p>
  -      Load the JavaScript script specified by <code>uri</code>. The Cocoon
  -     source resolver is used to resolve <code>uri</code>. 
  -    </p>
  -    </s3>
  -    </s2>
  -    <s2 title="WebContinuation"><anchor id="WebContinuation"/>
  -    <p>A <code>WebContinuation</code> represents a continuation of a Flowscript. Because a user may click on the back button in the browser and restart a saved computation in a continuation, each <code>WebContinuation</code> becomes the parent of a subtree of continuations.
  -    </p>
  -    <p>
  -       If there is no parent <code>WebContinuation</code>, the created continuation becomes the root of a tree of <code>WebContinuation</code>s.
  -    </p>
  -    <p>
  -       <code>WebContinuation</code> objects support the following functions and properties:
  -    </p>
  -    <s3 title="getContinuation">
  -    <p>
  -        <em>Function</em> <code>[WebContinuation] getContinuation([Number] level)</code>
  -    </p>
  -    <p>
  -      Return the ancestor continuation situated <code>level</code>s
  -      above the current continuation. The current instance is
  -      considered to be at level 0. The parent continuation of the
  -      receiving instance at level 1, its parent is at level 2 relative
  -      to the receiving instance. If <code>level</code> is bigger than
  -      the depth of the tree, the root of the tree is returned.
  -    </p>
  -    </s3>
  -    <s3 title="invalidate">
  -    <p>
  -        <em>Function</em> <code>invalidate()</code>
  -    </p>
  -    <p>
  -      Invalidates a <code>WebContinuation</code>. This effectively
  -      means that the continuation object associated with it will no
  -      longer be accessible from Web pages. Invalidating a
  -      <code>WebContinuation</code> invalidates all the
  -      <code>WebContinuation</code>s which are children of it.    
  -    </p>
  -    </s3>
  -    <s3 title="id">
  -    <p><em>Property</em> <code>[String] id</code></p>
  -    <p>Returns the unique string identifier of this continuation</p>
  -    </s3>
  -    </s2>
  -    </s1>
  -  </body>
  -</document>
  +<?xml version="1.0" encoding="UTF-8"?>
  +<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "../../dtd/document-v10.dtd">
  +
  +<document>
  +  <header>
  +    <title>Advanced Control Flow</title>
  +    <authors>
  +      <person name="Ovidiu Predescu" email="ovidiu@apache.org"/>
  +      <person name="Christopher Oliver" email="coliver@apache.org"/>
  +    </authors>
  +  </header>
  +
  +  <body>
  +    <s1 title="JavaScript API">
  +	  <p>Cocoon provides a JavaScript API to manage control flow based on an
  +        <link href="http://cvs.cocoondev.org/cgi-bin/viewcvs.cgi/?cvsroot=rhino">extended</link>
  +        version of <link href="http://www.mozilla.org/rhino">Mozilla Rhino</link> that supports continuations.</p>
  +    </s1>
  +    <s1 title="Functions">
  +    <s2 title = "sendPage"><anchor id="sendPage"/>
  +      <p>
  +      <em>Function</em> <code>sendPage([String] uri, [Object] bean)</code>
  +      </p>
  +      <p>
  +      Passes control to the Cocoon sitemap to generate the output page.
  +      </p>
  +      <p>
  +      <code>uri</code> is the relative URL of the page to be sent back to the client.
  +      </p>
  +      <p>
  +       <code>bean</code> is a context object which can be accessed inside this page to extract
  +       various values and place them in the generated page.
  +      </p>
  +    </s2>
  +    <s2 title = "sendPageAndWait"><anchor id="sendPageAndWait"/>
  +    <p>
  +    <em>Function</em> <code>[WebContinuation] sendPageAndWait([String] uri, [Object] bean, [Number] timeToLive)</code>
  +    </p>
  +     <p>
  +     Passes control to the Cocoon sitemap to generate the output page.
  +     </p>
  +     <p>The flow script is suspended after the page is generated and the whole execution stack
  +        saved in the WebContinuation object returned from this function. </p>
  +     <p><code>uri</code> is the relative URL of the page to be sent back to the client.
  +        <code>bean</code> is a context object which can be accessed inside this page to extract
  +        various values and place them in the generated page.</p>
  +     <p><code>timeToLive</code> is the time to live in milliseconds for the continuation created.</p>
  +     <p>The return value is the <link href="#WebContinuation">continuation</link> object.</p>
  +    </s2>
  +  </s1>
  +    <s1 title="Objects">
  +    <s2 title = "cocoon">
  +    <p>The <code>cocoon</code> object represents the current Cocoon sitemap and provides the following readonly properties:</p> 
  +    <s3 title="request">
  +    <p>The current Cocoon request:</p>
  +    <p>
  +    <em>Property</em> <code>[</code><link href="../../../api/java/org/apache/cocoon/environment/Request.html"><code>org.apache.cocoon.environment.Request</code></link><code>] request</code>
  +    </p>
  +    </s3>
  +    <s3 title="response">
  +    <p>The current Cocoon response:</p>
  +    <p>
  +    <em>Property</em> <code>[</code><link href="../../../api/java/org/apache/cocoon/environment/Response.html"><code>org.apache.cocoon.environment.Response</code></link><code>] response</code>
  +    </p>
  +    </s3>
  +    <s3 title="session">
  +    <p>The current Cocoon session:</p>
  +    <p>
  +    <em>Property</em> <code>[</code><link href="../../../api/java/org/apache/cocoon/environment/Session.html"><code>org.apache.cocoon.environment.Session</code></link><code>] session</code>
  +    </p>
  +    </s3>
  +    <s3 title="context">
  +    <p>The current Cocoon application context:</p>
  +    <p>
  +    <em>Property</em> <code>[</code><link href="../../../api/java/org/apache/cocoon/environment/Context.html"><code>org.apache.cocoon.environment.Context</code></link><code>] context</code>
  +    </p>
  +    </s3>
  +    <s3 title="environment">
  +    <p>The current Cocoon environment:</p>
  +    <p>
  +    <em>Property</em> <code>[</code><link href="../../../api/java/org/apache/cocoon/environment/Environment.html"><code>org.apache.cocoon.environment.Environment</code></link><code>] environment</code>
  +    </p>
  +    </s3>
  +    <s3 title="componentManager">
  +    <p>The current Sitemap's component manager:</p>
  +    <p>
  +    <em>Property</em> <code>[org.apache.avalon.framework.component.ComponentManager] componentManager</code>
  +    </p>
  +    </s3>
  +    <s3 title="parameters">
  +    <p>Any parameters passed to the script by the Sitemap:</p>
  +    <p>
  +    <em>Property</em> <code>[Array [org.apache.avalon.framework.parameters.Parameters]] parameters</code>
  +    </p>
  +    <p>The <code>cocoon</code> object also provides the following functions:</p>
  +    </s3>
  +    <s3 title="process">
  +    <p>
  +    <em>Function</em> <code>[Boolean] process([String] uri, [Object] bizData, [java.io.OutputStream] stream)</code></p>
  +    <p>
  +     Call the Cocoon sitemap for the given URI, sending the output of the
  +     eventually matched pipeline to the specified <code>OutputStream</code>.</p>
  +    <p><code>uri</code> is the URI for which the request should be generated.</p>
  +    <p><code>bizData</code> is the business data object
  +     to be made available to the forwarded pipeline</p>
  +     <p><code>stream</code> is an <code>OutputStream</code> where the output should be written to.</p>
  +     <p>Returns the result from the Cocoon processor.
  +     </p>
  +    </s3>
  +    <s3 title="createSession"><anchor id="createSession"/>
  +      <p><em>Function</em> <code>createSession()</code></p>
  +      <p>
  +        Associate the current set of JavaScript global variables with the user's session. This means
  +        that all invocations from the sitemap of a JavaScript function (using the
  +        <link href="sitemap.html#callFunction">&lt;map:call function="..."&gt;</link>), will share
  +        global JavaScript variables.
  +      </p>
  +    </s3>
  +    <s3 title="removeSession">
  +    <p>
  +    <em>Function</em> <code>removeSession()</code>
  +    </p>
  +    <p>
  +       Dissociate global JavaScript variables from the user's session.
  +    </p>
  +    </s3>
  +    <s3 title="load">
  +    <p><em>Function</em> <code>load([String] uri)</code></p>
  +    <p>
  +      Load the JavaScript script specified by <code>uri</code>. The Cocoon
  +     source resolver is used to resolve <code>uri</code>. 
  +    </p>
  +    </s3>
  +    </s2>
  +    <s2 title="WebContinuation"><anchor id="WebContinuation"/>
  +    <p>A <code>WebContinuation</code> represents a continuation of a Flowscript. Because a user may click on the back button in the browser and restart a saved computation in a continuation, each <code>WebContinuation</code> becomes the parent of a subtree of continuations.
  +    </p>
  +    <p>
  +       If there is no parent <code>WebContinuation</code>, the created continuation becomes the root of a tree of <code>WebContinuation</code>s.
  +    </p>
  +    <p>
  +       <code>WebContinuation</code> objects support the following functions and properties:
  +    </p>
  +    <s3 title="getContinuation">
  +    <p>
  +        <em>Function</em> <code>[WebContinuation] getContinuation([Number] level)</code>
  +    </p>
  +    <p>
  +      Return the ancestor continuation situated <code>level</code>s
  +      above the current continuation. The current instance is
  +      considered to be at level 0. The parent continuation of the
  +      receiving instance at level 1, its parent is at level 2 relative
  +      to the receiving instance. If <code>level</code> is bigger than
  +      the depth of the tree, the root of the tree is returned.
  +    </p>
  +    </s3>
  +    <s3 title="invalidate">
  +    <p>
  +        <em>Function</em> <code>invalidate()</code>
  +    </p>
  +    <p>
  +      Invalidates a <code>WebContinuation</code>. This effectively
  +      means that the continuation object associated with it will no
  +      longer be accessible from Web pages. Invalidating a
  +      <code>WebContinuation</code> invalidates all the
  +      <code>WebContinuation</code>s which are children of it.    
  +    </p>
  +    </s3>
  +    <s3 title="id">
  +    <p><em>Property</em> <code>[String] id</code></p>
  +    <p>Returns the unique string identifier of this continuation</p>
  +    </s3>
  +    </s2>
  +    </s1>
  +  </body>
  +</document>
  
  
  
  1.5       +25 -25    cocoon-2.1/src/documentation/xdocs/userdocs/flow/book.xml
  
  Index: book.xml
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/documentation/xdocs/userdocs/flow/book.xml,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- book.xml	1 Jun 2003 03:35:36 -0000	1.4
  +++ book.xml	1 Jun 2003 15:49:04 -0000	1.5
  @@ -1,25 +1,25 @@
  -<?xml version="1.0" encoding="UTF-8"?>
  -<!DOCTYPE book PUBLIC "-//APACHE//DTD Cocoon Documentation Book V1.0//EN" "../../dtd/book-cocoon-v10.dtd">
  -
  -<book software="Apache Cocoon" 
  -      title="Apache Schecoon Documentation" 
  -      copyright="1999-2003 The Apache Software Foundation">
  -
  -  <menu label="Navigation">
  -    <menu-item label="Main" href="../../index.html"/>
  -    <menu-item label="User Documentation" href="../index.html"/>
  -  </menu>
  -  
  -  <menu label="Flowscript">
  -    <menu-item label="Introduction" href="index.html"/>
  -    <menu-item label="Continuations" href="continuations.html"/>
  -    <menu-item label="How does it work?" href="how-does-it-work.html"/>
  -    <menu-item label="Usage" href="using.html"/>
  -    <menu-item label="Sitemap" href="sitemap.html"/>
  -    <menu-item label="JavaScript API" href="api.html"/>
  -    <menu-item label="Generators" href="views.html"/>
  -    <menu-item label="JXTemplate" href="jxtemplate.html"/>
  -    <menu-item label="JPath" href="jpath.html"/>
  -    <menu-item label="Velocity" href="velocity.html"/>
  -  </menu>
  -</book>
  +<?xml version="1.0" encoding="UTF-8"?>
  +<!DOCTYPE book PUBLIC "-//APACHE//DTD Cocoon Documentation Book V1.0//EN" "../../dtd/book-cocoon-v10.dtd">
  +
  +<book software="Apache Cocoon" 
  +      title="Apache Schecoon Documentation" 
  +      copyright="1999-2003 The Apache Software Foundation">
  +
  +  <menu label="Navigation">
  +    <menu-item label="Main" href="../../index.html"/>
  +    <menu-item label="User Documentation" href="../index.html"/>
  +  </menu>
  +  
  +  <menu label="Flowscript">
  +    <menu-item label="Introduction" href="index.html"/>
  +    <menu-item label="Continuations" href="continuations.html"/>
  +    <menu-item label="How does it work?" href="how-does-it-work.html"/>
  +    <menu-item label="Usage" href="using.html"/>
  +    <menu-item label="Sitemap" href="sitemap.html"/>
  +    <menu-item label="JavaScript API" href="api.html"/>
  +    <menu-item label="Generators" href="views.html"/>
  +    <menu-item label="JXTemplate" href="jxtemplate.html"/>
  +    <menu-item label="JPath" href="jpath.html"/>
  +    <menu-item label="Velocity" href="velocity.html"/>
  +  </menu>
  +</book>
  
  
  
  1.5       +115 -115  cocoon-2.1/src/documentation/xdocs/userdocs/flow/continuations.xml
  
  Index: continuations.xml
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/documentation/xdocs/userdocs/flow/continuations.xml,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- continuations.xml	1 Jun 2003 03:35:36 -0000	1.4
  +++ continuations.xml	1 Jun 2003 15:49:04 -0000	1.5
  @@ -1,115 +1,115 @@
  -<?xml version="1.0" encoding="UTF-8"?>
  -<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "../../dtd/document-v10.dtd">
  -
  -<document>
  -  <header>
  -    <title>Advanced Control Flow</title>
  -    <authors>
  -      <person name="Ovidiu Predescu" email="ovidiu@apache.org"/>
  -    </authors>
  -  </header>
  -
  -  <body>
  -    <s1 title="A different approach">
  -      <p>Web applications are essentially event-driven
  -      applications. Such applications have to react to events
  -      generated from the client browser, and they respond to these
  -      perhaps by changing their internal state and generating a
  -      response.</p>
  -
  -      <p>The result is that even a simple application that needs to
  -      collect some information from the user using more than one page,
  -      has to somehow maintain the input accumulated so far from the
  -      user. This input is a characteristic of the application
  -      state. Another characteristic of the application state is where
  -      the program processing is.</p>
  -
  -      <p>Let's look at an example. Suppose we want to write a very
  -      simple calculator, which collects the numbers to be added, as
  -      well as the operator, each in a separate page. It would be very
  -      nice if we could write something like this:</p>
  -
  -      <source><![CDATA[
  -function calculator()
  -{
  -  var a, b, operator;
  -
  -  sendPageAndWait("getA.html");
  -  a = cocoon.request.get("a");
  -
  -  sendPageAndWait("getB.html");
  -  b = cocoon.request.get("b");
  -
  -  sendPageAndWait("getOperator.html");
  -  operator = cocoon.request.get("op");
  -
  -  try {
  -    if (operator == "plus")
  -      sendPage("result.html", {result: a + b});
  -    else if (operator == "minus")
  -      sendPage("result.html", {result: a - b});
  -    else if (operator == "multiply")
  -      sendPage("result.html", {result: a * b});
  -    else if (operator == "divide")
  -      sendPage("result.html", {result: a / b});
  -    else
  -      sendPage("invalidOperator.html", {operator: operator});
  -  }
  -  catch (exception) {
  -    sendPage("error.html", {message: "Operation failed: " + exception.toString()});
  -  }
  -}
  -]]></source>
  -
  -      <p>In this example, the <code>calculator</code> function is
  -      called to start the calculator application. We'd like the
  -      <code>sendPageAndWait</code> function to be a special function, that
  -      takes as arguments an HTML file to be sent as response, and some
  -      optional data that needs to be placed dynamically in it. We
  -      would like <code>sendPageAndWait</code> to send the response page and
  -      then block the executing thread, until the user clicks on a link
  -      in the response page, which sends a request back to the
  -      server. This request resumes the processing at the point it was
  -      left, right after the call to <code>sendPageAndWait</code>.</p>
  -
  -      <p>This approach looks very powerful, since the flow of pages
  -      within the application can be described as a normal
  -      program. Using this approach you no longer have to think of your
  -      Web application as a finite state machine, which transitions
  -      from one state to another, and in the process generates response
  -      pages.</p>
  -
  -      <p>A big disadvantage of the approach above is that we need to
  -      maintain a thread alive until the user hits the link on the
  -      response page. This is clearly very expensive!</p>
  -
  -      <p>It would be very nice if we could capture the state of the
  -      application, its stack of function calls, which includes local
  -      variables, the global variables and the program counter, and
  -      save them into an object. If this object would give us the
  -      ability to restart the processing from the point stored in it,
  -      this would be what we need!</p>
  -
  -      <s2 title="What are continuations?">
  -
  -	<p>A continuation is exactly the type of object that we need.
  -	Think of a continuation as an object that, for a given point
  -	in your program, contains a snapshot of the stack trace,
  -	including all the local variables, and the program
  -	counter. You can not only store these things in the
  -	continuation object, but also restore the execution of the
  -	program from a continuation object. This means that the stack
  -	trace and the program counter of the running program become
  -	the ones stored in a continuation.</p>
  -
  -	<p>Continuations are powerful concepts from the world of
  -	functional languages, like <link
  -	href="http://www.schemers.org/">Scheme</link>, but they are
  -	becoming popular in other languages as well.</p>
  -
  -    </s2>
  -
  -  </s1>
  -
  -  </body>
  -</document>
  +<?xml version="1.0" encoding="UTF-8"?>
  +<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "../../dtd/document-v10.dtd">
  +
  +<document>
  +  <header>
  +    <title>Advanced Control Flow</title>
  +    <authors>
  +      <person name="Ovidiu Predescu" email="ovidiu@apache.org"/>
  +    </authors>
  +  </header>
  +
  +  <body>
  +    <s1 title="A different approach">
  +      <p>Web applications are essentially event-driven
  +      applications. Such applications have to react to events
  +      generated from the client browser, and they respond to these
  +      perhaps by changing their internal state and generating a
  +      response.</p>
  +
  +      <p>The result is that even a simple application that needs to
  +      collect some information from the user using more than one page,
  +      has to somehow maintain the input accumulated so far from the
  +      user. This input is a characteristic of the application
  +      state. Another characteristic of the application state is where
  +      the program processing is.</p>
  +
  +      <p>Let's look at an example. Suppose we want to write a very
  +      simple calculator, which collects the numbers to be added, as
  +      well as the operator, each in a separate page. It would be very
  +      nice if we could write something like this:</p>
  +
  +      <source><![CDATA[
  +function calculator()
  +{
  +  var a, b, operator;
  +
  +  sendPageAndWait("getA.html");
  +  a = cocoon.request.get("a");
  +
  +  sendPageAndWait("getB.html");
  +  b = cocoon.request.get("b");
  +
  +  sendPageAndWait("getOperator.html");
  +  operator = cocoon.request.get("op");
  +
  +  try {
  +    if (operator == "plus")
  +      sendPage("result.html", {result: a + b});
  +    else if (operator == "minus")
  +      sendPage("result.html", {result: a - b});
  +    else if (operator == "multiply")
  +      sendPage("result.html", {result: a * b});
  +    else if (operator == "divide")
  +      sendPage("result.html", {result: a / b});
  +    else
  +      sendPage("invalidOperator.html", {operator: operator});
  +  }
  +  catch (exception) {
  +    sendPage("error.html", {message: "Operation failed: " + exception.toString()});
  +  }
  +}
  +]]></source>
  +
  +      <p>In this example, the <code>calculator</code> function is
  +      called to start the calculator application. We'd like the
  +      <code>sendPageAndWait</code> function to be a special function, that
  +      takes as arguments an HTML file to be sent as response, and some
  +      optional data that needs to be placed dynamically in it. We
  +      would like <code>sendPageAndWait</code> to send the response page and
  +      then block the executing thread, until the user clicks on a link
  +      in the response page, which sends a request back to the
  +      server. This request resumes the processing at the point it was
  +      left, right after the call to <code>sendPageAndWait</code>.</p>
  +
  +      <p>This approach looks very powerful, since the flow of pages
  +      within the application can be described as a normal
  +      program. Using this approach you no longer have to think of your
  +      Web application as a finite state machine, which transitions
  +      from one state to another, and in the process generates response
  +      pages.</p>
  +
  +      <p>A big disadvantage of the approach above is that we need to
  +      maintain a thread alive until the user hits the link on the
  +      response page. This is clearly very expensive!</p>
  +
  +      <p>It would be very nice if we could capture the state of the
  +      application, its stack of function calls, which includes local
  +      variables, the global variables and the program counter, and
  +      save them into an object. If this object would give us the
  +      ability to restart the processing from the point stored in it,
  +      this would be what we need!</p>
  +
  +      <s2 title="What are continuations?">
  +
  +	<p>A continuation is exactly the type of object that we need.
  +	Think of a continuation as an object that, for a given point
  +	in your program, contains a snapshot of the stack trace,
  +	including all the local variables, and the program
  +	counter. You can not only store these things in the
  +	continuation object, but also restore the execution of the
  +	program from a continuation object. This means that the stack
  +	trace and the program counter of the running program become
  +	the ones stored in a continuation.</p>
  +
  +	<p>Continuations are powerful concepts from the world of
  +	functional languages, like <link
  +	href="http://www.schemers.org/">Scheme</link>, but they are
  +	becoming popular in other languages as well.</p>
  +
  +    </s2>
  +
  +  </s1>
  +
  +  </body>
  +</document>
  
  
  
  1.5       +41 -41    cocoon-2.1/src/documentation/xdocs/userdocs/flow/how-does-it-work.xml
  
  Index: how-does-it-work.xml
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/documentation/xdocs/userdocs/flow/how-does-it-work.xml,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- how-does-it-work.xml	1 Jun 2003 03:35:36 -0000	1.4
  +++ how-does-it-work.xml	1 Jun 2003 15:49:04 -0000	1.5
  @@ -1,41 +1,41 @@
  -<?xml version="1.0" encoding="UTF-8"?>
  -<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "../../dtd/document-v10.dtd">
  -
  -<document>
  -  <header>
  -    <title>Advanced Control Flow</title>
  -    <authors>
  -      <person name="Ovidiu Predescu" email="ovidiu@apache.org"/>
  -    </authors>
  -  </header>
  -
  -  <body>
  -    <s1 title="Cocoon and continuations">
  -	<p>With continuations in the language, you can essentially
  -	store the continuation of <code>sendPageAndWait</code> (think of all
  -	the stack trace, and the program counter), put it in a global
  -	hash table associated with an id. The id is then encoded in
  -	the <code>response.xml</code> page as an URL. When the user
  -	clicks on that URL, on the server side the associated
  -	continuation is resumed. Resuming the processing happens as if
  -	nothing was stopped, you get all the stack trace back, and all
  -	the local variables.</p>
  -
  -	<p>So instead of using beans to store things in session, you
  -	use normal variables in a program. Since each user has its own
  -	version of the program, all the local variables in the program
  -	are separate between users.</p>
  -
  -	<p>With this approach clicking the <em>Back</em> button in the
  -	browser is no longer a hassle to deal with for you as a
  -	server-side programmer. They will simply refer to past
  -	continuations objects, which have their own state of the local
  -	variables.</p>
  -
  -	<p>Since continuations are objects, you can also store them in
  -	a database, for really long-lived session, just like you do
  -	with session beans.</p>
  -  </s1>
  -
  -  </body>
  -</document>
  +<?xml version="1.0" encoding="UTF-8"?>
  +<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "../../dtd/document-v10.dtd">
  +
  +<document>
  +  <header>
  +    <title>Advanced Control Flow</title>
  +    <authors>
  +      <person name="Ovidiu Predescu" email="ovidiu@apache.org"/>
  +    </authors>
  +  </header>
  +
  +  <body>
  +    <s1 title="Cocoon and continuations">
  +	<p>With continuations in the language, you can essentially
  +	store the continuation of <code>sendPageAndWait</code> (think of all
  +	the stack trace, and the program counter), put it in a global
  +	hash table associated with an id. The id is then encoded in
  +	the <code>response.xml</code> page as an URL. When the user
  +	clicks on that URL, on the server side the associated
  +	continuation is resumed. Resuming the processing happens as if
  +	nothing was stopped, you get all the stack trace back, and all
  +	the local variables.</p>
  +
  +	<p>So instead of using beans to store things in session, you
  +	use normal variables in a program. Since each user has its own
  +	version of the program, all the local variables in the program
  +	are separate between users.</p>
  +
  +	<p>With this approach clicking the <em>Back</em> button in the
  +	browser is no longer a hassle to deal with for you as a
  +	server-side programmer. They will simply refer to past
  +	continuations objects, which have their own state of the local
  +	variables.</p>
  +
  +	<p>Since continuations are objects, you can also store them in
  +	a database, for really long-lived session, just like you do
  +	with session beans.</p>
  +  </s1>
  +
  +  </body>
  +</document>
  
  
  
  1.5       +45 -45    cocoon-2.1/src/documentation/xdocs/userdocs/flow/index.xml
  
  Index: index.xml
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/documentation/xdocs/userdocs/flow/index.xml,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- index.xml	1 Jun 2003 03:35:36 -0000	1.4
  +++ index.xml	1 Jun 2003 15:49:04 -0000	1.5
  @@ -1,45 +1,45 @@
  -<?xml version="1.0" encoding="UTF-8"?>
  -<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "../../dtd/document-v10.dtd">
  -
  -<document>
  -  <header>
  -    <title>Apache Cocoon - Control Flow</title>
  -    <authors>
  -      <person name="Ovidiu Predescu" email="ovidiu@apache.org"/>
  -    </authors>
  -  </header>
  -  <body>
  -    <s1 title="Control flow">
  -      <p>Cocoon has advanced control flow, the ability to describe the
  -      order of Web pages that have to be sent to the client, at any
  -      given point in time in an application.</p>
  -
  -      <p>Traditional Web applications try to model the control flow of
  -      a Web application by modeling the application as a finite state
  -      machine (FSM). In this model, the Web application is composed of
  -      multiple states, but the application can be only in one state at
  -      a time. Any request received by the application transitions it
  -      into a different state. During such a transition, the application
  -      may perform various side-effects, such as updating objects
  -      either in memory or in a database. Another important side-effect
  -      of such a transition is that a Web page is sent back to the
  -      client browser.</p>
  -
  -      <p>For simple Web applications, this model works fine. However,
  -      as the application grows, the number of states and transitions
  -      between them grows as well, and it becomes hard to visualize
  -      what's happening in the application.</p>
  -
  -      <p>Moreover, the interactions in some applications are more
  -      complex than a simple finite state machine. In such cases it's
  -      much easier to think of and implement the application as a program,
  -      rather than a FSM.</p>
  -
  -      <p>By using a high level programming concept called
  -      <em>continuations</em>, Cocoon tries to solve this problem, and
  -      promises to allow the control flow in Web applications to be
  -      modeled as a normal program.</p>
  -
  -    </s1>
  -  </body>
  -</document>
  +<?xml version="1.0" encoding="UTF-8"?>
  +<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "../../dtd/document-v10.dtd">
  +
  +<document>
  +  <header>
  +    <title>Apache Cocoon - Control Flow</title>
  +    <authors>
  +      <person name="Ovidiu Predescu" email="ovidiu@apache.org"/>
  +    </authors>
  +  </header>
  +  <body>
  +    <s1 title="Control flow">
  +      <p>Cocoon has advanced control flow, the ability to describe the
  +      order of Web pages that have to be sent to the client, at any
  +      given point in time in an application.</p>
  +
  +      <p>Traditional Web applications try to model the control flow of
  +      a Web application by modeling the application as a finite state
  +      machine (FSM). In this model, the Web application is composed of
  +      multiple states, but the application can be only in one state at
  +      a time. Any request received by the application transitions it
  +      into a different state. During such a transition, the application
  +      may perform various side-effects, such as updating objects
  +      either in memory or in a database. Another important side-effect
  +      of such a transition is that a Web page is sent back to the
  +      client browser.</p>
  +
  +      <p>For simple Web applications, this model works fine. However,
  +      as the application grows, the number of states and transitions
  +      between them grows as well, and it becomes hard to visualize
  +      what's happening in the application.</p>
  +
  +      <p>Moreover, the interactions in some applications are more
  +      complex than a simple finite state machine. In such cases it's
  +      much easier to think of and implement the application as a program,
  +      rather than a FSM.</p>
  +
  +      <p>By using a high level programming concept called
  +      <em>continuations</em>, Cocoon tries to solve this problem, and
  +      promises to allow the control flow in Web applications to be
  +      modeled as a normal program.</p>
  +
  +    </s1>
  +  </body>
  +</document>
  
  
  
  1.10      +111 -111  cocoon-2.1/src/documentation/xdocs/userdocs/flow/jpath.xml
  
  Index: jpath.xml
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/documentation/xdocs/userdocs/flow/jpath.xml,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- jpath.xml	30 May 2003 23:05:32 -0000	1.9
  +++ jpath.xml	1 Jun 2003 15:49:04 -0000	1.10
  @@ -1,111 +1,111 @@
  -<?xml version='1.0' encoding='ISO-8859-1'?>
  -<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "../../dtd/document-v10.dtd">
  -<document>
  -  <header>
  -   <title>Advanced Control Flow</title> 
  -   <authors>
  -    <person name="Christopher Oliver" email="coliver@apache.org"/>
  -    <person name="Ovidiu Predescu" email="ovidiu@apache.org"/>
  -   </authors>
  -  </header>
  -  <body>
  -   <s1 title="JPath Logic Sheet">
  -    <p>
  -     The JPath Logic Sheet is an <link href="../xsp/index.html">XSP</link> logic sheet that allows
  -     you to access data from a Cocoon Flowscript in an XSP page and inject it into a Cocoon
  -     pipeline. It provides a set of tags (similar to the those defined by
  -     <link href="http://www.w3.org/TR/xslt">XSLT</link>) that allow you to iterate over Java
  -     collections (and Java or JavaScript arrays) and to test for the presence of optional or
  -     alternate bean properties. It is based on
  -     <link href="http://jakarta.apache.org/commons/jxpath">Apache JXPath</link>.
  -    </p>
  -   </s1>
  -   <s1 title ="Tags">
  -    <p>The JPath tags are defined in the namespace</p>
  -    <source>http://apache.org/xsp/jpath/1.0</source>
  -    <s2 title ="if">
  -     <p>The <code>if</code> tag allows the conditional execution of its body according to value of
  -        a <code>test</code> attribute:</p>
  -     <source>
  -&lt;if test="XPathExpression"&gt;
  -  body
  -&lt;/if&gt;
  -     </source>
  -     <p>Example:</p>
  -     <source>
  -&lt;jpath:if test="cart/numberOfItems = 0"&gt;
  -  Your cart is empty
  -&lt;/jpath:if&gt;
  -     </source>
  -    </s2>
  -    <s2 title ="choose">
  -     <p>The <code>choose</code> tag performs conditional block execution by the embedded
  -        <code>when</code> sub tags. It renders the body of the first <code>when</code> tag whose
  -        <code>test</code> condition evaluates to true. If none of the <code>test</code> conditions
  -        of nested <code>when</code> tags evaluate to <code>true</code>, then the body of an
  -        <code>otherwise</code> tag is evaluated, if present:</p>
  -     <source>
  -&lt;choose&gt;
  -  &lt;when test="XPathExpression"&gt;
  -    body
  -  &lt;/when&gt;
  -  &lt;otherwise&gt;
  -    body
  -  &lt;/otherwise&gt;?
  -&lt;/choose&gt;
  -     </source>
  -     <p>Example:</p>
  -     <source>
  -&lt;choose&gt;
  -  &lt;when test="not(user/loggedIn)"&gt;
  -     You're not logged in
  -  &lt;/when&gt;
  -  &lt;otherwise&gt;
  -     You're already logged in
  -  &lt;/otherwise&gt;
  -&lt;/choose&gt;
  -     </source>
  -    </s2>
  -    <s2 title="value-of">
  -     <p>The <code>value-of</code> tag evaluates an expression and outputs the result of the evaluation:</p>
  -     <source>
  -&lt;value-of select="XPathExpression"/&gt;
  -     </source>
  -     <p>Example:</p>
  -     <source>
  -&lt;value-of select="cart/numberOfItems"&gt;
  -     </source>
  -    </s2>
  -    <s2 title="for-each">
  -     <p>The <code>for-each</code> tag allows you to iterate over a collection of objects:</p>
  -     <source>
  -&lt;for-each select="XPathExpression"&gt;
  -  body
  -&lt;/for-each&gt;
  -     </source>
  -     <p>When using XPath expressions within <code>for-each</code> the current element is the
  -        context node and can be referenced with XPath dot operator:</p>
  -     <source>.</source>
  -     <p>Example:</p>
  -     <source>
  -&lt;for-each select="cart/cartItems[position() &lt;= $count]"&gt;
  -   &lt;td&gt;&lt;value-of select="./productId"&gt;&lt;/td&gt;
  -&lt;/for-each&gt;
  -     </source>
  -    </s2>
  -    <s2 title="continuation">
  -     <p>The <code>continuation</code> tag returns the id of the current web continuation of your
  -        Flowscript. You can refer to previous continuations by supplying the optional
  -        <code>level</code> attribute. Zero is the current level, <code>-1</code> refers to the
  -        previous continuation, and so on.</p>
  -     <source>
  -&lt;continuation [level="Number"]/&gt;
  -     </source>
  -     <p>Example:</p>
  -     <source>
  -&lt;xsp:attribute name="action"&gt;&lt;xsp:expr&gt;&lt;jpath:continuation/&gt;+".form"&lt;/xsp:expr&gt;&lt;/xsp:attribute&gt;
  -     </source>
  -    </s2>
  -   </s1>
  -  </body>
  -</document>
  +<?xml version='1.0' encoding='ISO-8859-1'?>
  +<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "../../dtd/document-v10.dtd">
  +<document>
  +  <header>
  +   <title>Advanced Control Flow</title> 
  +   <authors>
  +    <person name="Christopher Oliver" email="coliver@apache.org"/>
  +    <person name="Ovidiu Predescu" email="ovidiu@apache.org"/>
  +   </authors>
  +  </header>
  +  <body>
  +   <s1 title="JPath Logic Sheet">
  +    <p>
  +     The JPath Logic Sheet is an <link href="../xsp/index.html">XSP</link> logic sheet that allows
  +     you to access data from a Cocoon Flowscript in an XSP page and inject it into a Cocoon
  +     pipeline. It provides a set of tags (similar to the those defined by
  +     <link href="http://www.w3.org/TR/xslt">XSLT</link>) that allow you to iterate over Java
  +     collections (and Java or JavaScript arrays) and to test for the presence of optional or
  +     alternate bean properties. It is based on
  +     <link href="http://jakarta.apache.org/commons/jxpath">Apache JXPath</link>.
  +    </p>
  +   </s1>
  +   <s1 title ="Tags">
  +    <p>The JPath tags are defined in the namespace</p>
  +    <source>http://apache.org/xsp/jpath/1.0</source>
  +    <s2 title ="if">
  +     <p>The <code>if</code> tag allows the conditional execution of its body according to value of
  +        a <code>test</code> attribute:</p>
  +     <source>
  +&lt;if test="XPathExpression"&gt;
  +  body
  +&lt;/if&gt;
  +     </source>
  +     <p>Example:</p>
  +     <source>
  +&lt;jpath:if test="cart/numberOfItems = 0"&gt;
  +  Your cart is empty
  +&lt;/jpath:if&gt;
  +     </source>
  +    </s2>
  +    <s2 title ="choose">
  +     <p>The <code>choose</code> tag performs conditional block execution by the embedded
  +        <code>when</code> sub tags. It renders the body of the first <code>when</code> tag whose
  +        <code>test</code> condition evaluates to true. If none of the <code>test</code> conditions
  +        of nested <code>when</code> tags evaluate to <code>true</code>, then the body of an
  +        <code>otherwise</code> tag is evaluated, if present:</p>
  +     <source>
  +&lt;choose&gt;
  +  &lt;when test="XPathExpression"&gt;
  +    body
  +  &lt;/when&gt;
  +  &lt;otherwise&gt;
  +    body
  +  &lt;/otherwise&gt;?
  +&lt;/choose&gt;
  +     </source>
  +     <p>Example:</p>
  +     <source>
  +&lt;choose&gt;
  +  &lt;when test="not(user/loggedIn)"&gt;
  +     You're not logged in
  +  &lt;/when&gt;
  +  &lt;otherwise&gt;
  +     You're already logged in
  +  &lt;/otherwise&gt;
  +&lt;/choose&gt;
  +     </source>
  +    </s2>
  +    <s2 title="value-of">
  +     <p>The <code>value-of</code> tag evaluates an expression and outputs the result of the evaluation:</p>
  +     <source>
  +&lt;value-of select="XPathExpression"/&gt;
  +     </source>
  +     <p>Example:</p>
  +     <source>
  +&lt;value-of select="cart/numberOfItems"&gt;
  +     </source>
  +    </s2>
  +    <s2 title="for-each">
  +     <p>The <code>for-each</code> tag allows you to iterate over a collection of objects:</p>
  +     <source>
  +&lt;for-each select="XPathExpression"&gt;
  +  body
  +&lt;/for-each&gt;
  +     </source>
  +     <p>When using XPath expressions within <code>for-each</code> the current element is the
  +        context node and can be referenced with XPath dot operator:</p>
  +     <source>.</source>
  +     <p>Example:</p>
  +     <source>
  +&lt;for-each select="cart/cartItems[position() &lt;= $count]"&gt;
  +   &lt;td&gt;&lt;value-of select="./productId"&gt;&lt;/td&gt;
  +&lt;/for-each&gt;
  +     </source>
  +    </s2>
  +    <s2 title="continuation">
  +     <p>The <code>continuation</code> tag returns the id of the current web continuation of your
  +        Flowscript. You can refer to previous continuations by supplying the optional
  +        <code>level</code> attribute. Zero is the current level, <code>-1</code> refers to the
  +        previous continuation, and so on.</p>
  +     <source>
  +&lt;continuation [level="Number"]/&gt;
  +     </source>
  +     <p>Example:</p>
  +     <source>
  +&lt;xsp:attribute name="action"&gt;&lt;xsp:expr&gt;&lt;jpath:continuation/&gt;+".form"&lt;/xsp:expr&gt;&lt;/xsp:attribute&gt;
  +     </source>
  +    </s2>
  +   </s1>
  +  </body>
  +</document>
  
  
  
  1.9       +275 -275  cocoon-2.1/src/documentation/xdocs/userdocs/flow/jxtemplate.xml
  
  Index: jxtemplate.xml
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/documentation/xdocs/userdocs/flow/jxtemplate.xml,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- jxtemplate.xml	1 Jun 2003 03:35:36 -0000	1.8
  +++ jxtemplate.xml	1 Jun 2003 15:49:04 -0000	1.9
  @@ -1,275 +1,275 @@
  -<?xml version='1.0' encoding='ISO-8859-1'?>
  -<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN"
  -"../../dtd/document-v10.dtd">
  -<document>
  -	<header>
  -		<title>Advanced Control Flow</title> 
  -		<authors>
  -			<person name="Christopher Oliver" email="coliver@apache.org" />
  -		</authors>
  -	</header>
  -<body>
  -	<s1 title="JXTemplate Generator">
  -  <p>
  -The JXTemplate Generator is a page template processor that allows you to inject data from Java and JavaScript objects passed by a Cocoon Flowscript into a Cocoon pipeline. It provides a set of tags (similar to the <link href="http://java.sun.com/products/jsp/jstl/">JSTL</link> core tags) that allow you to iterate over Java collections (and Java or JavaScript arrays) and to test for the presence of optional or alternate bean properties, as well as embedded expressions to specify conditions and to access the properties of objects. The <em>JX</em>Template Generator gets its name from the embedded expression languages it supports, namely <link href="http://jakarta.apache.org/commons/jxpath">Apache <em>JX</em>Path</link> and <link href="http://jakarta.apache.org/commons/jexl">Apache <em>J</em>e<em>X</em>l</link>. 
  -  </p>
  -<p>To use the JXTemplate Generator, add a generator entry to your sitemap with the <code>src</code> attribute set to <code>org.apache.cocoon.generation.JXTemplateGenerator</code>, for example like this:</p>
  -<source>
  -&lt;map:generators&gt;
  -  &lt;map:generator label="content,data" 
  -      logger="sitemap.generator.jx" name="jx" 
  -         src="org.apache.cocoon.generation.JXTemplateGenerator"/&gt;
  -&lt;/map:generators&gt;
  -</source>
  -         </s1>
  -         <s1 title="Expression Languages">
  -  <p>
  -The JXTemplate Generator supports two embedded expression languages: <link href="http://jakarta.apache.org/commons/jexl">Jexl</link> and <link href="http://jakarta.apache.org/commons/jxpath">JXPath</link>. Apache <link href="http://jakarta.apache.org/commons/jexl">Jexl</link> provides an extended version of the expression language of the <link href="http://java.sun.com/webservices/docs/1.0/tutorial/doc/JSTL.html">JSTL</link>. Apache <link href="http://jakarta.apache.org/commons/jxpath">JXPath</link> provides an interpreter of the <link href="http://www.w3.org/TR/xpath">XPath</link> expression language that can apply XPath expressions to graphs of Java objects of all kinds: JavaBeans, Maps, Servlet contexts, DOM etc, including mixtures thereof.
  - </p>
  -  <p>
  - Having an embedded expression language allows a page author to access an object using a simple syntax such as
  - </p>
  -<source>
  - &lt;site signOn="${accountForm.signOn}"&gt;
  - </source>
  -<p>Embedded Jexl expressions are contained in <code>${}</code>.</p>
  -<p>Embedded JXPath expressions are contained in <code>#{}</code>.</p>
  -<p>The referenced objects may be Java Beans, DOM, JDOM, or JavaScript objects 
  -from a Flowscript. In addition the following implicit objects are available as
  -both JXPath and Jexl variables in a template:</p>
  -<dl>
  -<dt><link href="../../../api/java/org/apache/cocoon/environment/Request.html"><code>org.apache.cocoon.environment.Request</code></link><code> request</code></dt>
  -<dd><br/>The current Cocoon request<br/></dd>
  - 
  -<dt><br/><link href="../../../api/java/org/apache/cocoon/environment/Response.html"><code>org.apache.cocoon.environment.Response</code></link><code> response</code></dt>
  -<dd><br/>The Cocoon response associated with the current request<br/></dd>
  - 
  -<dt><br/><link href="../../../api/java/org/apache/cocoon/environment/Session.html"><code>org.apache.cocoon.environment.Session</code></link><code> session</code></dt>
  -<dd><br/>The Cocoon session associated with the current request<br/></dd>
  - 
  -<dt><br/><link href="../../../api/java/org/apache/cocoon/environment/Context.html"><code>org.apache.cocoon.environment.Context</code></link><code> context</code></dt>
  -<dd><br/>The Cocoon context associated with the current request<br/></dd>
  - 
  -<dt><br/><code>org.apache.avalon.framework.parameter.Parameter[]</code><code> parameters</code></dt>
  -<dd><br/>Any parameters passed to the generator in the pipeline<br/></dd>
  -</dl>
  -<p>
  -Jexl Example:</p>
  -<source>
  -  The content type of the current request is ${request.contentType}
  -</source>
  -<p>
  -JXPath Example:</p>
  -<source>
  -  The content type of the current request is #{$request/contentType}
  -</source>
  -<p> 
  -The current Web Continuation from the Flowscript 
  -is also available as a variable named <code>continuation</code>. You would 
  -typically access its <code>id</code>:</p>
  -<source>
  -   &lt;form action="${continuation.id}"&gt;
  -</source>
  -<p>You can also reach previous continuations by using the <code>getContinuation()</code> function:</p>
  -<source>
  -    &lt;form action="${continuation.getContinuation(1).id}" >
  -</source>
  -<p>or using an XPath expression:</p>
  -<source>
  -    &lt;form action="#{getContinuation($continuation)/id}" >
  -</source>
  -</s1>
  -<s1 title ="Tags">
  -<p>The JXTemplate Generator tags are defined in the namespace</p>
  -<source>
  -http://apache.org/cocoon/templates/jx/1.0
  -</source>
  -<s2 title ="template">
  -<p>The <code>template</code> tag defines a new template:</p><source>
  -   &lt;t:template xmlns:t="http://apache.org/cocoon/templates/jx/1.0"&gt;
  -       body
  -   &lt;/t:template&gt;
  -</source>
  -</s2>
  -<s2 title ="import"/>
  -<p>The <code>import</code> tag allows you to include another template within the current template. The content of the imported template is compiled and will be executed in place of the <code>import</code> tag:</p><source>
  -   &lt;import uri="URI" [context="Expression"]/&gt;
  -</source><p>The Cocoon source resolver is used to resolve <code>uri</code>. If <code>context</code> is present, then its value is used as the context for evaluating the imported template, otherwise the current context is used.</p>
  -<s2 title ="set">
  -<p>The <code>set</code> tag creates a local alias of an object. The <code>var</code> attribute specifies the name of a variable to assign the object to. The <code>value</code> attribute specifies the object (defaults to <code>body</code> if not present):</p><source>
  -   &lt;set var="Name" [value="Value"]&gt;
  -       [body]
  -   &lt;/set&gt;
  -</source><p>If used within a <code>macro</code> definition (see below) variables created by <code>set</code> are only visible within the body of the <code>macro</code>.</p>
  -<p>Jexl Example:</p>
  -<source>
  -&lt;set var="greeting" value="Hello ${user}"/&gt;
  -The value of greeting is ${greeting}
  -</source>
  -<p>JXPath Example:</p>
  -<source>
  -&lt;set var="greeting" value="Hello #{user}"/&gt;
  -The value of greeting is #{$greeting}
  -</source>
  -</s2>
  -<s2 title ="if">
  -<p>The <code>if</code> tag allows the conditional execution of its body 
  -according to value of its <code>test</code> attribute:</p>
  -<source>
  -  &lt;if test="Expression"&gt;
  -      body
  -  &lt;/if&gt;
  -</source>
  -<p>Jexl Example:</p>
  -<source>
  -&lt;if test="${cart.numberOfItems == 0}"&gt;
  -  Your cart is empty
  -&lt;/if&gt;
  -</source>
  -<p>JXPath Example:</p>
  -<source>
  -&lt;if test="#{cart/numberOfItems = 0}"&gt;
  -  Your cart is empty
  -&lt;/if&gt;
  -</source>
  -</s2>
  -<s2 title ="choose">
  -<p>The <code>choose</code> tag performs conditional block execution by the 
  -embedded <code>when</code> sub tags. It renders the body of the first 
  -<code>when</code> tag whose <code>test</code> condition evaluates to true. 
  -If none of the <code>test</code> conditions of nested <code>when</code> tags
  -evaluate to <code>true</code>, then the body of its <code>otherwise</code> 
  -tag is evaluated, if present:</p>
  -<source>
  - &lt;choose&gt;
  -   &lt;when test="Expression"&gt;
  -      body
  -   &lt;/when&gt;+
  -   &lt;otherwise&gt;
  -      body
  -   &lt;/otherwise&gt;?
  - &lt;/choose&gt;
  -</source>
  -<p>Jexl Example:</p>
  -<source>
  -&lt;choose&gt;
  -  &lt;when test="${!user.loggedIn}"&gt;
  -    &lt;set var="label" value="Log in"&gt;
  -  &lt;/when&gt;
  -  &lt;otherwise&gt;
  -    &lt;set var="label" value="Log out"&gt;
  -  &lt;/otherwise&gt;
  -&lt;/choose&gt;
  -</source>
  -<p>JXPath Example:</p>
  -<source>
  -&lt;choose&gt;
  -  &lt;when test="#{not(user/loggedIn)}"&gt;
  -    &lt;set var="label" value="Log in"&gt;
  -  &lt;/when&gt;
  -  &lt;otherwise&gt;
  -    &lt;set var="label" value="Log out"&gt;
  -  &lt;/otherwise&gt;
  -&lt;/choose&gt;
  -</source>
  -</s2>
  -<s2 title="out">
  -<p>The <code>out</code> tag evaluates an expression and outputs 
  -the result of the evaluation:</p>
  -<source>
  -&lt;out value="Expression"/&gt;
  -</source>
  -<p>Jexl Example:</p>
  -<source>
  -&lt;out value="${cart.numberOfItems}"&gt;
  -</source>
  -<p>JXPath Example:</p>
  -<source>
  -&lt;out value="#{cart/numberOfItems}"&gt;
  -</source>
  -</s2>
  -<s2 title="forEach">
  -<p>The <code>forEach</code> tag allows you to iterate over a collection 
  -of objects:</p>
  -<source>
  -  &lt;forEach [var="Name"] [items="Expression"] [begin="NumExpr"] [end="NumExpr"] [step="NumExpr"]&gt;
  -    body
  - &lt;/forEach&gt;
  -</source>
  -<p>The <code>items</code> attribute specifies the list of items to iterate over. The <code>var</code> attribute specifies the name of a variable to hold the current item. The <code>begin</code> attribute specifies the element to start with 
  -(<code>0</code> = first item, <code>1</code> = second item, ...). 
  -If unspecified it defaults to <code>0</code>. The <code>end</code> 
  -attribute specifies the item to end with (<code>0</code> = first item, 
  -<code>1</code> = second item, ...). If unspecified it defaults to the last item in the list. Every <code>step</code> items are
  -processed (defaults to <code>1</code> if <code>step</code> is absent). Either <code>items</code> or both <code>begin</code> and <code>end</code> must be present.</p>
  -<p>An alternate form of <code>forEach</code> is supported for convenience when using XPath (since you can specify the selection criteria for the collection using XPath itself):</p>
  -<source>
  -&lt;forEach select="XPathExpression"&gt;
  -  body
  -&lt;/forEach&gt;
  -</source>
  -<p>When using XPath expressions within <code>forEach</code> the current element is the context node and can be referenced with: 
  -<code>#{.}</code></p>
  -<p>Jexl Example:</p>
  -<source>
  -&lt;forEach var="item" items="${cart.cartItems} begin="${start}" end="${count-start}" step="1""&gt;
  -   &lt;td&gt;${item.productId}&lt;/td&gt;
  -&lt;/forEach&gt;
  -</source>
  -<p>JXPath Example:</p>
  -<source>
  -&lt;forEach select="#{cart/cartItems[position() &amp;lt;= $count]}}&gt;
  -   &lt;td&gt;#{./productId}&lt;/td&gt;
  -&lt;/forEach&gt;
  -</source>
  -</s2>
  -<s2 title="macro"> 
  -<p>The <code>macro</code> tag allows you define a new custom tag.</p><source>
  -&lt;macro name="Name" [targetNamespace="Namespace"]&gt;
  -  &lt;parameter name="Name" [optional="Boolean"] [default="Value"]/&gt;*
  -  body
  -
  -&lt;/macro&gt;
  -</source>
  - <p> For example:</p><source>
  -&lt;c:macro name="d"&gt;
  -  &lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
  -&lt;/c:macro&gt;
  -</source>
  -<p>The tag being defined in this example is <code>&lt;d&gt;</code> and it 
  -can be used like any other tag:</p><source>
  -  &lt;d/&gt;
  -</source>
  -<p>However, when this tag is used it will be replaced with a row containing a single empty data cell.</p>
  -<p> When such a tag is used, the attributes and content of the tag become available as variables in the body of the <code>macro</code>'s definition, for example:</p><source>
  -&lt;c:macro name="tablerows"&gt;
  -  &lt;c:parameter name="list"/&gt;
  -  &lt;c:parameter name="color"/&gt;
  -  &lt;c:forEach var="item" items="${list}"&gt;
  -    &lt;tr&gt;&lt;td bgcolor="${color}"&gt;${item}&lt;/td&gt;&lt;/tr&gt;
  -  &lt;/c:forEach&gt;
  -&lt;/c:macro&gt;
  -</source>
  -<p>The <code>parameter</code> tags in the macro definition define formal parameters, which are replaced with the actual attribute values of the tag when it is used. The content of the tag is also available as a special variable <code>${content}</code>.</p><p>Assuming you had this code in your flowscript:</p>
  -   <source>var greatlakes = ["Superior", "Michigan", "Huron", "Erie", "Ontario"];
  -   sendPage(uri, {greatlakes: greatlakes});</source>
  -<p>and a template like this:</p><source>
  -&lt;table&gt;
  -   &lt;tablerows list="${greatlakes}" color="blue"/&gt;
  -&lt;/table&gt;
  -</source>
  -<p>When the <code>tablerows</code> tag is used in this situation the following output would be generated:
  -</p>
  - <source>
  -&lt;table&gt;
  -  &lt;tr&gt;&lt;td bgcolor="blue"&gt;Superior&lt;/td&gt;&lt;/tr&gt;
  -  &lt;tr&gt;&lt;td bgcolor="blue"&gt;Michigan&lt;/td&gt;&lt;/tr&gt;
  -  &lt;tr&gt;&lt;td bgcolor="blue"&gt;Huron&lt;/td&gt;&lt;/tr&gt;
  -  &lt;tr&gt;&lt;td bgcolor="blue"&gt;Erie&lt;/td&gt;&lt;/tr&gt;
  -  &lt;tr&gt;&lt;td bgcolor="blue"&gt;Ontario&lt;/td&gt;&lt;/tr&gt;
  -&lt;/table&gt;
  -</source>
  -</s2>
  -</s1>
  -</body>
  -</document>
  +<?xml version='1.0' encoding='ISO-8859-1'?>
  +<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "../../dtd/document-v10.dtd">
  +
  +<document>
  +	<header>
  +		<title>Advanced Control Flow</title> 
  +		<authors>
  +			<person name="Christopher Oliver" email="coliver@apache.org" />
  +		</authors>
  +	</header>
  +<body>
  +	<s1 title="JXTemplate Generator">
  +  <p>
  +The JXTemplate Generator is a page template processor that allows you to inject data from Java and JavaScript objects passed by a Cocoon Flowscript into a Cocoon pipeline. It provides a set of tags (similar to the <link href="http://java.sun.com/products/jsp/jstl/">JSTL</link> core tags) that allow you to iterate over Java collections (and Java or JavaScript arrays) and to test for the presence of optional or alternate bean properties, as well as embedded expressions to specify conditions and to access the properties of objects. The <em>JX</em>Template Generator gets its name from the embedded expression languages it supports, namely <link href="http://jakarta.apache.org/commons/jxpath">Apache <em>JX</em>Path</link> and <link href="http://jakarta.apache.org/commons/jexl">Apache <em>J</em>e<em>X</em>l</link>. 
  +  </p>
  +<p>To use the JXTemplate Generator, add a generator entry to your sitemap with the <code>src</code> attribute set to <code>org.apache.cocoon.generation.JXTemplateGenerator</code>, for example like this:</p>
  +<source>
  +&lt;map:generators&gt;
  +  &lt;map:generator label="content,data" 
  +      logger="sitemap.generator.jx" name="jx" 
  +         src="org.apache.cocoon.generation.JXTemplateGenerator"/&gt;
  +&lt;/map:generators&gt;
  +</source>
  +         </s1>
  +         <s1 title="Expression Languages">
  +  <p>
  +The JXTemplate Generator supports two embedded expression languages: <link href="http://jakarta.apache.org/commons/jexl">Jexl</link> and <link href="http://jakarta.apache.org/commons/jxpath">JXPath</link>. Apache <link href="http://jakarta.apache.org/commons/jexl">Jexl</link> provides an extended version of the expression language of the <link href="http://java.sun.com/webservices/docs/1.0/tutorial/doc/JSTL.html">JSTL</link>. Apache <link href="http://jakarta.apache.org/commons/jxpath">JXPath</link> provides an interpreter of the <link href="http://www.w3.org/TR/xpath">XPath</link> expression language that can apply XPath expressions to graphs of Java objects of all kinds: JavaBeans, Maps, Servlet contexts, DOM etc, including mixtures thereof.
  + </p>
  +  <p>
  + Having an embedded expression language allows a page author to access an object using a simple syntax such as
  + </p>
  +<source>
  + &lt;site signOn="${accountForm.signOn}"&gt;
  + </source>
  +<p>Embedded Jexl expressions are contained in <code>${}</code>.</p>
  +<p>Embedded JXPath expressions are contained in <code>#{}</code>.</p>
  +<p>The referenced objects may be Java Beans, DOM, JDOM, or JavaScript objects 
  +from a Flowscript. In addition the following implicit objects are available as
  +both JXPath and Jexl variables in a template:</p>
  +<dl>
  +<dt><link href="../../../api/java/org/apache/cocoon/environment/Request.html"><code>org.apache.cocoon.environment.Request</code></link><code> request</code></dt>
  +<dd><br/>The current Cocoon request<br/></dd>
  + 
  +<dt><br/><link href="../../../api/java/org/apache/cocoon/environment/Response.html"><code>org.apache.cocoon.environment.Response</code></link><code> response</code></dt>
  +<dd><br/>The Cocoon response associated with the current request<br/></dd>
  + 
  +<dt><br/><link href="../../../api/java/org/apache/cocoon/environment/Session.html"><code>org.apache.cocoon.environment.Session</code></link><code> session</code></dt>
  +<dd><br/>The Cocoon session associated with the current request<br/></dd>
  + 
  +<dt><br/><link href="../../../api/java/org/apache/cocoon/environment/Context.html"><code>org.apache.cocoon.environment.Context</code></link><code> context</code></dt>
  +<dd><br/>The Cocoon context associated with the current request<br/></dd>
  + 
  +<dt><br/><code>org.apache.avalon.framework.parameter.Parameter[]</code><code> parameters</code></dt>
  +<dd><br/>Any parameters passed to the generator in the pipeline<br/></dd>
  +</dl>
  +<p>
  +Jexl Example:</p>
  +<source>
  +  The content type of the current request is ${request.contentType}
  +</source>
  +<p>
  +JXPath Example:</p>
  +<source>
  +  The content type of the current request is #{$request/contentType}
  +</source>
  +<p> 
  +The current Web Continuation from the Flowscript 
  +is also available as a variable named <code>continuation</code>. You would 
  +typically access its <code>id</code>:</p>
  +<source>
  +   &lt;form action="${continuation.id}"&gt;
  +</source>
  +<p>You can also reach previous continuations by using the <code>getContinuation()</code> function:</p>
  +<source>
  +    &lt;form action="${continuation.getContinuation(1).id}" >
  +</source>
  +<p>or using an XPath expression:</p>
  +<source>
  +    &lt;form action="#{getContinuation($continuation)/id}" >
  +</source>
  +</s1>
  +<s1 title ="Tags">
  +<p>The JXTemplate Generator tags are defined in the namespace</p>
  +<source>
  +http://apache.org/cocoon/templates/jx/1.0
  +</source>
  +<s2 title ="template">
  +<p>The <code>template</code> tag defines a new template:</p><source>
  +   &lt;t:template xmlns:t="http://apache.org/cocoon/templates/jx/1.0"&gt;
  +       body
  +   &lt;/t:template&gt;
  +</source>
  +</s2>
  +<s2 title ="import"/>
  +<p>The <code>import</code> tag allows you to include another template within the current template. The content of the imported template is compiled and will be executed in place of the <code>import</code> tag:</p><source>
  +   &lt;import uri="URI" [context="Expression"]/&gt;
  +</source><p>The Cocoon source resolver is used to resolve <code>uri</code>. If <code>context</code> is present, then its value is used as the context for evaluating the imported template, otherwise the current context is used.</p>
  +<s2 title ="set">
  +<p>The <code>set</code> tag creates a local alias of an object. The <code>var</code> attribute specifies the name of a variable to assign the object to. The <code>value</code> attribute specifies the object (defaults to <code>body</code> if not present):</p><source>
  +   &lt;set var="Name" [value="Value"]&gt;
  +       [body]
  +   &lt;/set&gt;
  +</source><p>If used within a <code>macro</code> definition (see below) variables created by <code>set</code> are only visible within the body of the <code>macro</code>.</p>
  +<p>Jexl Example:</p>
  +<source>
  +&lt;set var="greeting" value="Hello ${user}"/&gt;
  +The value of greeting is ${greeting}
  +</source>
  +<p>JXPath Example:</p>
  +<source>
  +&lt;set var="greeting" value="Hello #{user}"/&gt;
  +The value of greeting is #{$greeting}
  +</source>
  +</s2>
  +<s2 title ="if">
  +<p>The <code>if</code> tag allows the conditional execution of its body 
  +according to value of its <code>test</code> attribute:</p>
  +<source>
  +  &lt;if test="Expression"&gt;
  +      body
  +  &lt;/if&gt;
  +</source>
  +<p>Jexl Example:</p>
  +<source>
  +&lt;if test="${cart.numberOfItems == 0}"&gt;
  +  Your cart is empty
  +&lt;/if&gt;
  +</source>
  +<p>JXPath Example:</p>
  +<source>
  +&lt;if test="#{cart/numberOfItems = 0}"&gt;
  +  Your cart is empty
  +&lt;/if&gt;
  +</source>
  +</s2>
  +<s2 title ="choose">
  +<p>The <code>choose</code> tag performs conditional block execution by the 
  +embedded <code>when</code> sub tags. It renders the body of the first 
  +<code>when</code> tag whose <code>test</code> condition evaluates to true. 
  +If none of the <code>test</code> conditions of nested <code>when</code> tags
  +evaluate to <code>true</code>, then the body of its <code>otherwise</code> 
  +tag is evaluated, if present:</p>
  +<source>
  + &lt;choose&gt;
  +   &lt;when test="Expression"&gt;
  +      body
  +   &lt;/when&gt;+
  +   &lt;otherwise&gt;
  +      body
  +   &lt;/otherwise&gt;?
  + &lt;/choose&gt;
  +</source>
  +<p>Jexl Example:</p>
  +<source>
  +&lt;choose&gt;
  +  &lt;when test="${!user.loggedIn}"&gt;
  +    &lt;set var="label" value="Log in"&gt;
  +  &lt;/when&gt;
  +  &lt;otherwise&gt;
  +    &lt;set var="label" value="Log out"&gt;
  +  &lt;/otherwise&gt;
  +&lt;/choose&gt;
  +</source>
  +<p>JXPath Example:</p>
  +<source>
  +&lt;choose&gt;
  +  &lt;when test="#{not(user/loggedIn)}"&gt;
  +    &lt;set var="label" value="Log in"&gt;
  +  &lt;/when&gt;
  +  &lt;otherwise&gt;
  +    &lt;set var="label" value="Log out"&gt;
  +  &lt;/otherwise&gt;
  +&lt;/choose&gt;
  +</source>
  +</s2>
  +<s2 title="out">
  +<p>The <code>out</code> tag evaluates an expression and outputs 
  +the result of the evaluation:</p>
  +<source>
  +&lt;out value="Expression"/&gt;
  +</source>
  +<p>Jexl Example:</p>
  +<source>
  +&lt;out value="${cart.numberOfItems}"&gt;
  +</source>
  +<p>JXPath Example:</p>
  +<source>
  +&lt;out value="#{cart/numberOfItems}"&gt;
  +</source>
  +</s2>
  +<s2 title="forEach">
  +<p>The <code>forEach</code> tag allows you to iterate over a collection 
  +of objects:</p>
  +<source>
  +  &lt;forEach [var="Name"] [items="Expression"] [begin="NumExpr"] [end="NumExpr"] [step="NumExpr"]&gt;
  +    body
  + &lt;/forEach&gt;
  +</source>
  +<p>The <code>items</code> attribute specifies the list of items to iterate over. The <code>var</code> attribute specifies the name of a variable to hold the current item. The <code>begin</code> attribute specifies the element to start with 
  +(<code>0</code> = first item, <code>1</code> = second item, ...). 
  +If unspecified it defaults to <code>0</code>. The <code>end</code> 
  +attribute specifies the item to end with (<code>0</code> = first item, 
  +<code>1</code> = second item, ...). If unspecified it defaults to the last item in the list. Every <code>step</code> items are
  +processed (defaults to <code>1</code> if <code>step</code> is absent). Either <code>items</code> or both <code>begin</code> and <code>end</code> must be present.</p>
  +<p>An alternate form of <code>forEach</code> is supported for convenience when using XPath (since you can specify the selection criteria for the collection using XPath itself):</p>
  +<source>
  +&lt;forEach select="XPathExpression"&gt;
  +  body
  +&lt;/forEach&gt;
  +</source>
  +<p>When using XPath expressions within <code>forEach</code> the current element is the context node and can be referenced with: 
  +<code>#{.}</code></p>
  +<p>Jexl Example:</p>
  +<source>
  +&lt;forEach var="item" items="${cart.cartItems} begin="${start}" end="${count-start}" step="1""&gt;
  +   &lt;td&gt;${item.productId}&lt;/td&gt;
  +&lt;/forEach&gt;
  +</source>
  +<p>JXPath Example:</p>
  +<source>
  +&lt;forEach select="#{cart/cartItems[position() &amp;lt;= $count]}}&gt;
  +   &lt;td&gt;#{./productId}&lt;/td&gt;
  +&lt;/forEach&gt;
  +</source>
  +</s2>
  +<s2 title="macro"> 
  +<p>The <code>macro</code> tag allows you define a new custom tag.</p><source>
  +&lt;macro name="Name" [targetNamespace="Namespace"]&gt;
  +  &lt;parameter name="Name" [optional="Boolean"] [default="Value"]/&gt;*
  +  body
  +
  +&lt;/macro&gt;
  +</source>
  + <p> For example:</p><source>
  +&lt;c:macro name="d"&gt;
  +  &lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
  +&lt;/c:macro&gt;
  +</source>
  +<p>The tag being defined in this example is <code>&lt;d&gt;</code> and it 
  +can be used like any other tag:</p><source>
  +  &lt;d/&gt;
  +</source>
  +<p>However, when this tag is used it will be replaced with a row containing a single empty data cell.</p>
  +<p> When such a tag is used, the attributes and content of the tag become available as variables in the body of the <code>macro</code>'s definition, for example:</p><source>
  +&lt;c:macro name="tablerows"&gt;
  +  &lt;c:parameter name="list"/&gt;
  +  &lt;c:parameter name="color"/&gt;
  +  &lt;c:forEach var="item" items="${list}"&gt;
  +    &lt;tr&gt;&lt;td bgcolor="${color}"&gt;${item}&lt;/td&gt;&lt;/tr&gt;
  +  &lt;/c:forEach&gt;
  +&lt;/c:macro&gt;
  +</source>
  +<p>The <code>parameter</code> tags in the macro definition define formal parameters, which are replaced with the actual attribute values of the tag when it is used. The content of the tag is also available as a special variable <code>${content}</code>.</p><p>Assuming you had this code in your flowscript:</p>
  +   <source>var greatlakes = ["Superior", "Michigan", "Huron", "Erie", "Ontario"];
  +   sendPage(uri, {greatlakes: greatlakes});</source>
  +<p>and a template like this:</p><source>
  +&lt;table&gt;
  +   &lt;tablerows list="${greatlakes}" color="blue"/&gt;
  +&lt;/table&gt;
  +</source>
  +<p>When the <code>tablerows</code> tag is used in this situation the following output would be generated:
  +</p>
  + <source>
  +&lt;table&gt;
  +  &lt;tr&gt;&lt;td bgcolor="blue"&gt;Superior&lt;/td&gt;&lt;/tr&gt;
  +  &lt;tr&gt;&lt;td bgcolor="blue"&gt;Michigan&lt;/td&gt;&lt;/tr&gt;
  +  &lt;tr&gt;&lt;td bgcolor="blue"&gt;Huron&lt;/td&gt;&lt;/tr&gt;
  +  &lt;tr&gt;&lt;td bgcolor="blue"&gt;Erie&lt;/td&gt;&lt;/tr&gt;
  +  &lt;tr&gt;&lt;td bgcolor="blue"&gt;Ontario&lt;/td&gt;&lt;/tr&gt;
  +&lt;/table&gt;
  +</source>
  +</s2>
  +</s1>
  +</body>
  +</document>
  
  
  
  1.10      +76 -76    cocoon-2.1/src/documentation/xdocs/userdocs/flow/sitemap.xml
  
  Index: sitemap.xml
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/documentation/xdocs/userdocs/flow/sitemap.xml,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- sitemap.xml	1 Jun 2003 03:35:36 -0000	1.9
  +++ sitemap.xml	1 Jun 2003 15:49:04 -0000	1.10
  @@ -1,76 +1,76 @@
  -<?xml version="1.0" encoding="UTF-8"?>
  -<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "../../dtd/document-v10.dtd">
  -
  -<document>
  -  <header>
  -    <title>Advanced Control Flow</title>
  -    <authors>
  -      <person name="Ovidiu Predescu" email="ovidiu@apache.org"/>
  -      <person name="Christopher Oliver" email="coliver@apache.org"/>
  -    </authors>
  -  </header>
  -
  -  <body>
  -    <s1 title="Sitemap">
  -    <p>The Cocoon <link href="../concepts/sitemap.html">Sitemap</link> provides two elements to specify interactions with your Flowscripts.</p>
  -      <s2 title="flow">
  -     <p>The <code>flow</code> element defines a Flowscript interpreter for a sitemap. The <code>language</code> attribute specifies the target programming language. Currently the only supported language is <code>"JavaScript"</code>. Its embedded <code>script</code> elements allow you to specify the files that make up the flow for this sitemap. Each <code>script</code> element specifies the URI of a script that will be compiled and executed when this Sitemap is created. The <code>src</code> attribute specifies the URI of the script.</p>
  -      <source><![CDATA[
  -        <map:flow language="Language">
  -           <map:script src="URI"/>+
  -        </map:flow>
  -      ]]></source>
  -    <p>Example:</p>
  -      <source><![CDATA[
  -        <map:flow language="JavaScript">
  -           <map:script src="myApplication.js"/>
  -        </map:flow>
  -      ]]></source>
  -      </s2>
  -      <s2 title="call">
  -     <p>The <code>call</code> element allows you to call a top-level function in your Flowscript or to invoke an existing continuation.</p>
  -      <s3 title="function"><anchor id="callFunction"/>
  -      <p>If the <code>function</code> attribute is present, then the Sitemap will invoke a top-level function defined in your Flowscript. The <code>function</code> attribute specifies the name of the function. Zero or more nested <code>parameter</code> elements may be provided to pass arguments to the function.</p>
  -      <source><![CDATA[
  -        <map:call function="FunctionName">
  -           <map:parameter name="Name" value="Value"/>*
  -        </map:call>
  -      ]]></source>
  -      <p>Example:</p>
  -      <source><![CDATA[
  -        <map:flow language="JavaScript">
  -           <map:script src="myApplication.js"/>
  -        </map:flow>
  -        <map:pipelines>
  -           <map:pipeline>
  -              <map:match pattern="index.html">
  -                 <map:call function="showIndexPage"/>
  -              </map:match>
  -           </map:pipeline>
  -        </map:pipelines>
  -      ]]></source>
  -      <p>Then in <code>myApplication.js</code> you would define a JavaScript function called <code>showIndexPage()</code> such as:</p>
  -      <source><![CDATA[
  -        function showIndexPage() { 
  -            var param = cocoon.request.get("paramName");
  -            sendPage("private/index.html", {param: param});
  -        }
  -      ]]></source>
  -      </s3>
  -      <s3 title="continuation"><anchor id="callContinuation"/>
  -      <p>If the <code>continuation</code> attribute is present, then the Sitemap will invoke an existing continuation of your Flowscript. The <code>continuation</code> attribute specifies the unique id of the continuation.</p>
  -      <source><![CDATA[
  -        <map:call continuation="Id"/>
  -      ]]></source>
  -      <p>Example:</p>
  -      <source><![CDATA[
  -        <map:match pattern="*.form">
  -          <map:call continuation="{1}"/>
  -        </map:match>
  -      ]]></source>
  -      </s3>
  -      </s2>
  -    </s1>
  -
  -  </body>
  -</document>
  +<?xml version="1.0" encoding="UTF-8"?>
  +<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "../../dtd/document-v10.dtd">
  +
  +<document>
  +  <header>
  +    <title>Advanced Control Flow</title>
  +    <authors>
  +      <person name="Ovidiu Predescu" email="ovidiu@apache.org"/>
  +      <person name="Christopher Oliver" email="coliver@apache.org"/>
  +    </authors>
  +  </header>
  +
  +  <body>
  +    <s1 title="Sitemap">
  +    <p>The Cocoon <link href="../concepts/sitemap.html">Sitemap</link> provides two elements to specify interactions with your Flowscripts.</p>
  +      <s2 title="flow">
  +     <p>The <code>flow</code> element defines a Flowscript interpreter for a sitemap. The <code>language</code> attribute specifies the target programming language. Currently the only supported language is <code>"JavaScript"</code>. Its embedded <code>script</code> elements allow you to specify the files that make up the flow for this sitemap. Each <code>script</code> element specifies the URI of a script that will be compiled and executed when this Sitemap is created. The <code>src</code> attribute specifies the URI of the script.</p>
  +      <source><![CDATA[
  +        <map:flow language="Language">
  +           <map:script src="URI"/>+
  +        </map:flow>
  +      ]]></source>
  +    <p>Example:</p>
  +      <source><![CDATA[
  +        <map:flow language="JavaScript">
  +           <map:script src="myApplication.js"/>
  +        </map:flow>
  +      ]]></source>
  +      </s2>
  +      <s2 title="call">
  +     <p>The <code>call</code> element allows you to call a top-level function in your Flowscript or to invoke an existing continuation.</p>
  +      <s3 title="function"><anchor id="callFunction"/>
  +      <p>If the <code>function</code> attribute is present, then the Sitemap will invoke a top-level function defined in your Flowscript. The <code>function</code> attribute specifies the name of the function. Zero or more nested <code>parameter</code> elements may be provided to pass arguments to the function.</p>
  +      <source><![CDATA[
  +        <map:call function="FunctionName">
  +           <map:parameter name="Name" value="Value"/>*
  +        </map:call>
  +      ]]></source>
  +      <p>Example:</p>
  +      <source><![CDATA[
  +        <map:flow language="JavaScript">
  +           <map:script src="myApplication.js"/>
  +        </map:flow>
  +        <map:pipelines>
  +           <map:pipeline>
  +              <map:match pattern="index.html">
  +                 <map:call function="showIndexPage"/>
  +              </map:match>
  +           </map:pipeline>
  +        </map:pipelines>
  +      ]]></source>
  +      <p>Then in <code>myApplication.js</code> you would define a JavaScript function called <code>showIndexPage()</code> such as:</p>
  +      <source><![CDATA[
  +        function showIndexPage() { 
  +            var param = cocoon.request.get("paramName");
  +            sendPage("private/index.html", {param: param});
  +        }
  +      ]]></source>
  +      </s3>
  +      <s3 title="continuation"><anchor id="callContinuation"/>
  +      <p>If the <code>continuation</code> attribute is present, then the Sitemap will invoke an existing continuation of your Flowscript. The <code>continuation</code> attribute specifies the unique id of the continuation.</p>
  +      <source><![CDATA[
  +        <map:call continuation="Id"/>
  +      ]]></source>
  +      <p>Example:</p>
  +      <source><![CDATA[
  +        <map:match pattern="*.form">
  +          <map:call continuation="{1}"/>
  +        </map:match>
  +      ]]></source>
  +      </s3>
  +      </s2>
  +    </s1>
  +
  +  </body>
  +</document>
  
  
  
  1.8       +196 -196  cocoon-2.1/src/documentation/xdocs/userdocs/flow/using.xml
  
  Index: using.xml
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/documentation/xdocs/userdocs/flow/using.xml,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- using.xml	1 Jun 2003 03:35:36 -0000	1.7
  +++ using.xml	1 Jun 2003 15:49:04 -0000	1.8
  @@ -1,196 +1,196 @@
  -<?xml version="1.0" encoding="UTF-8"?>
  -<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "../../dtd/document-v10.dtd">
  -
  -<document>
  -  <header>
  -    <title>Advanced Control Flow</title>
  -    <authors>
  -      <person name="Ovidiu Predescu" email="ovidiu@apache.org"/>
  -    </authors>
  -  </header>
  -
  -  <body>
  -  <s1 title="Using Cocoon's Control Flow">
  -  <p>
  -    The general flow of actions in an application which uses the control flow
  -    is as described below.
  -  </p>
  - 
  -  <p>
  -    The request is received by Cocoon and passed to the sitemap for
  -    processing. In the sitemap, you can do two things to pass the control to
  -    the Control Flow layer:</p>
  -  <ul>
  -    <li>
  -      You can invoke a JavaScript top-level function to start processing a
  -      logically grouped sequences of pages. Each time a response page is
  -      being sent back to the client browser from this function, the
  -      processing of the JavaScript  code stops at the point the page is
  -      sent back, and the HTTP request finishes. Through the magic of
  -      continuations, the execution state is saved in a continuation object.
  -      Each continuation is given a unique string id, which could be embedded
  -      in generated page, so that you can restart the saved computation later
  -      on.
  -    </li>
  -    <li>
  -      To invoke a top level JavaScript function in the Control Flow, you use
  -      the <link href="sitemap.html#callFunction"><code>&lt;map:call&nbsp;function="function-name"/&gt;</code></link>
  -      construction.
  -    </li>
  -    <li>
  -      To restart the computation of a previously stopped function, you use
  -      the <link href="sitemap.html#callContinuation"><code>&lt;map:call&nbsp;continuation="..."/&gt;</code></link> construction.
  -      This restarts the computation saved in a continuation object
  -      identified by the string value of the <code>continuation</code> attribute.
  -      This value could be extracted in the sitemap from the requested URL,
  -      from a POST or GET parameter etc. When the computation stored in the
  -      continuation object is restarted, it appears as if nothing happened,
  -      all the local and global variables have exactly the same values as
  -      they had when the computation was stopped.
  -    </li>
  -  </ul>
  - 
  -  <p>
  -    Once the JavaScript function in the control layer is restarted, you're
  -    effectively inside the Control Flow. Here you have access to the request
  -    parameters, and to the business logic objects. The controller script
  -    takes the appropriate actions to invoke the business logic, usually
  -    written in Java, creating objects, setting various values on them etc...
  -  </p>
  - 
  -  <p>
  -    When the business logic is invoked, you're inside the Model. The business
  -    logic takes whatever actions are needed, accessing a database, making a
  -    SOAP request to a Web service etc. When this logic finishes, the program
  -    control goes back to the Control Flow.
  -  </p>
  - 
  -  <p>
  -    Once here, the Control Flow has to decide which page needs to be sent back
  -    to the client browser. To do this, the script can invoke one of the
  -    <link href="api.html#sendPageAndWait"><code>sendPageAndWait</code></link> or <link href="api.html#sendPage"><code>sendPage</code></link> functions.
  -    These functions take two parameters, the relative URL of the page to be
  -    sent back to the client, and a context object which can be accessed
  -    inside this page to extract various values and place them in the
  -    generated page.
  -  </p>
  - 
  -  <p>
  -    The second argument to <code>sendPageAndWait</code> and
  -    <code>sendPage</code> is a context object, which can be a
  -    simple dictionary with values that need to be displayed by the View. More
  -    generally any Java or JavaScript object can be passed here, as long as
  -    the necessary get methods for the important values are provided.
  -  </p>
  - 
  -  <p>
  -    The page specified by the URL is processed by the sitemap, using the
  -    normal sitemap rules. The simplest case is a <link href="views.html">generator</link> followed by
  -    an XSLT transformation and a serializer. This page generation is part of
  -    the View layer. To process a page you can make use of several
  -    Cocoon <link href="views.html">generators</link> to retrieve values from the context objects passed by the
  -    Control Flow.
  -  </p>
  - 
  -  <p>
  -    Going back to the <code>sendPageAndWait</code> and
  -    <code>sendPage</code> functions, there is a big difference
  -    between them. The first function will send the response back to the
  -    client browser, and will stop the processing of the JavaScript script by
  -    saving it into a continuation object. The other function,
  -    <code>sendPage</code> will send the response, but it will not
  -    stop the computation. This is useful for example when you need to exit a
  -    top-level JavaScript function invoked with
  -    <code>&lt;map:call&nbsp;function="..."/&gt;</code>.
  -  </p>
  - 
  -  <p>
  -    The above explains how MVC could be really achieved in Cocoon with the
  -    control flow layer. Note that there is no direct communication between
  -    Model and View, everything is directed by the Control Flow by passing to
  -    View a context object constructed from Model data.
  -  </p>
  - 
  -  <s2 title="Basic usage">
  - 
  -  <p>
  -    As hinted in the previous section, an application using Cocoon's MVC
  -    approach is composed of three layers:</p>
  -  <ul>
  -    <li>
  -      A JavaScript controller which implements the interaction with the
  -      client
  -    </li>
  -    <li>
  -     The business logic model which implements your application
  -    </li>
  -    <li>
  -      The <link href="views.html">page templates</link>, which describe the content of the pages, and XSLT
  -      stylesheets which describe the look of the content.
  -    </li>
  -  </ul>
  - 
  -  <p>
  -    In more complex applications, the flow of pages can be thought of smaller
  -    sequences of pages which are composed together. The natural analogy is to
  -    describe these sequences in separate JavaScript functions, which can then
  -    be called either from the sitemap, can call each other freely.
  -  </p>
  - 
  -  <p>
  -    An example of such an application is the user login and preferences
  -    sample 
  -  </p>
  - 
  -  <p>
  -    This application is composed of four top-level JavaScript functions:</p>
  -  <ul>
  -    <li><code>login</code>,</li>
  -    <li><code>registerUser</code>,</li>
  -    <li><code>edit</code> and</li>
  -    <li><code>logout</code>.</li>
  -  </ul>
  - 
  -  <p>
  -    The entry level point in the application can be any of these functions,
  -    but in order for a user to use the application, (s)he must login first.
  -    Once the user logs in, we want to maintain the Java User object which
  -    represents the user between top-level function invocations.
  -  </p>
  - 
  -  <p>
  -    If the script does nothing, each invocation of a top-level function
  -    starts with fresh values for the global variables, no global state is
  -    preserved between top-level function invocations from the sitemap. In
  -    this sample for example, the <code>login</code> function assigns to the
  -    global variable <em>user</em> the Java User object representing the
  -    logged in user. The <code>edit</code> function trying to operate on this
  -    object would get a null value instead, because the value is not shared by
  -    default between these top-level function invocations.
  -  </p>
  - 
  -  <p>
  -    To solve the problem, the <code>login</code> and
  -    <code>registerUser</code> functions have to call the
  -    <link href="api.html#createSession"><code>cocoon.createSession()</code></link> method, which creates a servlet
  -    session and saves the global scope containing the global variables' value
  -    in it. Next time the user invokes one of the four top-level functions,
  -    the values of the global variables are restored, making sharing very easy.
  -  </p>
  -  </s2>
  - 
  -  <p>
  -    Even if you don't need complex control flow in your application, you may
  -    still choose to use the MVC pattern described above. You can have top-
  -    level JavaScript functions which obtain the request parameters, invoke
  -    the business logic and then call <code>sendPage</code> to
  -    generate a response page and return from the computation. Since there's
  -    no continuation object being created by this function, and no global
  -    scope being saved, there's no memory resource being eaten. The approach
  -    provides a clean way of separating logic and content, and makes things
  -    easy to follow, since you have to look at a single script to understand
  -    what's going on.
  -  </p>
  -    </s1>
  -  </body>
  -</document>
  +<?xml version="1.0" encoding="UTF-8"?>
  +<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "../../dtd/document-v10.dtd">
  +
  +<document>
  +  <header>
  +    <title>Advanced Control Flow</title>
  +    <authors>
  +      <person name="Ovidiu Predescu" email="ovidiu@apache.org"/>
  +    </authors>
  +  </header>
  +
  +  <body>
  +  <s1 title="Using Cocoon's Control Flow">
  +  <p>
  +    The general flow of actions in an application which uses the control flow
  +    is as described below.
  +  </p>
  + 
  +  <p>
  +    The request is received by Cocoon and passed to the sitemap for
  +    processing. In the sitemap, you can do two things to pass the control to
  +    the Control Flow layer:</p>
  +  <ul>
  +    <li>
  +      You can invoke a JavaScript top-level function to start processing a
  +      logically grouped sequences of pages. Each time a response page is
  +      being sent back to the client browser from this function, the
  +      processing of the JavaScript  code stops at the point the page is
  +      sent back, and the HTTP request finishes. Through the magic of
  +      continuations, the execution state is saved in a continuation object.
  +      Each continuation is given a unique string id, which could be embedded
  +      in generated page, so that you can restart the saved computation later
  +      on.
  +    </li>
  +    <li>
  +      To invoke a top level JavaScript function in the Control Flow, you use
  +      the <link href="sitemap.html#callFunction"><code>&lt;map:call&nbsp;function="function-name"/&gt;</code></link>
  +      construction.
  +    </li>
  +    <li>
  +      To restart the computation of a previously stopped function, you use
  +      the <link href="sitemap.html#callContinuation"><code>&lt;map:call&nbsp;continuation="..."/&gt;</code></link> construction.
  +      This restarts the computation saved in a continuation object
  +      identified by the string value of the <code>continuation</code> attribute.
  +      This value could be extracted in the sitemap from the requested URL,
  +      from a POST or GET parameter etc. When the computation stored in the
  +      continuation object is restarted, it appears as if nothing happened,
  +      all the local and global variables have exactly the same values as
  +      they had when the computation was stopped.
  +    </li>
  +  </ul>
  + 
  +  <p>
  +    Once the JavaScript function in the control layer is restarted, you're
  +    effectively inside the Control Flow. Here you have access to the request
  +    parameters, and to the business logic objects. The controller script
  +    takes the appropriate actions to invoke the business logic, usually
  +    written in Java, creating objects, setting various values on them etc...
  +  </p>
  + 
  +  <p>
  +    When the business logic is invoked, you're inside the Model. The business
  +    logic takes whatever actions are needed, accessing a database, making a
  +    SOAP request to a Web service etc. When this logic finishes, the program
  +    control goes back to the Control Flow.
  +  </p>
  + 
  +  <p>
  +    Once here, the Control Flow has to decide which page needs to be sent back
  +    to the client browser. To do this, the script can invoke one of the
  +    <link href="api.html#sendPageAndWait"><code>sendPageAndWait</code></link> or <link href="api.html#sendPage"><code>sendPage</code></link> functions.
  +    These functions take two parameters, the relative URL of the page to be
  +    sent back to the client, and a context object which can be accessed
  +    inside this page to extract various values and place them in the
  +    generated page.
  +  </p>
  + 
  +  <p>
  +    The second argument to <code>sendPageAndWait</code> and
  +    <code>sendPage</code> is a context object, which can be a
  +    simple dictionary with values that need to be displayed by the View. More
  +    generally any Java or JavaScript object can be passed here, as long as
  +    the necessary get methods for the important values are provided.
  +  </p>
  + 
  +  <p>
  +    The page specified by the URL is processed by the sitemap, using the
  +    normal sitemap rules. The simplest case is a <link href="views.html">generator</link> followed by
  +    an XSLT transformation and a serializer. This page generation is part of
  +    the View layer. To process a page you can make use of several
  +    Cocoon <link href="views.html">generators</link> to retrieve values from the context objects passed by the
  +    Control Flow.
  +  </p>
  + 
  +  <p>
  +    Going back to the <code>sendPageAndWait</code> and
  +    <code>sendPage</code> functions, there is a big difference
  +    between them. The first function will send the response back to the
  +    client browser, and will stop the processing of the JavaScript script by
  +    saving it into a continuation object. The other function,
  +    <code>sendPage</code> will send the response, but it will not
  +    stop the computation. This is useful for example when you need to exit a
  +    top-level JavaScript function invoked with
  +    <code>&lt;map:call&nbsp;function="..."/&gt;</code>.
  +  </p>
  + 
  +  <p>
  +    The above explains how MVC could be really achieved in Cocoon with the
  +    control flow layer. Note that there is no direct communication between
  +    Model and View, everything is directed by the Control Flow by passing to
  +    View a context object constructed from Model data.
  +  </p>
  + 
  +  <s2 title="Basic usage">
  + 
  +  <p>
  +    As hinted in the previous section, an application using Cocoon's MVC
  +    approach is composed of three layers:</p>
  +  <ul>
  +    <li>
  +      A JavaScript controller which implements the interaction with the
  +      client
  +    </li>
  +    <li>
  +     The business logic model which implements your application
  +    </li>
  +    <li>
  +      The <link href="views.html">page templates</link>, which describe the content of the pages, and XSLT
  +      stylesheets which describe the look of the content.
  +    </li>
  +  </ul>
  + 
  +  <p>
  +    In more complex applications, the flow of pages can be thought of smaller
  +    sequences of pages which are composed together. The natural analogy is to
  +    describe these sequences in separate JavaScript functions, which can then
  +    be called either from the sitemap, can call each other freely.
  +  </p>
  + 
  +  <p>
  +    An example of such an application is the user login and preferences
  +    sample 
  +  </p>
  + 
  +  <p>
  +    This application is composed of four top-level JavaScript functions:</p>
  +  <ul>
  +    <li><code>login</code>,</li>
  +    <li><code>registerUser</code>,</li>
  +    <li><code>edit</code> and</li>
  +    <li><code>logout</code>.</li>
  +  </ul>
  + 
  +  <p>
  +    The entry level point in the application can be any of these functions,
  +    but in order for a user to use the application, (s)he must login first.
  +    Once the user logs in, we want to maintain the Java User object which
  +    represents the user between top-level function invocations.
  +  </p>
  + 
  +  <p>
  +    If the script does nothing, each invocation of a top-level function
  +    starts with fresh values for the global variables, no global state is
  +    preserved between top-level function invocations from the sitemap. In
  +    this sample for example, the <code>login</code> function assigns to the
  +    global variable <em>user</em> the Java User object representing the
  +    logged in user. The <code>edit</code> function trying to operate on this
  +    object would get a null value instead, because the value is not shared by
  +    default between these top-level function invocations.
  +  </p>
  + 
  +  <p>
  +    To solve the problem, the <code>login</code> and
  +    <code>registerUser</code> functions have to call the
  +    <link href="api.html#createSession"><code>cocoon.createSession()</code></link> method, which creates a servlet
  +    session and saves the global scope containing the global variables' value
  +    in it. Next time the user invokes one of the four top-level functions,
  +    the values of the global variables are restored, making sharing very easy.
  +  </p>
  +  </s2>
  + 
  +  <p>
  +    Even if you don't need complex control flow in your application, you may
  +    still choose to use the MVC pattern described above. You can have top-
  +    level JavaScript functions which obtain the request parameters, invoke
  +    the business logic and then call <code>sendPage</code> to
  +    generate a response page and return from the computation. Since there's
  +    no continuation object being created by this function, and no global
  +    scope being saved, there's no memory resource being eaten. The approach
  +    provides a clean way of separating logic and content, and makes things
  +    easy to follow, since you have to look at a single script to understand
  +    what's going on.
  +  </p>
  +    </s1>
  +  </body>
  +</document>
  
  
  
  1.9       +59 -59    cocoon-2.1/src/documentation/xdocs/userdocs/flow/velocity.xml
  
  Index: velocity.xml
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/documentation/xdocs/userdocs/flow/velocity.xml,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- velocity.xml	1 Jun 2003 03:35:36 -0000	1.8
  +++ velocity.xml	1 Jun 2003 15:49:04 -0000	1.9
  @@ -1,59 +1,59 @@
  -<?xml version='1.0' encoding='ISO-8859-1'?>
  -<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "../../dtd/document-v10.dtd">
  -<document>
  - <header>
  -  <title>Advanced Control Flow</title> 
  -  <authors>
  -   <person name="Christopher Oliver" email="coliver@apache.org" />
  -   <person name="Ovidiu Predescu" email="ovidiu@apache.org" />
  -  </authors>
  - </header>
  - <body>
  -  <s1 title="Velocity Generator">
  -   <p>If called from a Flowscript, the Cocoon
  -    <link href="http://jakarta.apache.org/velocity">Velocity</link>
  -    <link href="../generators/velocity-generator.html">Generator</link>
  -    provides access to the immediate properties of the context object passed to
  -    <link href="api.html#sendPage"><code>sendPage</code></link> and
  -    <link href="api.html#sendPageAndWait"><code>sendPageAndWait</code></link>. In addition,
  -    the current <link href="api.html#WebContinuation"><code>WebContinuation</code></link>
  -    is also available as a variable named <code>$continuation</code>. You would typically access
  -    its <code>id</code>:</p>
  -   <source>
  -  &lt;form action="$continuation.id"&gt;
  -   </source>
  -   <p>You can also reach previous continuations by using the <code>getContinuation()</code> function:</p>
  -   <source>
  -  &lt;form action="$continuation.getContinuation(1).id" &gt;
  -   </source>
  -   <p>In addition the following implicit objects are always available in the Velocity context:</p>
  -   <dl>
  -    <dt><link href="../../../api/java/org/apache/cocoon/environment/Request.html">org.apache.cocoon.environment.Request</link> <code>$request</code> </dt>
  -    <dd>The current Cocoon request</dd>
  -    <dt><link href="../../../api/java/org/apache/cocoon/environment/Response.html">org.apache.cocoon.environment.Response</link> <code>$response</code> </dt>
  -    <dd>The Cocoon response associated with the current request</dd>
  -    <dt><link href="../../../api/java/org/apache/cocoon/environment/Session.html">org.apache.cocoon.environment.Session</link> <code>$session</code> </dt>
  -    <dd>The Cocoon session associated with the current request</dd>
  -    <dt><link href="../../../api/java/org/apache/cocoon/environment/Context.html">org.apache.cocoon.environment.Context</link> <code>$context</code> </dt>
  -    <dd>The Cocoon context associated with the current request</dd>
  -    <dt><code>org.apache.avalon.framework.parameters.Parameters</code> <code>$parameters</code> </dt>
  -    <dd>Any parameters passed to the generator in the pipeline</dd>
  -   </dl>
  -   <p>
  -   Cocoon installs a Velocity introspector that makes it possible for you
  -   to access JavaScript objects and arrays in your template, as well as Java objects. For example, assuming you had a Flowscript like this:</p>
  -   <source>
  -    sendPage("myTemplate.vm", {colors: ["red", "blue", "yellow"]});
  -   </source>
  -   <p>
  -    You could do this in <code>myTemplate.vm</code>:</p>
  -    <source>
  -    &lt;select name="colors"&gt;
  -    #foreach ($color in $colors) 
  -      &lt;option value="$color"&gt;$color&lt;/option&gt;
  -    #end
  -    &lt;/select&gt;
  -    </source>
  -  </s1>
  - </body>
  -</document>
  +<?xml version='1.0' encoding='ISO-8859-1'?>
  +<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "../../dtd/document-v10.dtd">
  +<document>
  + <header>
  +  <title>Advanced Control Flow</title> 
  +  <authors>
  +   <person name="Christopher Oliver" email="coliver@apache.org" />
  +   <person name="Ovidiu Predescu" email="ovidiu@apache.org" />
  +  </authors>
  + </header>
  + <body>
  +  <s1 title="Velocity Generator">
  +   <p>If called from a Flowscript, the Cocoon
  +    <link href="http://jakarta.apache.org/velocity">Velocity</link>
  +    <link href="../generators/velocity-generator.html">Generator</link>
  +    provides access to the immediate properties of the context object passed to
  +    <link href="api.html#sendPage"><code>sendPage</code></link> and
  +    <link href="api.html#sendPageAndWait"><code>sendPageAndWait</code></link>. In addition,
  +    the current <link href="api.html#WebContinuation"><code>WebContinuation</code></link>
  +    is also available as a variable named <code>$continuation</code>. You would typically access
  +    its <code>id</code>:</p>
  +   <source>
  +  &lt;form action="$continuation.id"&gt;
  +   </source>
  +   <p>You can also reach previous continuations by using the <code>getContinuation()</code> function:</p>
  +   <source>
  +  &lt;form action="$continuation.getContinuation(1).id" &gt;
  +   </source>
  +   <p>In addition the following implicit objects are always available in the Velocity context:</p>
  +   <dl>
  +    <dt><link href="../../../api/java/org/apache/cocoon/environment/Request.html">org.apache.cocoon.environment.Request</link> <code>$request</code> </dt>
  +    <dd>The current Cocoon request</dd>
  +    <dt><link href="../../../api/java/org/apache/cocoon/environment/Response.html">org.apache.cocoon.environment.Response</link> <code>$response</code> </dt>
  +    <dd>The Cocoon response associated with the current request</dd>
  +    <dt><link href="../../../api/java/org/apache/cocoon/environment/Session.html">org.apache.cocoon.environment.Session</link> <code>$session</code> </dt>
  +    <dd>The Cocoon session associated with the current request</dd>
  +    <dt><link href="../../../api/java/org/apache/cocoon/environment/Context.html">org.apache.cocoon.environment.Context</link> <code>$context</code> </dt>
  +    <dd>The Cocoon context associated with the current request</dd>
  +    <dt><code>org.apache.avalon.framework.parameters.Parameters</code> <code>$parameters</code> </dt>
  +    <dd>Any parameters passed to the generator in the pipeline</dd>
  +   </dl>
  +   <p>
  +   Cocoon installs a Velocity introspector that makes it possible for you
  +   to access JavaScript objects and arrays in your template, as well as Java objects. For example, assuming you had a Flowscript like this:</p>
  +   <source>
  +    sendPage("myTemplate.vm", {colors: ["red", "blue", "yellow"]});
  +   </source>
  +   <p>
  +    You could do this in <code>myTemplate.vm</code>:</p>
  +    <source>
  +    &lt;select name="colors"&gt;
  +    #foreach ($color in $colors) 
  +      &lt;option value="$color"&gt;$color&lt;/option&gt;
  +    #end
  +    &lt;/select&gt;
  +    </source>
  +  </s1>
  + </body>
  +</document>
  
  
  
  1.7       +28 -27    cocoon-2.1/src/documentation/xdocs/userdocs/flow/views.xml
  
  Index: views.xml
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/documentation/xdocs/userdocs/flow/views.xml,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- views.xml	1 Jun 2003 03:35:36 -0000	1.6
  +++ views.xml	1 Jun 2003 15:49:04 -0000	1.7
  @@ -1,27 +1,28 @@
  -<?xml version="1.0" encoding="UTF-8"?>
  -<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "../../dtd/document-v10.dtd">
  -<document>
  - <header>
  -  <title>Advanced Control Flow</title>
  -  <authors>
  -   <person name="Ovidiu Predescu" email="ovidiu@apache.org"/>
  -   <person name="Christopher Oliver" email="coliver@apache.org"/>
  -  </authors>
  - </header>
  - <body>
  -  <s1 title="Flowscript-aware Generators">
  -   <p>The second argument to <link href="api.html#sendPage"><code>sendPage</code></link> and
  -    <link href="api.html#sendPageAndWait"><code>sendPageAndWait</code></link> is a context object,
  -    which can be a simple dictionary with values that need to be displayed by the page. More
  -    generally any Java or JavaScript object can be passed here, as long as the necessary <em>get</em>
  -    methods for the important values are provided.</p>
  -   <p>The page specified by the URL is processed by the sitemap, using the normal sitemap rules.</p>
  -   <p>Several Cocoon generators are provided that allow you to access the context object and inject
  -    its values into a pipeline. Currently, these are the
  -    <link href="jxtemplate.html">JXTemplate Generator</link>,
  -    <link href="jpath.html">JPath XSP Logic Sheet</link> and
  -    <link href="velocity.html">Velocity Generator</link>.
  -   </p>
  -  </s1>
  - </body>
  -</document>
  +<?xml version="1.0" encoding="UTF-8"?>
  +<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "../../dtd/document-v10.dtd">
  +
  +<document>
  + <header>
  +  <title>Advanced Control Flow</title>
  +  <authors>
  +   <person name="Ovidiu Predescu" email="ovidiu@apache.org"/>
  +   <person name="Christopher Oliver" email="coliver@apache.org"/>
  +  </authors>
  + </header>
  + <body>
  +  <s1 title="Flowscript-aware Generators">
  +   <p>The second argument to <link href="api.html#sendPage"><code>sendPage</code></link> and
  +    <link href="api.html#sendPageAndWait"><code>sendPageAndWait</code></link> is a context object,
  +    which can be a simple dictionary with values that need to be displayed by the page. More
  +    generally any Java or JavaScript object can be passed here, as long as the necessary <em>get</em>
  +    methods for the important values are provided.</p>
  +   <p>The page specified by the URL is processed by the sitemap, using the normal sitemap rules.</p>
  +   <p>Several Cocoon generators are provided that allow you to access the context object and inject
  +    its values into a pipeline. Currently, these are the
  +    <link href="jxtemplate.html">JXTemplate Generator</link>,
  +    <link href="jpath.html">JPath XSP Logic Sheet</link> and
  +    <link href="velocity.html">Velocity Generator</link>.
  +   </p>
  +  </s1>
  + </body>
  +</document>