<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE howto PUBLIC "-//APACHE//DTD How-to V1.0//EN" "http://apache.org/forrest/dtd/howto-v10.dtd">

<howto>

  <header>
    <title>How to build an XMLForm Wizard, Step Five</title>
    <authors>
      <person name="Heidi Brannan" email="heidi@wkwyw.net"/>
    </authors>
  <abstract></abstract>
  <last-modified-content-date date="2002-05-19"/>
  </header>

    <steps title="Step Five: The Sitemap"> 

      <p>The Sitemap finally pulls all the previous files together into an understandable whole.</p>
      <p>In the components section we add a map:action tag named HowToWizardAction.  This points to the Java file HowToWizardAction which we met in step 4.</p>
      <source>
        <![CDATA[
  <!-- =========================== Components ================================ -->
  <map:components> 
    <map:actions>
      <map:action name="WizardAction" src="org.apache.cocoon.samples.xmlform.WizardAction"  
        logger="webapp.xmlform"/>
      <map:action name="HowtoWizardAction" src="org.apache.cocoon.samples.xmlform.HowtoWizardAction"  
        logger="webapp.xmlform"/>
    </map:actions>
    <map:generators default="file"/>
    <map:transformers default="xslt">
      <map:transformer name="xmlform" src="org.apache.cocoon.transformation.XMLFormTransformer" 
        logger="webapp.xmlform"/>
    </map:transformers>
    <map:readers default="resource"/>
    <map:serializers default="html"/>
    <map:selectors default="browser"/>
    <map:matchers default="wildcard">
      <map:matcher name="wildcard" src="org.apache.cocoon.matching.WildcardURIMatcherFactory"/>
    </map:matchers>
  </map:components>
]]>
      </source>  
      <p>We add to the pipeline the following tags:</p>
      <source>
        <![CDATA[
<!-- A non-trivial example - Feedback HowTo Wizard -->
<map:match pattern="howto-wizard.html">
  <map:act type="HowtoWizardAction">

    <!-- XMLForm parameters for the AbstractXMLFormAction -->
    <map:parameter name="xmlform-validator-schema-ns" value="http://www.ascc.net/xml/schematron"/>
    <map:parameter name="xmlform-validator-schema" value="schematron/howto-xmlform-sch-report.xml"/>
    <map:parameter name="xmlform-id" value="form-feedback"/>
    <map:parameter name="xmlform-scope" value="session"/>
    <map:parameter name="xmlform-model" value="org.apache.cocoon.samples.xmlform.HowToBean"/>

    <!-- Content transformation logic -->
    <map:generate src="howto/{page}.xml"/>
    <map:transform type="xmlform" label="xml"/>
    <map:transform src="stylesheets/wizard2html.xsl"/>
    <map:transform src="stylesheets/xmlform2html.xsl"/>
    <map:serialize type="html"/>
  </map:act>
</map:match>         
]]>
      </source>     
      <p>The whole sitemap.xmap is below so you can just copy this over your current sitemap if you like. Your current sitemap is located in \apache\xml-cocoon2\src\scratchpad\webapp\mount\xmlform</p>
      <source>
      <![CDATA[
<?xml version="1.0"?>
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">

  <!-- =========================== Components ================================ -->
  <map:components> 
    <map:actions>
      <map:action name="WizardAction" src="org.apache.cocoon.samples.xmlform.WizardAction"  
        logger="webapp.xmlform"/>
      <map:action name="HowtoWizardAction" src="org.apache.cocoon.samples.xmlform.HowtoWizardAction"  
        logger="webapp.xmlform"/>
    </map:actions>
    <map:generators default="file"/>
    <map:transformers default="xslt">
      <map:transformer name="xmlform" src="org.apache.cocoon.transformation.XMLFormTransformer" 
        logger="webapp.xmlform"/>
    </map:transformers>
    <map:readers default="resource"/>
    <map:serializers default="html"/>
    <map:selectors default="browser"/>
    <map:matchers default="wildcard">
      <map:matcher name="wildcard" src="org.apache.cocoon.matching.WildcardURIMatcherFactory"/>
    </map:matchers>
  </map:components>

  <!-- =========================== Resources ================================= -->
  <map:resources>
  </map:resources>

  <!-- =========================== Pipelines ================================= -->
  <map:pipelines> 
<map:pipeline>
      
      <map:match pattern="">
        <map:redirect-to uri="wizard.html"/>
      </map:match>

      <!-- A non-trivial example - Feedback Wizard -->
      <map:match pattern="wizard.html">
        <map:act type="WizardAction">

          <!-- XMLForm parameters for the AbstractXMLFormAction -->
          <map:parameter name="xmlform-validator-schema-ns"
            value="http://www.ascc.net/xml/schematron"/>
          <map:parameter name="xmlform-validator-schema"
            value="schematron/wizard-xmlform-sch-report.xml"/>
          <map:parameter name="xmlform-id" value="form-feedback"/>
          <map:parameter name="xmlform-scope" value="session"/>
          <map:parameter name="xmlform-model"
            value="org.apache.cocoon.samples.xmlform.UserBean"/>

          <!-- Content transformation logic -->
          <map:generate src="wizard/{page}.xml"/>
          <map:transform type="xmlform" label="xml"/>
          <map:transform src="stylesheets/wizard2html.xsl"/>
          <map:transform src="stylesheets/xmlform2html.xsl"/>
          <map:serialize type="html"/>
        </map:act>
      </map:match>  
<map:match pattern="">
        <map:redirect-to uri="wizard.html"/>
      </map:match>

      <!-- A non-trivial example - Feedback HowTo Wizard -->
      <map:match pattern="howto-wizard.html">
        <map:act type="HowtoWizardAction">

          <!-- XMLForm parameters for the AbstractXMLFormAction -->
          <map:parameter name="xmlform-validator-schema-ns"
            value="http://www.ascc.net/xml/schematron"/>
          <map:parameter name="xmlform-validator-schema"
            value="schematron/howto-xmlform-sch-report.xml"/>
          <map:parameter name="xmlform-id" value="form-feedback"/>
          <map:parameter name="xmlform-scope" value="session"/>
          <map:parameter name="xmlform-model"
            value="org.apache.cocoon.samples.xmlform.HowToBean"/>

          <!-- Content transformation logic -->
          <map:generate src="howto/{page}.xml"/>
          <map:transform type="xmlform" label="xml"/>
          <map:transform src="stylesheets/wizard2html.xsl"/>
          <map:transform src="stylesheets/xmlform2html.xsl"/>
          <map:serialize type="html"/>
        </map:act>
      </map:match> 
    </map:pipeline>
  </map:pipelines> 
</map:sitemap>
<!-- end of file -->
]]>
      </source>
      <p>Congratulations! Now you have covered everything you need to create the mailing list forms.  Now all you need to do is to build the files and then deploy them in your web server.</p>
      <p>Use the command:</p>
      <p>build webapp -Dinclude.webapp.libs=true -Dinclude.scratchpad.libs=true webapp</p>
      <p>Place cocoon.war in your webapp folder if you are using Tomcat then restart Tomcat.</p>
      <p>In a browser go to http://localhost:8080/cocoon/mount/xmlform/howto-wizard.html and you should see the start page of the mailing list forms.</p>
      <p>To return to the <link href="site:xmlform/intro">start</link></p>
    </steps>

</howto>
