| the Apache XML site |

| Home |

| Community |

| Samples |

# How to build an XMLForm Wizard, Step Five

PDF

- Step Five: The Sitemap
- Revisions

### Step Five: The Sitemap

The Sitemap finally pulls all the previous files together into an understandable whole.

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.

      <!-- =========================== 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>

We add to the pipeline the following tags:

    <!-- 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>

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

    <?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 -->

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.

Use the command:

build webapp -Dinclude.webapp.libs=true -Dinclude.scratchpad.libs=true webapp

Place cocoon.war in your webapp folder if you are using Tomcat then restart Tomcat.

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.

To return to the start

### Revisions

Find a problem with this document? Consider contacting the mailing lists or submitting your own revision. For instructions, read the How To Submit a Revision.

by Heidi Brannan

Copyright © 2002-2003 The Apache Software Foundation. All rights reserved.