You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by ha...@apache.org on 2002/12/03 17:44:09 UTC

cvs commit: xml-cocoon2/src/documentation/xdocs/userdocs/concepts modules.xml

haul        2002/12/03 08:44:09

  Modified:    src/webapp/WEB-INF cocoon.xconf
               src/java/org/apache/cocoon/components/modules/input
                        AbstractJXPathModule.java
               src/java/org/apache/cocoon/components/language/markup/xsp/java
                        xsp.xsl
               src/documentation/xdocs/userdocs/concepts modules.xml
  Added:       src/java/org/apache/cocoon/components/modules/input
                        SimpleMappingMetaModule.java XMLFileModule.java
               src/java/org/apache/cocoon/components/language/markup/xsp
                        XSPModuleHelper.java
               src/java/org/apache/cocoon/components/language/markup/xsp/java
                        input.xsl
  Log:
    <action dev="CH" type="fix">
     New Logicsheet for use with InputModules.
    </action>
    <action dev="CH" type="add">
     xsp.xsl now includes all xsp:init-page tags. Additional xsp:exit-page tag for
     cleanup operations.
    </action>
    <action dev="CH" type="add">
     New InputModule to map parameter names to / from another name. Uses translation
     table and additional prefix / suffix. New InputModule to access contents of
     an XMLFile using JXPath, based on patch from Jeff Turner (jefft@apache.org).
    </action>
  
  Revision  Changes    Path
  1.44      +7 -0      xml-cocoon2/src/webapp/WEB-INF/cocoon.xconf
  
  Index: cocoon.xconf
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/webapp/WEB-INF/cocoon.xconf,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- cocoon.xconf	13 Nov 2002 22:09:43 -0000	1.43
  +++ cocoon.xconf	3 Dec 2002 16:44:08 -0000	1.44
  @@ -355,6 +355,13 @@
             <parameter name="href" value="resource://org/apache/cocoon/components/language/markup/xsp/java/jpath.xsl"/>
           </builtin-logicsheet>
   
  +        <!-- The input logicsheet allows easy access to InputModules -->
  +        <builtin-logicsheet>
  +          <parameter name="prefix" value="input"/>
  +          <parameter name="uri" value="http://apache.org/cocoon/xsp/input/1.0"/>
  +          <parameter name="href" value="resource://org/apache/cocoon/components/language/markup/xsp/java/input.xsl"/>
  +        </builtin-logicsheet>
  +
         </target-language>
       
         <!-- XSP in Javascript -->
  
  
  
  1.4       +4 -4      xml-cocoon2/src/java/org/apache/cocoon/components/modules/input/AbstractJXPathModule.java
  
  Index: AbstractJXPathModule.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/modules/input/AbstractJXPathModule.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AbstractJXPathModule.java	17 Nov 2002 18:00:03 -0000	1.3
  +++ AbstractJXPathModule.java	3 Dec 2002 16:44:08 -0000	1.4
  @@ -220,8 +220,8 @@
                                  Map objectModel)
           throws ConfigurationException {
   
  +        Object contextObj = getContextObject(modeConf, objectModel);
           try {
  -            Object contextObj = getContextObject(modeConf, objectModel);
               JXPathContext jxContext = JXPathContext.newContext(contextObj);
               setupExtensions(jxContext, modeConf);
               return jxContext.getValue(name);
  @@ -259,8 +259,8 @@
       public Object[] getAttributeValues(String name, Configuration modeConf, Map objectModel)
           throws ConfigurationException {
   
  +        Object contextObj = getContextObject(modeConf, objectModel);
           try {
  -            Object contextObj = getContextObject(modeConf, objectModel);
               JXPathContext jxContext = JXPathContext.newContext(contextObj);
               List values = new LinkedList();
               setupExtensions(jxContext, modeConf);
  @@ -284,5 +284,5 @@
        * Examples are: request, session and application context objects.
        */
       protected abstract Object getContextObject(Configuration modeConf,
  -                                               Map objectModel);
  +                                               Map objectModel) throws ConfigurationException;
   }
  
  
  
  1.2       +306 -0    xml-cocoon2/src/java/org/apache/cocoon/components/modules/input/SimpleMappingMetaModule.java
  
  
  
  
  1.1                  xml-cocoon2/src/java/org/apache/cocoon/components/modules/input/XMLFileModule.java
  
  Index: XMLFileModule.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Apache Cocoon" and  "Apache Software Foundation" must  not  be
      used to  endorse or promote  products derived from  this software without
      prior written permission. For written permission, please contact
      apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation and was  originally created by
   Stefano Mazzocchi  <st...@apache.org>. For more  information on the Apache
   Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.cocoon.components.modules.input;
  
  import java.util.Map;
  import java.util.HashMap;
  import java.util.Collections;
  
  import org.apache.avalon.framework.component.Composable;
  import org.apache.avalon.framework.component.ComponentManager;
  import org.apache.avalon.framework.component.ComponentException;
  import org.apache.avalon.framework.configuration.Configuration;
  import org.apache.avalon.framework.configuration.ConfigurationException;
  import org.apache.avalon.framework.logger.Logger;
  import org.apache.avalon.framework.thread.ThreadSafe;
  
  import org.apache.excalibur.source.Source;
  import org.apache.excalibur.source.SourceResolver;
  import org.apache.excalibur.source.SourceValidity;
  
  import org.apache.cocoon.components.source.SourceUtil;
  import org.w3c.dom.Document;
  
  /**
   * This module reads an XML file from any source available to the
   * system, parses it and returns a Document. Parts can be accessed
   * using XPath syntax. Sources can be held in memory for better
   * perfomance and reloaded if changed.
   *
   * <p> Caching and reloading can be turned on / off (default: on)
   * through <code>&lt;reloadable&gt;false&lt;/reloadable&gt;</code> and
   * <code>&lt;cachable&gt;false&lt;/cachable&gt;</code>. The file
   * (source) to use is specified through <code>&lt;file
   * src="protocol:path/to/file.xml" reloadable="true"
   * cachable="true"/&gt;</code> optionally overriding defaults for
   * caching and or reloading.</p>
   *
   * @author <a href="mailto:jefft@apache.org">Jeff Turner</a>
   * @author <a href="mailto:haul@apache.org">Christian Haul</a>
   * @version $Id: XMLFileModule.java,v 1.1 2002/12/03 16:44:08 haul Exp $
   */
  public class XMLFileModule extends AbstractJXPathModule
      implements Composable, ThreadSafe {
  
      /** Cached documents */
      Map documents = null;
      /** Default value for reloadability of sources */
      boolean reloadAll = false;
      /** Default value for cachability of sources */
      boolean cacheAll = true;
      /** Default src */
      String src = null;
  
      SourceResolver resolver = null;
      ComponentManager manager = null;
      
  
      /**
       * Takes care of (re-)loading and caching of sources.
       *
       */
      protected class DocumentHelper {
  
          private boolean reloadable = true;
          private boolean cachable = true;
          /** source location */
          private String uri = null;
          /** cached DOM */
          private Document document = null;
          private SourceValidity srcVal = null;
  
          /**
           * Creates a new <code>DocumentHelper</code> instance.
           *
           * @param reload a <code>boolean</code> value, whether this source should be reloaded if changed.
           * @param cache a <code>boolean</code> value, whether this source should be kept in memory.
           * @param src a <code>String</code> value containing the URI
           */
          public DocumentHelper(boolean reload, boolean cache, String src) {
              this.reloadable = reload;
              this.cachable = cache;
              this.uri = src;
              // deferr loading document
          }
  
          
          /**
           * Returns the Document belonging to the configured
           * source. Transparently handles reloading and caching.
           *
           * @param manager a <code>ComponentManager</code> value
           * @param resolver a <code>SourceResolver</code> value
           * @return a <code>Document</code> value
           * @exception Exception if an error occurs
           */
          public Document getDocument(ComponentManager manager, SourceResolver resolver, Logger logger) throws Exception {
  
              Source src = null;
              SourceValidity valid = null;
              Document dom = null;
  
              if (this.document == null) {
                  if (logger.isDebugEnabled())
                      logger.debug("document not cached... reloading uri "+this.uri);
                  src = resolver.resolveURI(this.uri);
                  this.srcVal = src.getValidity();
                  this.document = SourceUtil.toDOM(src, manager);
                  dom = this.document;
                  resolver.release(src);
              } else {
                  dom = this.document;
                  if (this.reloadable) {
                      if (logger.isDebugEnabled())
                          logger.debug("document cached... checking validity of uri "+this.uri);
                      src = resolver.resolveURI(this.uri);
                      valid = src.getValidity();
                      if (!this.srcVal.isValid(valid)) {
                          if (logger.isDebugEnabled())
                              logger.debug("reloading document... uri "+this.uri);
                          this.srcVal = valid;
                          this.document = SourceUtil.toDOM(src, manager);
                      }
                      resolver.release(src);
                  }
              }
              if (!this.cachable) {
                  if (logger.isDebugEnabled())
                      logger.debug("not caching document cached... uri "+this.uri);
                  this.srcVal = null;
                  this.document = null;
              }
              if (logger.isDebugEnabled())
                  logger.debug("done with document... uri "+this.uri);
              return dom;
          }
  
      }
  
  
  
      /**
       * Set the current <code>ComponentManager</code> instance used by this
       * <code>Composable</code>.
       */
      public void compose(ComponentManager manager) throws ComponentException {
          this.manager = manager;
          this.resolver = (SourceResolver)manager.lookup(SourceResolver.ROLE);
      }
  
  
  
      /**
       * @param conf a <code>Configuration</code> value
       * @exception ConfigurationException if an error occurs
       */
      public void configure(Configuration config) throws ConfigurationException {
  
          super.configure(config);
          this.reloadAll = config.getChild("reloadable").getValueAsBoolean(this.reloadAll);
          this.cacheAll = config.getChild("cachable").getValueAsBoolean(this.cacheAll);
  
          Configuration[] files = config.getChildren("file");
          if (files != null) {
              if (this.documents == null) 
                  this.documents = Collections.synchronizedMap(new HashMap());
  
              for (int i=0; i<files.length; i++) {
                  boolean reload = files[i].getAttributeAsBoolean("reloadable",this.reloadAll);
                  boolean cache  = files[i].getAttributeAsBoolean("cachable",this.cacheAll);
                  this.src = files[i].getAttribute("src");
                  // by assigning the source uri to this.src the last one will be the default
                  // OTOH caching / reload parameters can be specified in one central place
                  // if multiple file tags are used.
                  this.documents.put(files[i], new DocumentHelper(reload, cache, this.src));
              }
          }
          if (this.src == null)
              throw new ConfigurationException("No source given!");
      }
  
  
      protected Object getContextObject(Configuration modeConf,
                                        Map objectModel) throws ConfigurationException {
  
          String src = this.src;
          boolean reload = this.reloadAll;
          boolean cache = this.cacheAll;
          
          if (modeConf != null) 
              src = modeConf.getAttribute("src",src);
  
          if (this.documents == null) 
              this.documents = Collections.synchronizedMap(new HashMap());
  
          if (!this.documents.containsKey(src)) {
              if (modeConf != null) {
                  reload = modeConf.getAttributeAsBoolean("reloadable",reload);
                  cache = modeConf.getAttributeAsBoolean("cachable",cache);
              }
              this.documents.put(src, new DocumentHelper(reload, cache, src));
          }
  
          Document dom = null;
  
          try{            
              dom = ((DocumentHelper) this.documents.get(src)).getDocument(this.manager, this.resolver, getLogger());
          } catch (Exception e) {
              if (getLogger().isDebugEnabled())
                  getLogger().debug("Error using source "+src+"\n"+ e.getMessage());
              throw new ConfigurationException("Error using source "+src, e);
          }
          return dom;
  
      }
  
  }
  
  
  
  1.2       +321 -0    xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/XSPModuleHelper.java
  
  
  
  
  1.14      +11 -3     xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/java/xsp.xsl
  
  Index: xsp.xsl
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/java/xsp.xsl,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- xsp.xsl	21 Sep 2002 16:44:24 -0000	1.13
  +++ xsp.xsl	3 Dec 2002 16:44:09 -0000	1.14
  @@ -162,7 +162,9 @@
            */
           public void generate() throws SAXException, IOException, ProcessingException {
               <!-- Do any user-defined necessary initializations -->
  -            <xsl:value-of select="xsp:init-page"/>
  +            <xsl:for-each select="xsp:init-page">
  +              <xsl:copy-of select="."/>
  +            </xsl:for-each>
   
               this.contentHandler.startDocument();
               AttributesImpl xspAttr = new AttributesImpl();
  @@ -176,9 +178,15 @@
               </xsl:call-template>
   
               this.contentHandler.endDocument();
  +
  +            <!-- Do any user-defined necessary clean-ups -->
  +            <xsl:for-each select="xsp:exit-page">
  +              <xsl:copy-of select="."/>
  +            </xsl:for-each>
           }
       }
     </xsl:template>
  +
   
     <xsl:template name="process-first-element">
       <xsl:param name="content"/>
  
  
  
  1.2       +232 -0    xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/java/input.xsl
  
  
  
  
  1.6       +164 -131  xml-cocoon2/src/documentation/xdocs/userdocs/concepts/modules.xml
  
  Index: modules.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/documentation/xdocs/userdocs/concepts/modules.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- modules.xml	16 Sep 2002 23:28:50 -0000	1.5
  +++ modules.xml	3 Dec 2002 16:44:09 -0000	1.6
  @@ -12,73 +12,73 @@
   
   <body>
   
  -	<s1 title="Introduction">
  -	  <p>
  -		Many sitemap components serve a purpose regardless how the input is
  -		obtained. Still, to provide a wide range of components to quickly get
  -		you up to speed, variants for different inputs exist. Modules allow to
  -		create generic components and plug-in input or output later.
  -	  </p>
  -	  <p>
  -		This document will explain how modules work and how to make use of
  -		them. If you plan on writing your own modules, it is highly recommended
  -		to read <fork
  -		  href="http://jakarta.apache.org/avalon/developing/index.html">
  -		  Developing With Apache Avalon</fork>. It is a very good description
  -		of the underlying rationale and principles.
  -	  </p>
  -	</s1>
  -	<s1 title="Types of Modules">
  -	  <p>
  -		Currently, three different types of modules exist: Input modules
  -		provide means to enumerate parameters and to retrieve them, output
  -		modules allow storing of data and exhibit transaction like semantics,
  -		database modules encapsulate different mechanisms for auto increment
  -		columns of various database management systems. Please refer to the
  -		javadoc documentation of these interfaces.
  -	  </p>
  -	  <p>
  -		Input modules are modelled after request parameters. The main
  -		difference is, that every method takes two additional arguments, the
  -		request object and a configuration object. The configuration object is
  -		used to allow arbitrarily complex instructions for the input module.
  -		Apart from that, input modules are more or less a drop-in replacement.
  -	  </p>
  -	  <p>
  -		Output modules are again very similar to using request
  -		attributes. Basically, they provide a method to set an attribute to a
  -		value. Again, a request and a configuration object is the only change
  -		to request attributes. A fundamental difference is, however, that
  -		output modules should exhibit transactional behaviour. Thus setting an
  -		attributes implicitly starts a transaction that must be ended by
  -		calling rollback or commit. Only if the transaction is completed by
  -		calling commit, the values set should be visible. This is needed
  -		e.g. by the database actions.
  -	  </p>
  -	  <p>
  -		Database modules, actually named AutoIncrementModule, contains
  -		configuration information how to retrieve a value for an auto increment
  -		column. It is possible to obtain the value before inserting a row,
  -		while inserting as part of the SQL or after successful insert. If the
  -		value is obtained before inserting, it can be generated
  -		externally. Currently, supported database management systems include
  -		HSQL, Informix, MySQL, and querying the database for the current max
  -		value. 
  -	  </p>
  -	</s1>
  -	<s1 title="Using modules">
  -	  <p>
  -		Using any of these modules requires a two step setup process. Step one
  -		has already been done for your for all modules that come with Apache
  -		Cocoon. Exception to this rule are the auto increment modules: only the
  -		HSQL module is already setup.
  -	  </p>
  -	  <s2 title="Step 1: Making a new module know to Apache Cocoon">
  -		<p>
  -		  Like other core components of Apache Cocoon, modules are declared in
  -		  <code>cocoon.xconf</code>. There are already too many to list here.
  -		</p>
  -		<source>
  +    <s1 title="Introduction">
  +      <p>
  +        Many sitemap components serve a purpose regardless how the input is
  +        obtained. Still, to provide a wide range of components to quickly get
  +        you up to speed, variants for different inputs exist. Modules allow to
  +        create generic components and plug-in input or output later.
  +      </p>
  +      <p>
  +        This document will explain how modules work and how to make use of
  +        them. If you plan on writing your own modules, it is highly recommended
  +        to read <fork
  +          href="http://jakarta.apache.org/avalon/developing/index.html">
  +          Developing With Apache Avalon</fork>. It is a very good description
  +        of the underlying rationale and principles.
  +      </p>
  +    </s1>
  +    <s1 title="Types of Modules">
  +      <p>
  +        Currently, three different types of modules exist: Input modules
  +        provide means to enumerate parameters and to retrieve them, output
  +        modules allow storing of data and exhibit transaction like semantics,
  +        database modules encapsulate different mechanisms for auto increment
  +        columns of various database management systems. Please refer to the
  +        javadoc documentation of these interfaces.
  +      </p>
  +      <p>
  +        Input modules are modelled after request parameters. The main
  +        difference is, that every method takes two additional arguments, the
  +        request object and a configuration object. The configuration object is
  +        used to allow arbitrarily complex instructions for the input module.
  +        Apart from that, input modules are more or less a drop-in replacement.
  +      </p>
  +      <p>
  +        Output modules are again very similar to using request
  +        attributes. Basically, they provide a method to set an attribute to a
  +        value. Again, a request and a configuration object is the only change
  +        to request attributes. A fundamental difference is, however, that
  +        output modules should exhibit transactional behaviour. Thus setting an
  +        attributes implicitly starts a transaction that must be ended by
  +        calling rollback or commit. Only if the transaction is completed by
  +        calling commit, the values set should be visible. This is needed
  +        e.g. by the database actions.
  +      </p>
  +      <p>
  +        Database modules, actually named AutoIncrementModule, contains
  +        configuration information how to retrieve a value for an auto increment
  +        column. It is possible to obtain the value before inserting a row,
  +        while inserting as part of the SQL or after successful insert. If the
  +        value is obtained before inserting, it can be generated
  +        externally. Currently, supported database management systems include
  +        HSQL, Informix, MySQL, and querying the database for the current max
  +        value. 
  +      </p>
  +    </s1>
  +    <s1 title="Using modules">
  +      <p>
  +        Using any of these modules requires a two step setup process. Step one
  +        has already been done for your for all modules that come with Apache
  +        Cocoon. Exception to this rule are the auto increment modules: only the
  +        HSQL module is already setup.
  +      </p>
  +      <s2 title="Step 1: Making a new module know to Apache Cocoon">
  +        <p>
  +          Like other core components of Apache Cocoon, modules are declared in
  +          <code>cocoon.xconf</code>. There are already too many to list here.
  +        </p>
  +        <source>
   <![CDATA[
   <input-modules>
      <component-instance name="request"   
  @@ -97,11 +97,11 @@
         class="org.apache.cocoon.components.modules.input.DateInputModule"/>
      <component-instance name="defaults"  
         class="org.apache.cocoon.components.modules.input.DefaultsMetaModule">
  -   	 <input-module name="request"/>
  -   	 <values>
  -   		<skin>defaultSkin</skin>
  -   		<base-url>http://localhost:8080/cocoon</base-url>
  -   	 </values>
  +     <input-module name="request"/>
  +     <values>
  +        <skin>defaultSkin</skin>
  +        <base-url>http://localhost:8080/cocoon</base-url>
  +     </values>
      </component-instance>
   </input-modules>
   
  @@ -125,62 +125,95 @@
   -->
   </autoincrement-modules>
   ]]>
  -		</source>
  -		<p>
  -		  The above snippet declares a number of modules. After this, the
  -		  modules are accessible through the given name. Thus, when an
  -		  <code>input-module</code> is expected, it is sufficient to give the
  -		  name of a module, like <code>header</code>.
  -		</p>
  -		<p>
  -		  For the auto increment modules only one is declared as the name
  -		  <code>"auto"</code> has special meaning to the modular database
  -		  actions. If more than one is needed at the same time, the
  -		  configuration of the database actions needs to explicitly specify
  -		  which one to use.
  -		</p>
  -	  </s2>
  -	  <s2 title="Step 2: Use it">
  -		<p>
  -		  Two alternatives for using modules exist:
  -		</p>
  -		<s3 title="Step 2a: Use it as sitemap variable">
  -		  <p>
  -			Input modules can be used in a sitemap almost like a sitemap
  -			variable. If the variable name contains a colon (":"), the
  -			preceeding string is used as the name of the module to use and the
  -			trailing string is passed to the module. The expression is replaced
  -			with the string value returned from the module.
  -		  </p>
  -		  <source>
  +        </source>
  +        <p>
  +          The above snippet declares a number of modules. After this, the
  +          modules are accessible through the given name. Thus, when an
  +          <code>input-module</code> is expected, it is sufficient to give the
  +          name of a module, like <code>header</code>.
  +        </p>
  +        <p>
  +          For the auto increment modules only one is declared as the name
  +          <code>"auto"</code> has special meaning to the modular database
  +          actions. If more than one is needed at the same time, the
  +          configuration of the database actions needs to explicitly specify
  +          which one to use.
  +        </p>
  +      </s2>
  +      <s2 title="Step 2: Use it">
  +        <p>
  +          The following alternatives for using modules exist:
  +        </p>
  +        <s3 title="Step 2a: Use it as sitemap variable">
  +          <p>
  +            Input modules can be used in a sitemap almost like a sitemap
  +            variable. If the variable name contains a colon (":"), the
  +            preceeding string is used as the name of the module to use and the
  +            trailing string is passed to the module. The expression is replaced
  +            with the string value returned from the module.
  +          </p>
  +          <source>
   <![CDATA[
      <map:transform src="resources/stylesheets/{../skin}.xsl"/>
   ]]>
  -		  </source>
  -		  <p>
  -			The above example uses the variable <code>skin</code> declared
  -			e.g. by an action for the stylesheet to apply to the page. The
  -			example below uses an input module instead. The way this module was
  -			declared above allows to override the skin with a request parameter
  -			named "skin".
  -		  </p>
  -		  <note>
  -			The above sitemap syntax is only available with the 2.1-dev version
  -			of Apache Cocoon.
  -		  </note>
  -		  <source>
  +          </source>
  +          <p>
  +            The above example uses the variable <code>skin</code> declared
  +            e.g. by an action for the stylesheet to apply to the page. The
  +            example below uses an input module instead. The way this module was
  +            declared above allows to override the skin with a request parameter
  +            named "skin".
  +          </p>
  +          <note>
  +            The above sitemap syntax is only available with the
  +            compiled sitemap in 2.0.4 and the 2.1-dev version
  +            of Apache Cocoon.
  +          </note>
  +          <source>
   <![CDATA[
      <map:transform src="resources/stylesheets/{default:skin}.xsl"/>
   ]]>
  -		  </source>
  -		</s3>
  -		<s3 title="Step 2b: Have sitemap components use a module">
  -		  <p>
  -			This depends on the component that is to be used. As an example the
  -			<code>CachingWildcardMatcher</code> requires to set the
  -			<code>input-module</code> on declaration.
  -		  </p>
  -		  <source>
  +          </source>
  +        </s3>
  +        <s3 title="Step 2b: Use it on an XSP">
  +          <p>
  +            The input logicsheet allows easy use of InputModules from an
  +            XSP. Currently, it provides tags for getting one value, an
  +            array of values, and an Iterator for a Collection of
  +            parameter names.
  +          </p>
  +          <source>
  +<![CDATA[
  +<?xml version="1.0" encoding="ISO-8859-1"?>
  +
  +<xsp:page language="java"
  +    xmlns:xsp="http://apache.org/xsp"  
  +    xmlns:input="http://apache.org/cocoon/xsp/input/1.0">
  +
  +<page>
  +    
  +  <title>Testing InputModules</title>
  +
  +    <p>
  +      Parameter name=<input:get-parameter module="request-param"
  +                       as="string" name="module" default="John Doe"/>;
  +    </p>
  +    <p>
  +      Parameter cars=<input:get-parameter-values module="request-param" 
  +                       as="xml" name="car"/>;
  +    </p>
  +  </page>
  +</xsp:page>
  +]]>
  +          </source>
  +        </s3>
  +        <s3 title="Step 2c: Have sitemap components use a module">
  +          <p>
  +            This depends on the component that is to be used. As an example the
  +            <code>CachingWildcardMatcher</code> requires to set the
  +            <code>input-module</code> on declaration.
  +          </p>
  +          <source>
   <![CDATA[
   <map:matchers default="wildcard">
     <map:matcher name="cached-uri" 
  @@ -189,15 +222,15 @@
     </map:matcher>
   </map:matchers>
   ]]>
  -		  </source>
  -		  <p>
  -			By replacing the input module name with any of the other declared
  -			input modules, this matcher can be used to match e.g. on session
  -			attributes, request headers or even dates!
  -		  </p>
  -		</s3>
  -	  </s2>
  -	</s1>
  +          </source>
  +          <p>
  +            By replacing the input module name with any of the other declared
  +            input modules, this matcher can be used to match e.g. on session
  +            attributes, request headers or even dates!
  +          </p>
  +        </s3>
  +      </s2>
  +    </s1>
   
   </body>
   </document>
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org