You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by co...@apache.org on 2003/07/21 00:53:41 UTC

cvs commit: cocoon-2.1/src/blocks/jxforms/samples/wizard confirm.xml deployment.xml end.xml feedbackWizard.js schematron.xml start.xml system.xml userIdentity.xml

coliver     2003/07/20 15:53:41

  Modified:    src/blocks/jxforms/java/org/apache/cocoon/components/jxforms/flow/javascript
                        JXForm.java JXForm.js
               src/blocks/jxforms/samples sitemap.xmap
  Added:       src/blocks/jxforms/samples samples.xml
               src/blocks/jxforms/samples/calc NumberA.xml NumberB.xml
                        Operator.xml Result.xml calc.js
               src/blocks/jxforms/samples/wizard confirm.xml deployment.xml
                        end.xml feedbackWizard.js schematron.xml start.xml
                        system.xml userIdentity.xml
  Removed:     src/blocks/jxforms/samples/flow feedbackWizard.js
               src/blocks/jxforms/samples/schematron
                        wizard-xmlform-sch-report.xml
               src/blocks/jxforms/samples/view confirm.xml deployment.xml
                        end.xml start.xml system.xml userIdentity.xml
  Log:
  Renamed jxForm() to jxform() and improved samples
  
  Revision  Changes    Path
  1.4       +15 -8     cocoon-2.1/src/blocks/jxforms/java/org/apache/cocoon/components/jxforms/flow/javascript/JXForm.java
  
  Index: JXForm.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/jxforms/java/org/apache/cocoon/components/jxforms/flow/javascript/JXForm.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JXForm.java	19 Jul 2003 20:18:49 -0000	1.3
  +++ JXForm.java	20 Jul 2003 22:53:40 -0000	1.4
  @@ -73,7 +73,6 @@
       String id;
       String validatorNamespace;
       String validatorDocument;
  -    String scope;
       String submitId;
   
       private FOM_Cocoon getCocoon() {
  @@ -91,18 +90,26 @@
                                              boolean inNewExpr)
           throws Exception {
           String id;
  -        String validatorNS;
  -        String validatorDoc;
  -        String scope;
  +        String validatorNS = null;
  +        String validatorDoc = null;
  +        if (args.length < 1) {
  +            throw new JavaScriptException("Expected an argument");
  +        }
           id = org.mozilla.javascript.Context.toString(args[0]);
  -        validatorNS = args[1] == null ? null : org.mozilla.javascript.Context.toString(args[1]);
  -        validatorDoc = args[2] == null ? null : org.mozilla.javascript.Context.toString(args[2]);
  -        scope = org.mozilla.javascript.Context.toString(args[3]);
  +        if (args.length > 1) {
  +            validatorNS = (args[1] == null || args[1] == Undefined.instance) ?
  +                null : 
  +                org.mozilla.javascript.Context.toString(args[1]);
  +            if (args.length > 2) {
  +                validatorDoc = (args[2] == null || args[2] == Undefined.instance) ? 
  +                    null : 
  +                    org.mozilla.javascript.Context.toString(args[2]);
  +            }
  +        }
           JXForm result = new JXForm();
           result.id = id;
           result.validatorNamespace = validatorNS;
           result.validatorDocument = validatorDoc;
  -        result.scope = scope;
           return result;
       }
   
  
  
  
  1.2       +8 -8      cocoon-2.1/src/blocks/jxforms/java/org/apache/cocoon/components/jxforms/flow/javascript/JXForm.js
  
  Index: JXForm.js
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/jxforms/java/org/apache/cocoon/components/jxforms/flow/javascript/JXForm.js,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JXForm.js	12 Jul 2003 19:22:29 -0000	1.1
  +++ JXForm.js	20 Jul 2003 22:53:40 -0000	1.2
  @@ -95,7 +95,6 @@
       if (bizData == undefined) {
           bizData = null;
       }
  -    this.lastWebContinuation = wk;
       this.forwardTo(uri, bizData, wk);
       JXForm.suicide();
   }
  @@ -159,7 +158,11 @@
    * @param scope [String] one of "request" or "session"
    */
   
  -function jxForm(application, id, validator_ns, validator_doc, scope) {
  +function jxform(application, id, validator_ns, validator_doc) {
  +    if (this[application] == undefined || 
  +	!(this[application] instanceof Function)) {
  +      throw new Packages.org.apache.cocoon.ResourceNotFoundException("Function \"javascript:"+application+"()\" not found");
  +    }
       function getCommand() {
           var enum_ = cocoon.request.getParameterNames();
           var command = undefined;
  @@ -192,10 +195,7 @@
           return;
       } 
       // Just start a new instance of the application
  -    var args = new Array(arguments.length - 5 + 1);
  -    args[0] = new JXForm(id, validator_ns, validator_doc, scope);
  -    for (var i = 5; i < arguments.length; i++) {
  -      args[i-4] = arguments[i];
  -    }
  -    this[application].apply(this, args);
  +    print("hello");
  +    this[application].apply(this, 
  +			    [new JXForm(id, validator_ns, validator_doc, undefined)]);
   }
  
  
  
  1.2       +45 -7     cocoon-2.1/src/blocks/jxforms/samples/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/jxforms/samples/sitemap.xmap,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- sitemap.xmap	12 Jul 2003 19:22:30 -0000	1.1
  +++ sitemap.xmap	20 Jul 2003 22:53:40 -0000	1.2
  @@ -39,26 +39,40 @@
   
     <!-- =========================== Pipelines ================================= -->
     <map:flow language="javascript">
  -     <map:script src="flow/feedbackWizard.js"/>
  +     <map:script src="calc/calc.js"/>
  +     <map:script src="wizard/feedbackWizard.js"/>
     </map:flow>
   
  +
     <map:pipelines> 
     
       <map:pipeline>
   
         <map:match pattern="">
  -        <map:call function="jxForm">
  +        <map:redirect-to uri="welcome"/>
  +      </map:match>
  +
  +      <map:match pattern="welcome">
  +        <map:generate src="samples.xml"/>
  +        <map:transform src="context://samples/common/style/xsl/html/simple-samples2html.xsl">
  +          <map:parameter name="contextPath" value="{request:contextPath}"/>
  +        </map:transform>
  +        <map:serialize/>
  +      </map:match>
  +
  +      <map:match pattern="wizard/">
  +        <map:call function="jxform">
             <map:parameter name="function" value="feedbackWizard"/>
   	  <map:parameter name="id" value="form-feedback"/>
  -          <map:parameter name="schema-ns" value="http://www.ascc.net/xml/schematron"/>
  -          <map:parameter name="validator-schema" value="schematron/wizard-xmlform-sch-report.xml"/>
  -          <map:parameter name="scope" value="request"/>
  +          <map:parameter name="validatorNamespace" value="http://www.ascc.net/xml/schematron"/>
  +          <map:parameter name="validatorSchema" value="wizard/schematron.xml"/>
  +
           </map:call>
         </map:match>
   
  -      <map:match pattern="view/*.xml">
  +      <map:match pattern="wizard/*.xml">
   	      <!-- original XMLForm document -->
  -	      <map:generate type="jxforms" src="view/{1}.xml"/>
  +	      <map:generate type="jxforms" src="wizard/{1}.xml"/>
   	
   	      <!-- Personalize the look and feel of the form controls  -->
   	      <map:transform type="xalan" src="stylesheets/wizard2html.xsl" />
  @@ -72,6 +86,30 @@
   	      <!-- sending the HTML back to the browser -->
   	      <map:serialize type="html" label="debug"/>
   	</map:match>	      
  +
  +      <map:match pattern="calc/">
  +        <map:call function="jxform">
  +          <map:parameter name="function" value="calculator"/>
  +	  <map:parameter name="id" value="calc"/>
  +        </map:call>
  +      </map:match>
  +
  +      <map:match pattern="calc/*.xml">
  +          <!-- original XMLForm document -->
  +          <map:generate type="jxforms" src="calc/{1}.xml"/>
  +
  +          <!-- personalizing the look and feel of the form controls  -->
  +          <map:transform src="context://samples/common/style/xsl/html/complex-page2html.xsl">
  +            <map:parameter name="contextPath" value="{request:contextPath}"/>
  +          </map:transform>
  +
  +          <!-- Transforming the XMLForm controls to HTML controls -->
  +          <map:transform src="stylesheets/jxforms2html.xsl" />
  +
  +          <!-- sending the HTML back to the browser -->
  +          <map:serialize type="html" label="debug"/>
  +
  +      </map:match>
   
       </map:pipeline>
   
  
  
  
  1.1                  cocoon-2.1/src/blocks/jxforms/samples/samples.xml
  
  Index: samples.xml
  ===================================================================
  <samples xmlns:xlink="http://www.w3.org/1999/xlink">
   
   <group name="Main examples page.">
    <sample name="Back" href="..">to Cocoon examples main page</sample>
   </group>
  
   <group name="Application">
    <sample name="Wizard" href="wizard/">
     Presents a sophisticated form handling demo ... multi-page wizard with <em>automatic</em> two-way navigation, based on Cocoon Flowscript.
    </sample>
    <sample name="Calculator" href="calc/">
     JXForms calculator sample
    </sample>
   </group>
  
  </samples>
  
  
  
  1.1                  cocoon-2.1/src/blocks/jxforms/samples/calc/NumberA.xml
  
  Index: NumberA.xml
  ===================================================================
  <?xml version="1.0"?>
  <document>
    <header>
      <title>JXForms: Calculator</title>
      <tab title="Back" href=".."/>
    </header>
    <body>
      <section>
        <title>Number A</title>
        <xf:form id="calc" xmlns:xf="http://apache.org/cocoon/jxforms/1.0">
          <p>
            Enter value of <strong>a</strong><br/>
            <xf:input ref="numberA"/>
          </p>
          <p>
            <xf:submit id="next" continuation="forward" class="button">
              <xf:label>Next</xf:label>
            </xf:submit>
          </p>
        </xf:form>
      </section>
    </body>
  </document>
  
  
  
  
  1.1                  cocoon-2.1/src/blocks/jxforms/samples/calc/NumberB.xml
  
  Index: NumberB.xml
  ===================================================================
  <?xml version="1.0"?>
  <document>
    <header>
      <title>JXForms: Calculator</title>
      <tab title="Back" href=".."/>
    </header>
    <body>
      <section>
        <title>Number B</title>
        <xf:form id="calc" xmlns:xf="http://apache.org/cocoon/jxforms/1.0">
          <p>
            a = <xf:output ref="numberA"/>
          </p>
          <p>
            Enter value of <strong>b</strong><br/>
            <xf:input ref="numberB"/>
          </p>
          <p>
            <xf:submit id="prev" continuation="back" class="button">
              <xf:label>Prev</xf:label>
            </xf:submit>
            <xf:submit id="next" continuation="forward" class="button">
              <xf:label>Next</xf:label>
            </xf:submit>
          </p>
        </xf:form>
      </section>
    </body>
  </document>
  
  
  
  
  1.1                  cocoon-2.1/src/blocks/jxforms/samples/calc/Operator.xml
  
  Index: Operator.xml
  ===================================================================
  <?xml version="1.0"?>
  <document>
    <header>
      <title>JXForms: Calculator</title>
      <tab title="Back" href=".."/>
    </header>
    <body>
      <section>
        <title>Operator</title>
        <xf:form id="calc" xmlns:xf="http://apache.org/cocoon/jxforms/1.0">
          <p>
            a = <xf:output ref="numberA"/>
          </p>
          <p>
            b = <xf:output ref="numberB"/>
          </p>
          <p>
            Enter operator<br/>
            <xf:select1 ref="operator">
              <xf:item id="plus">
                <xf:label>Plus</xf:label>
                <xf:value>plus</xf:value>
              </xf:item>
              <xf:item id="minus">
                <xf:label>Minus</xf:label>
                <xf:value>minus</xf:value>
              </xf:item>
              <xf:item id="multiply">
                <xf:label>Multiply</xf:label>
                <xf:value>multiply</xf:value>
              </xf:item>  
              <xf:item id="divide">
                <xf:label>Divide</xf:label>
                <xf:value>divide</xf:value>
              </xf:item>
            </xf:select1>
          </p>
          <p>
            <xf:submit id="prev" continuation="back" class="button">
              <xf:label>Prev</xf:label>
            </xf:submit>
            <xf:submit id="next" continuation="forward" class="button">
              <xf:label>Next</xf:label>
            </xf:submit>
          </p>
        </xf:form>
      </section>
    </body>
  </document>
  
  
  
  1.1                  cocoon-2.1/src/blocks/jxforms/samples/calc/Result.xml
  
  Index: Result.xml
  ===================================================================
  <?xml version="1.0"?>
  <document>
    <header>
      <title>JXForms: Calculator</title>
      <tab title="Back" href=".."/>
    </header>
    <body>
      <section>
        <title>Result</title>
        <xf:form id="calc" xmlns:xf="http://apache.org/cocoon/jxforms/1.0">
          <p>
            a = <xf:output ref="numberA"/>
          </p>
          <p>
            b = <xf:output ref="numberB"/>
          </p>
          <p>
            operator = <xf:output ref="operator"/>
          </p>
          <p>
            result = <xf:output ref="result"/>
          </p>
          <p>
            <xf:submit id="prev" continuation="back" class="button">
              <xf:label>Prev</xf:label>
            </xf:submit>
            <xf:submit id="next" continuation="forward" class="button">
              <xf:label>Next</xf:label>
            </xf:submit>
          </p>
        </xf:form>
      </section>
    </body>
  </document>
  
  
  
  1.1                  cocoon-2.1/src/blocks/jxforms/samples/calc/calc.js
  
  Index: calc.js
  ===================================================================
  cocoon.load("resource://org/apache/cocoon/components/jxforms/flow/javascript/JXForm.js");
  
  function calculator(form) {
    var model = {
      numberA: 0,
      numberB: 0,
      operator: "plus",
      result: 0
    };
    form.setModel(model);
    form.sendView("calc/NumberA.xml");
    form.sendView("calc/NumberB.xml");
    form.sendView("calc/Operator.xml");
    switch (model.operator) {
    case "plus":
      model.result = Number(model.numberA) + Number(model.numberB);
      break;
    case "minus":
      model.result = model.numberA - model.numberB;
      break;
    case "multiply":
      model.result = model.numberA * model.numberB;
      break;
    case "divide":
      model.result = model.numberA / model.numberB;
      break;
    }
    form.sendView("calc/Result.xml");
    calculator(form); // repeat (Note recursive tail call)
  }
  
  
  
  1.1                  cocoon-2.1/src/blocks/jxforms/samples/wizard/confirm.xml
  
  Index: confirm.xml
  ===================================================================
  <?xml version="1.0"?>
  <document xmlns:xf="http://apache.org/cocoon/jxforms/1.0">
    <xf:form id="form-feedback" view="confirm">
      <xf:label>Confirm Input</xf:label>
      <!-- from page1 -->
      <xf:output ref="firstName">
        <xf:label>First Name</xf:label>
      </xf:output>
      <xf:output ref="lastName">
        <xf:label>Last Name</xf:label>
      </xf:output>
      <xf:output ref="email">
        <xf:label>Email</xf:label>
      </xf:output>
      <xf:output ref="age">
        <xf:label>Age</xf:label>
        <xf:violations class="error"/>
      </xf:output>
      <xf:group ref="/">
        <xf:label>Professional roles</xf:label>
        <xf:repeat nodeset="role">
          <xf:output ref="."/>
        </xf:repeat>
      </xf:group>
      <xf:group ref="/">
        <xf:label>Personal hobbies</xf:label>
        <xf:repeat nodeset="hobby">
          <xf:output ref="."/>
        </xf:repeat>
      </xf:group>
      <xf:output ref="hidden">
        <xf:label>Hidden attribute</xf:label>
      </xf:output>
      <!-- from page2 -->
      <xf:output ref="number">
        <xf:label>Number of installations</xf:label>
      </xf:output>
      <xf:output ref="liveUrl">
        <xf:label>Live URL</xf:label>
      </xf:output>
      <xf:output ref="publish">
        <xf:label>Publish URL</xf:label>
      </xf:output>
      <!-- from page3 -->
      <xf:output ref="system/os">
        <xf:label>OS</xf:label>
      </xf:output>
      <xf:output ref="system/processor">
        <xf:label>Processor</xf:label>
      </xf:output>
      <xf:output ref="system/@ram">
        <xf:label>RAM</xf:label>
      </xf:output>
      <xf:output ref="system/servletEngine">
        <xf:label>Servlet Engine</xf:label>
      </xf:output>
      <xf:output ref="system/javaVersion">
        <xf:label>Java Version</xf:label>
      </xf:output>
      <xf:group ref="/" id="favorites_group">
        <xf:label>Favorite web sites</xf:label>
        <xf:repeat nodeset="favorite[position() &lt;= 3]" id="favorites">
          <xf:output ref="." class="info">
            <xf:label>URL: </xf:label>
          </xf:output>
        </xf:repeat>
      </xf:group>
      <!-- submit -->
      <xf:submit id="prev" continuation="back" class="button">
        <xf:label>Prev</xf:label>
        <xf:hint>Go to previous page</xf:hint>
      </xf:submit>
      <xf:submit id="next" continuation="forward" class="button">
        <xf:label>Finish</xf:label>
        <xf:hint>Finish the wizard</xf:hint>
      </xf:submit>
    </xf:form>
    <xf:output ref="count" id="show_count" form="form-feedback" class="info">
      <xf:label>Visits Count</xf:label>
    </xf:output>
  </document>
  
  
  
  1.1                  cocoon-2.1/src/blocks/jxforms/samples/wizard/deployment.xml
  
  Index: deployment.xml
  ===================================================================
  <?xml version="1.0"?>
  <document xmlns:xf="http://apache.org/cocoon/jxforms/1.0">
  	<xf:form id="form-feedback" view="deployment">
  		<xf:label>Cocoon Deployment Information</xf:label>
  		<error>
  			<xf:violations class="error"/>
  		</error>
  		<xf:input ref="/number">
  			<xf:label>Number of deployments</xf:label>
  			<xf:violations class="error"/>
  		</xf:input>
  		<xf:input ref="/liveUrl">
  			<xf:label>Live URL</xf:label>
  			<xf:help>You must enter a valid URL</xf:help>
  			<xf:violations class="error"/>
  		</xf:input>
  		<xf:select1 ref="/publish" appearance="full">
  			<xf:label>Publish</xf:label>
                          <xf:item>
                             <xf:label>Yes</xf:label>
                             <xf:value>true</xf:value>
                          </xf:item>
                          <xf:item>
                             <xf:label>No</xf:label>
                             <xf:value></xf:value>
                          </xf:item>
  		</xf:select1>
  		<xf:group nodeset="" id="favorites_group">
  			<xf:label>Favorite web sites</xf:label>
  			<!-- 
                repeat is a very powerful iterator tag,
                because it iterates over a nodeset resulting from
                the 'nodeset' selector attribute.
                Very similar to xslt's for-each tag.
  
                In this case we iterate over the top three favorite
                web sites.
              -->
  			<xf:repeat nodeset="favorite[position() &lt;= 3]" id="favorites">
  				<xf:input ref="." class="info">
  					<xf:label>URL:</xf:label>
  				</xf:input>
  			</xf:repeat>
  		</xf:group>
  		<xf:submit id="prev" continuation="back" class="button">
  			<xf:label>Prev</xf:label>
  			<xf:hint>Go to previous page</xf:hint>
  		</xf:submit>
  		<xf:submit id="next" continuation="forward" class="button">
  			<xf:label>Next</xf:label>
  			<xf:hint>Go to next page</xf:hint>
  		</xf:submit>
  	</xf:form>
  	<xf:output ref="count" id="show_count" form="form-feedback" class="info">
  		<xf:label>Visits Count</xf:label>
  	</xf:output>
  </document>
  
  
  
  1.1                  cocoon-2.1/src/blocks/jxforms/samples/wizard/end.xml
  
  Index: end.xml
  ===================================================================
  <?xml version="1.0" ?>
  <document>
      <br/><br/><br/>
      <table align="center" width="50%" cellspacing="20">
          <tr>
              <td align="center">
                  <h1>
                      Congratulations, Wizard Complete!
                  </h1>
              </td>
          </tr>
  
          <tr>
              <td align="center" class="info">
                  <code>
                      Your feedback form was processed successfully.
                  </code>
              </td>
          </tr>
           
          <tr>
              <td align="center">
                  <h3>
                      <a href="../">Go to home page.</a>
                  </h3>
              </td>
          </tr>
      </table>
  </document>
  
  
  
  
  1.1                  cocoon-2.1/src/blocks/jxforms/samples/wizard/feedbackWizard.js
  
  Index: feedbackWizard.js
  ===================================================================
  // Feedback Wizard Sample
  
  cocoon.load("resource://org/apache/cocoon/components/jxforms/flow/javascript/JXForm.js");
  
  function feedbackWizard(form) {
      var bean = {
          firstName: "Donald",
          lastName: "Duck",
          email: "donald_duck@disneyland.com",
          age: 5,
          number: 1,
          liveUrl: "http://",
          publish: true,
          hidden: true,
          count: 1,
          notes: "<your notes here>",
          favorite: ["http://xml.apache/org/cocoon", 
                     "http://jakarta.apache.org",
                     "http://www.google.com",
                     "http://www.slashdot.com",
                     "http://www.yahoo.com"],
          hobby: ["swim", "movies", "ski", "gym", "soccer"],
          allHobbies: [
              {
                  key: "swim",
                  value: "Swimming"
              },
              {
                  key: "gym", 
                  value: "Body Building"
              },
              {
                  key: "ski", 
                  value: "Skiing"
              },
              {
                  key: "run", 
                  value: "Running"
              },
              {  
                  key: "football", 
                  value: "Football"
              },
              {
                  key: "read",
                  value: "Reading" 
              },
              {
                  key: "write",
                  value: "Writing"
              },
              {
                  key: "soccer:",
                  value: "Soccer" 
              },
              {
                  key: "blog",
                  value: "Blogging" 
              }],
          role: ["Hacker", "Executive"],
          system: {
              os: "Unix",
              processor: "p4",
              ram: 512,
              servletEngine: "Tomcat",
              javaVersion: "1.3",
          }
      }
  
      form.setModel(bean);
  
      form.sendView("wizard/userIdentity.xml",
                    function(form) {
          var bean = form.getModel();
          cocoon.log.info("I can also do validation in JavaScript");
          cocoon.log.info("age = "+form.getValue("number(/age)"));
          cocoon.log.info("role = "+bean.role);
          if (bean.age > 40) {
              form.addViolation("/age", "Hey, you're too old");
          }
      });
      cocoon.log.info("handling user identity");
  
      form.sendView("wizard/deployment.xml", 
                    function(form) {
          var bean = form.getModel();
          cocoon.log.info("I can also do validation in JavaScript");
          if (bean.publish) {
              form.addViolation("/publish", "Sorry, I won't let you publish");
          }
      });
      cocoon.log.info("handling deployment");
  
      form.sendView("wizard/system.xml");
      cocoon.log.info("handling system");
  
      form.sendView("wizard/confirm.xml");
      cocoon.log.info("handling confirm");
  
      form.finish("wizard/end.xml");
      cocoon.log.info("done");
  }
  
  
  
  1.1                  cocoon-2.1/src/blocks/jxforms/samples/wizard/schematron.xml
  
  Index: schematron.xml
  ===================================================================
  <?xml version="1.0" ?>
  <!--
  
  	Validating Schematron schema for the JXForms example wizard
    
    Schematron Schema language home page:
    http://www.ascc.net/xml/schematron/
    
  
  -->
  <schema ns="http://xml.apache.cocoon/jxforms"
  	xmlns="http://www.ascc.net/xml/schematron">
  	<title>Schema for the JXForms example</title>
  	<phase id="userIdentity">
  		<p>For user identity information.</p>
  		<active pattern="user"/>
  	</phase>
  	<phase id="deployment">
  		<p>For deployment info page.</p>
  		<active pattern="dep" />
  	</phase>
  	<phase id="system">
  		<p>For system info page.</p>
  		<active pattern="sys" />
  	</phase>
  	<phase id="confirm">
  		<p>For final total validation and tracking some tricky problems.</p>
  		<active pattern="user" />
  		<active pattern="dep" />
  		<active pattern="sys" />
  	</phase>
  	<pattern name="User Info Validation Pattern" id="user">
  		<rule context="/firstName">
  			<assert test="string-length(.) &gt; 3">First name <anametag/> 
  				<wrapper>should</wrapper> be at least 4 characters.</assert>
  			<assert test="string-length(.) &lt; 20">First name should be less
  				than 20 characters.</assert>
  		</rule>
  		<rule context="/lastName">
  			<assert test="string-length(.) &gt; 3">Last name should be at least
  				4 characters.</assert>
  			<assert test="string-length(.) &lt; 20">Last name should be less
  				than 20 characters.</assert>
  		</rule>
  		<rule context="/email">
  			<assert test="contains( string(.),'@')">Email format is invalid.</assert>
  		</rule>
  		<rule context="/age">
  			<assert test="number() &gt; 0 and number(.) &lt; 200">Age should be
  				a reasonably big positive number.</assert>
  		</rule>
  	</pattern>
  	<pattern name="Deployment Information Validation Pattern" id="dep">
  		<rule context="/number">
  			<assert test="number() &gt; 0">The number of deployments must be
  				non-negative ( hopefully positive :-> ) .</assert>
  		</rule>
  		<rule context="/">
  			<!-- 
          If the site is to be published, then verify the URL.
          Note: This assertion demonstrates the unique ability of 
          Schematron to test document node dependencies.
          This is not possible to do with XML Schema and Relax NG.
         -->
  			<assert
  				test="not(string(publish) = 'true') or (starts-with(liveUrl, 'http://') and contains( string(liveUrl),'.') ) "
  				>The URL of the published site is invalid.</assert>
  		</rule>
  	</pattern>
  	<pattern name="System Information Validation Pattern" id="sys">
  		<rule context="/system/@ram">
  			<assert test="number() &gt; 0">The RAM value should be a positive
  				number, denoting the memory in MB (e.g. 128, 512, etc.).</assert>
  		</rule>
  	</pattern>
  </schema>
  
  
  
  1.1                  cocoon-2.1/src/blocks/jxforms/samples/wizard/start.xml
  
  Index: start.xml
  ===================================================================
  <?xml version="1.0" ?>
  
  <document>
      <br/><br/><br/>
      <table align="center" width="50%" cellspacing="20">
          <tr>
              <td align="center">
                  <h1>
                      Welcome !
                  </h1>
              </td>
          </tr>
  
          <tr>
              <td align="center" class="info">
                  <p>
                  This wizard will collect feedback information
                  for the     
                  <a href="http://xml.apache.org/cocoon/">Apache Cocoon</a>
                  project.
                  </p>
                  <p>
                   See <a href="overview.html">overview</a> documentation.
                  </p>
              </td>
          </tr>
           
          <tr>
              <td align="center">
                  <h3>
                      <a href="flow?cocoon-action-start=true">
                          Start!
                      </a>
                  </h3>
              </td>
          </tr>
      </table>
  </document>
  
  
  
  1.1                  cocoon-2.1/src/blocks/jxforms/samples/wizard/system.xml
  
  Index: system.xml
  ===================================================================
  <?xml version="1.0"?>
  <document xmlns:xf="http://apache.org/cocoon/jxforms/1.0">
    <xf:form id="form-feedback" view="system">
      <xf:label>System Information</xf:label>
      <error>
        <xf:violations class="error"/>
      </error>
      <xf:group ref="/system">
        <xf:select1 ref="os" appearance="full">
          <xf:label>OS</xf:label>
          <xf:item id="unix">
            <xf:label>Unix/Linux</xf:label>
            <xf:value>Unix</xf:value>
          </xf:item>
          <xf:item id="mac">
            <xf:label>Mac OS/X</xf:label>
            <xf:value>Mac OS/X</xf:value>
          </xf:item>
          <xf:item id="win">
            <xf:label>Windows 95/98/NT/2000/XP</xf:label>
            <xf:value>Windows</xf:value>
          </xf:item>
          <xf:item id="other">
            <xf:label>Other</xf:label>
            <xf:value>Other</xf:value>
          </xf:item>
        </xf:select1>
        <xf:select1 ref="processor">
          <xf:label>Processor</xf:label>
          <xf:item>
            <xf:label>AMD/Athlon</xf:label>
            <xf:value>Athlon</xf:value>
          </xf:item>
          <xf:item>
            <xf:label>AMD/Duron</xf:label>
            <xf:value>Duron</xf:value>
          </xf:item>
          <xf:item>
            <xf:label>Pentium Celeron</xf:label>
            <xf:value>Celeron</xf:value>
          </xf:item>
          <xf:item>
            <xf:label>Pentium III</xf:label>
            <xf:value>p3</xf:value>
          </xf:item>
          <xf:item>
            <xf:label>Pentium IV</xf:label>
            <xf:value>p4</xf:value>
          </xf:item>
          <xf:item>
            <xf:label>Other</xf:label>
            <xf:value>other</xf:value>
          </xf:item>
        </xf:select1>
        <xf:input ref="@ram">
          <xf:label>RAM</xf:label>
          <xf:violations class="error"/>
        </xf:input>
        <xf:select1 ref="servletEngine">
          <xf:label>Servlet Engine</xf:label>
          <xf:item>
            <xf:label>Tomcat</xf:label>
            <xf:value>Tomcat</xf:value>
          </xf:item>
          <xf:item>
            <xf:label>Jetty</xf:label>
            <xf:value>Jetty</xf:value>
          </xf:item>
          <xf:item>
            <xf:label>Resin</xf:label>
            <xf:value>Resin</xf:value>
          </xf:item>
          <xf:item>
            <xf:label>Weblogic</xf:label>
            <xf:value>weblogic</xf:value>
          </xf:item>
          <xf:item>
            <xf:label>WebSphere</xf:label>
            <xf:value>WebSphere</xf:value>
          </xf:item>
          <xf:item>
            <xf:label>Other</xf:label>
            <xf:value>other</xf:value>
          </xf:item>
        </xf:select1>
        <xf:select1 ref="javaVersion">
          <xf:label>Java Version</xf:label>
          <xf:item>
            <xf:label>1.1</xf:label>
            <xf:value>1.1</xf:value>
          </xf:item>
          <xf:item>
            <xf:label>1.2</xf:label>
            <xf:value>1.2</xf:value>
          </xf:item>
          <xf:item>
            <xf:label>1.3</xf:label>
            <xf:value>1.3</xf:value>
          </xf:item>
          <xf:item>
            <xf:label>1.4</xf:label>
            <xf:value>1.4</xf:value>
          </xf:item>
          <xf:item>
            <xf:label>Other</xf:label>
            <xf:value>Other</xf:value>
          </xf:item>
        </xf:select1>
      </xf:group>
      <xf:submit id="prev" continuation="back" class="button">
        <xf:label>Prev</xf:label>
        <xf:hint>Go to previous page</xf:hint>
      </xf:submit>
      <xf:submit id="next" continuation="forward" class="button">
        <xf:label>Next</xf:label>
        <xf:hint>Go to next page</xf:hint>
      </xf:submit>
    </xf:form>
    <xf:output ref="count" id="show_count" form="form-feedback" class="info">
      <xf:label>Visits Count</xf:label>
    </xf:output>
  </document>
  
  
  
  1.1                  cocoon-2.1/src/blocks/jxforms/samples/wizard/userIdentity.xml
  
  Index: userIdentity.xml
  ===================================================================
  <?xml version="1.0"?>
  
  <document xmlns:xf="http://apache.org/cocoon/jxforms/1.0">
    <xf:form id="form-feedback" view="userIdentity">
      <xf:label>Personal Information</xf:label>
      <error>
        <xf:violations class="error"/>
      </error>
      <xf:input ref="/firstName">
        <xf:label>First Name</xf:label>
        <xf:violations class="error"/>
      </xf:input>
      <xf:input ref="/lastName">
        <xf:label>Last Name</xf:label>
        <xf:violations class="error"/>
      </xf:input>
      <xf:input ref="/email">
        <xf:label>Email</xf:label>
        <xf:help>Please check this carefully</xf:help>
        <xf:violations class="error"/>
      </xf:input>
      <xf:input ref="/age">
        <xf:label>Age</xf:label>
        <xf:violations class="error"/>
      </xf:input>
      <xf:select ref="/role" appearance="compact">
        <xf:label>Professional roles</xf:label>
        <xf:help>Select one or more</xf:help>
        <xf:item>
          <xf:label>Geek</xf:label>
          <xf:value>Geek</xf:value>
        </xf:item>
        <xf:item>
          <xf:label>Hacker</xf:label>
          <xf:value>Hacker</xf:value>
        </xf:item>
        <xf:item>
          <xf:label>Student</xf:label>
          <xf:value>Student</xf:value>
        </xf:item>
        <xf:item>
          <xf:label>University Professor</xf:label>
          <xf:value>University Professor</xf:value>
        </xf:item>
        <xf:item>
          <xf:label>Software Developer</xf:label>
          <xf:value>Developer</xf:value>
        </xf:item>
        <xf:item>
          <xf:label>Technical Leader</xf:label>
          <xf:value>Tech Lead</xf:value>
        </xf:item>
        <xf:item>
          <xf:label>Development Manager</xf:label>
          <xf:value>Development Manager</xf:value>
        </xf:item>
        <xf:item>
          <xf:label>Executive</xf:label>
          <xf:value>Executive</xf:value>
        </xf:item>
        <xf:item>
          <xf:label>Heir of the Apache tribe</xf:label>
          <xf:value>Heir of the Apache tribe</xf:value>
        </xf:item>
      </xf:select>
      <xf:select ref="/hobby" appearance="full">
        <xf:label>Hobbies</xf:label>
        <xf:itemset nodeset="allHobbies">
          <xf:label ref="value"/>
          <xf:value ref="key"/>
        </xf:itemset>
      </xf:select>
      <xf:textarea ref="notes" style="width:8cm; height:3cm">
        <xf:label>Additional Notes</xf:label>
      </xf:textarea>
      <!-- hidden model attribute -->
      <xf:hidden ref="hidden">
        <xf:value>true</xf:value>
      </xf:hidden>
      <xf:submit id="next" phase="userIdentity" continuation="forward" class="button">
        <xf:label>Next</xf:label>
        <xf:hint>Go to next page</xf:hint>    
      </xf:submit>
    </xf:form>
    <xf:output ref="count" id="show_count" form="form-feedback" class="info">
      <xf:label>Visits Count</xf:label>
    </xf:output>
  </document>