cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject cvs commit: xml-cocoon2/src/webapp/mount/lint sitemap.xmap
Date Mon, 14 Jan 2002 02:58:35 GMT
vgritsenko    02/01/13 18:58:35

  Modified:    .        todo.xml
               src/java/org/apache/cocoon/components/language/markup/sitemap/java
                        sitemap.xsl
               src/java/org/apache/cocoon/sitemap XSLTFactoryLoader.java
  Added:       src/webapp/mount/lint sitemap.xmap
  Log:
  Implementing changes in sitemap syntax
   - allowed all components at map:pipeline level
   - removed dead code dealing with matcher and selector factories
     (XSLTFactoryLoader was always returning 'false' in its isFactory call)
   - added attribute substitution wherever possible
     (there is an issue with views and substitution for @type attribute)
   - removed code supporting map:param construct. This was not (never?) documented and
     and never used feature.
   - added some syntax check rules before generating Java using XSLT:
      - break on error when found pipeline with no generate|aggregate|read|mount|redirect-to|call
      - break on error when pipeline with generate|aggregate|transform does not end with serializer|call
      - break on error when pipeline with serialize|read|mount|redirect-to have any sitemap component after it
      - break on error when found error handler with generate|mount
      - break on error when found error handler without serializer|call
      - break on error when error handler have any sitemap component after serializer
  TODO:
   - add more testcases into lint/sitemap.xmap
   - test
   - decide how views implementation should be changed
  
  Revision  Changes    Path
  1.13      +6 -1      xml-cocoon2/todo.xml
  
  Index: todo.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/todo.xml,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- todo.xml	10 Jan 2002 16:31:31 -0000	1.12
  +++ todo.xml	14 Jan 2002 02:58:34 -0000	1.13
  @@ -4,7 +4,7 @@
   
   <!--
     History of Cocoon changes
  -  $Id: todo.xml,v 1.12 2002/01/10 16:31:31 vgritsenko Exp $
  +  $Id: todo.xml,v 1.13 2002/01/14 02:58:34 vgritsenko Exp $
   -->
   
   
  @@ -54,6 +54,11 @@
   
     <action context="code" assigned-to="open">
      Close hsqldb server properly on shutdown
  +  </action>
  +
  +  <action context="code" assigned-to="open">
  +   Complete (means put all allowed constructs and combinations)
  +   the lint/sitemap.xmap file
     </action>
    </actions>
   
  
  
  
  1.2       +468 -630  xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/sitemap/java/sitemap.xsl
  
  Index: sitemap.xsl
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/sitemap/java/sitemap.xsl,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- sitemap.xsl	3 Jan 2002 12:31:10 -0000	1.1
  +++ sitemap.xsl	14 Jan 2002 02:58:34 -0000	1.2
  @@ -18,13 +18,7 @@
   
     <xsl:output method="text"/>
   
  -
  -  <!-- FIXME(GP): This global variable is used to match the attributes map:value
  -                  and map:param. I'm sure there is a way around it but haven't
  -                  investigated yet.
  -  -->
  -  <xsl:variable name="nsprefix">map</xsl:variable>
  -
  +  <xsl:variable name="ns">http://apache.org/cocoon/sitemap/1.0</xsl:variable>
   
     <!--
       this variable holds the factory loader used to get at the code
  @@ -52,24 +46,113 @@
       <xsl:choose>
         <xsl:when test="$xslt-processor = 'saxon'"
                   xmlns:saxon="http://icl.com/saxon">
  -//file <xsl:value-of select="saxon:system-id()"/>
  -//line <xsl:value-of select="saxon:line-number()"/>
  +// file <xsl:value-of select="saxon:system-id()"/>, line <xsl:value-of select="saxon:line-number()"/>
         </xsl:when>
         <xsl:otherwise>
   //line numbers not supported with <xsl:value-of select="$xslt-processor"/>
         </xsl:otherwise>
       </xsl:choose>
     </xsl:template>
  +
     <!-- this template wraps the hole content within a single <code> element which
          the xsp core logicsheet uses to build the java source code out of it
     -->
     <xsl:template match="/">
  +    <!-- break on error when old parameter syntax exists -->
  +    <xsl:if test="//map:pipelines//parameter | //map:action-set//parameter | //map:resource//parameter">
  +      <xsl:call-template name="error">
  +        <xsl:with-param name="message">Sitemap parameters should now be in the sitemap namespace (map:parameter).</xsl:with-param>
  +      </xsl:call-template>
  +    </xsl:if>
  +
  +    <!--
  +      direct -> generator, transformer, serializer, aggregator, reader
  +      support -> action, matcher, selector, mount, redirect, call
  +    -->
  +
  +    <!-- check pipeline rules -->
  +    <xsl:for-each select="/map:sitemap/map:pipelines/map:pipeline">
  +      <xsl:variable name="pipeline" select="."/>
  +
  +      <!-- break on error when found pipeline with no generate|aggregate|read|mount|redirect-to|call -->
  +      <xsl:if test="not(.//map:generate[not(ancestor::map:handle-errors)])
  +          and not(.//map:aggregate[not(ancestor::map:handle-errors)])
  +          and not(.//map:read[not(ancestor::map:handle-errors)])
  +          and not(.//map:mount[not(ancestor::map:handle-errors)])
  +          and not(.//map:redirect-to[not(ancestor::map:handle-errors)])
  +          and not(.//map:call[not(ancestor::map:handle-errors)])">
  +        <xsl:call-template name="error">
  +          <xsl:with-param name="message">Sitemap pipeline must have at least one of: map:generate, map:aggregate, map:read, map:mount, map:redirect-to, map:call.</xsl:with-param>
  +        </xsl:call-template>
  +      </xsl:if>
  +
  +      <!-- break on error when pipeline with generate|aggregate|transform does not end with serializer|call -->
  +      <xsl:for-each select=".//*[namespace-uri()=$ns
  +          and (local-name()='generate' or local-name()='aggregate' or local-name()='transform')
  +          and not(ancestor::map:handle-errors)]">
  +        <xsl:if test="not(following::*[namespace-uri()=$ns
  +            and (local-name()='serialize' or local-name()='call')
  +            and not(ancestor::map:handle-errors)]/ancestor::map:pipeline[. = $pipeline])">
  +          <xsl:call-template name="error">
  +            <xsl:with-param name="message">Sitemap pipeline with map:generate|aggregate|transform must have map:serialize.</xsl:with-param>
  +          </xsl:call-template>
  +        </xsl:if>
  +      </xsl:for-each>
  +
  +      <!-- break on error when pipeline with serialize|read|mount|redirect-to have any sitemap component after that -->
  +      <xsl:if test=".//*[namespace-uri()=$ns
  +          and (local-name()='serialize' or local-name()='read' or local-name()='mount' or local-name()='redirect-to')
  +          ]/following-sibling::*[namespace-uri()=$ns and local-name() != 'handle-errors']">
  +        <xsl:call-template name="error">
  +          <xsl:with-param name="message">Sitemap pipeline with map:serialize|read|mount|redirect-to|call can not have any components after them.</xsl:with-param>
  +        </xsl:call-template>
  +      </xsl:if>
  +
  +      <!-- break on error when match|select have no nested components
  +      <xsl:for-each select=".//*[namespace-uri()=$ns
  +          and (local-name()='match' or local-name()='when' or local-name='otherwise')]">
  +        <xsl:if test="not(descendant::*[namespace-uri()=$ns
  +            and (local-name()='generate' or local-name()='transform' or local-name()='serialize'
  +                 or local-name()='mount' or local-name()='read' or local-name()='redirect-to'
  +                 or local-name()='call')])">
  +          <xsl:call-template name="error">
  +            <xsl:with-param name="message">match and select must have nested components. Pattern: <xsl:value-of select="@pattern"/></xsl:with-param>
  +          </xsl:call-template>
  +        </xsl:if>
  +      </xsl:for-each>
  +       -->
  +
  +      <!-- Handle-errors -->
  +      <xsl:for-each select="map:handle-errors">
  +
  +        <!-- break on error when found handler with generate|mount -->
  +        <xsl:if test=".//map:generate or .//map:mount">
  +          <xsl:call-template name="error">
  +            <xsl:with-param name="message">Error handler can't have: map:generate, map:mount.</xsl:with-param>
  +          </xsl:call-template>
  +        </xsl:if>
  +
  +        <!-- break on error when found handler without serializer|call -->
  +        <xsl:if test="not(.//map:serialize) and not(.//map:call)">
  +          <xsl:call-template name="error">
  +            <xsl:with-param name="message">Error handler must have map:serialize or map:call.</xsl:with-param>
  +          </xsl:call-template>
  +        </xsl:if>
  +
  +        <!-- break on error when handler have any sitemap component after serializer -->
  +        <xsl:if test=".//map:serialize/following-sibling::*[namespace-uri()=$ns]">
  +          <xsl:call-template name="error">
  +            <xsl:with-param name="message">Error handler can not have any components after map:serialize.</xsl:with-param>
  +          </xsl:call-template>
  +        </xsl:if>
  +      </xsl:for-each>
  +    </xsl:for-each>
  +
       <code xml:space="preserve">
         <xsl:apply-templates/>
       </code>
     </xsl:template>
   
  -
     <!-- This is the root element we are looking for here. It defines all the java
          code necessary to build up a sitemap engine class
     -->
  @@ -131,7 +214,7 @@
        * @author &lt;a href="mailto:bloritsch@apache.org"&gt;Berin Loritsch&lt;/a&gt;
        * @author &lt;a href="mailto:barozzi@nicolaken.com"&gt;Nicola Ken Barozzi&lt;/a&gt;
        * @author &lt;a href="mailto:proyal@managingpartners.com"&gt;Peter Royal&lt;/a&gt;
  -     * @version CVS $Id: sitemap.xsl,v 1.1 2002/01/03 12:31:10 giacomo Exp $
  +     * @version CVS $Id: sitemap.xsl,v 1.2 2002/01/14 02:58:34 vgritsenko Exp $
        */
       public class <xsl:value-of select="@file-name"/> extends AbstractSitemap {
         static final String LOCATION = "<xsl:value-of select="translate(@file-path, '/', '.')"/>.<xsl:value-of select="@file-name"/>";
  @@ -143,117 +226,44 @@
         /** HashMap relating labels to view names */
         private HashMap view_label_map = new HashMap(<xsl:value-of select="count(/map:sitemap/map:views/map:view[@from-label])"/>);
   
  -      <!-- Generate matchers which implements CodeFactory -->
  -      <xsl:for-each select="/map:sitemap/map:components/map:matchers/map:matcher">
  -        <xsl:call-template name="line-number"/>
  -        <xsl:variable name="src">
  -          <xsl:value-of select="@src"/>
  -        </xsl:variable>
  -        <xsl:choose>
  -        <xsl:when test="XSLTFactoryLoader:isFactory($factory-loader, string($src))">
  -          <xsl:variable name="name" select="@name"/>
  -          <xsl:variable name="type" select="translate(@name, '- ', '__')"/>
  -          <xsl:variable name="default" select="@name = ../@default"/>
  -          <xsl:variable name="config"><xsl:copy-of select="."/></xsl:variable>
  -          private Map <xsl:value-of select="$type"/>Match (<xsl:value-of select="XSLTFactoryLoader:getParameterSource($factory-loader, string($src),$config)"/> pattern, Map objectModel, Parameters parameters) {
  -            <xsl:value-of select="XSLTFactoryLoader:getMethodSource($factory-loader, string($src),$config)"/>
  -          }
  -          <!-- process all map:match elements with a type attribute refering to the current matcher factory iteration -->
  -          <xsl:for-each select="/map:sitemap/map:pipelines/map:pipeline/descendant-or-self::map:match[@type=$name or (not(@type) and $default)]">
  -            <xsl:call-template name="line-number"/>
  -            <xsl:variable name="matcher-name">
  -              <xsl:call-template name="generate-name">
  -                <xsl:with-param name="prefix">matcher_</xsl:with-param>
  -                <xsl:with-param name="suffix"><xsl:value-of select="$name"/>_<xsl:value-of select="generate-id(.)"/></xsl:with-param>
  -              </xsl:call-template>
  -            </xsl:variable>
  -            // The generated matcher for a pattern of "<xsl:value-of select="@pattern"/>"
  -            <xsl:value-of select="XSLTFactoryLoader:getClassSource($factory-loader,string($src),string($matcher-name),string(@pattern),$config)"/>
  -          </xsl:for-each>
  -        </xsl:when>
  -       </xsl:choose>
  -      </xsl:for-each>
  -
  -      <!-- Generate variables for non-factory patterns -->
         <xsl:for-each select="/map:sitemap/map:pipelines//map:match">
  -
  -        <!-- get the type of matcher used -->
  -        <xsl:variable name="matcher-type">
  -          <xsl:call-template name="get-parameter">
  -            <xsl:with-param name="parname">type</xsl:with-param>
  -            <xsl:with-param name="default"><xsl:value-of select="/map:sitemap/map:components/map:matchers/@default"/></xsl:with-param>
  +        <!-- Generate variables for patterns -->
  +        <xsl:variable name="matcher-name">
  +          <xsl:call-template name="generate-name">
  +            <xsl:with-param name="prefix">matcher_</xsl:with-param>
  +            <xsl:with-param name="suffix"><xsl:value-of select="generate-id(.)"/></xsl:with-param>
             </xsl:call-template>
           </xsl:variable>
  -
  -        <xsl:variable name="src" select="/map:sitemap/map:components/map:matchers/map:matcher[@name=string($matcher-type)]/@src"/>
  -        <xsl:if  test="not(XSLTFactoryLoader:isFactory($factory-loader, string($src)))">
  -          <xsl:variable name="matcher-name">
  -            <xsl:call-template name="generate-name">
  -              <xsl:with-param name="prefix">matcher_</xsl:with-param>
  -              <xsl:with-param name="suffix"><xsl:value-of select="$matcher-type"/>_<xsl:value-of select="generate-id(.)"/></xsl:with-param>
  -            </xsl:call-template>
  -          </xsl:variable>
  -          // Pattern for "<xsl:value-of select="@pattern"/>" (either String or prepared pattern)
  -          private Object <xsl:value-of select="$matcher-name"/>_expr;
  -        </xsl:if>
  -      </xsl:for-each>
  -
  -      <!-- Generate selectors which implements CodeFactory -->
  -      <xsl:for-each select="/map:sitemap/map:components/map:selectors/map:selector">
  -        <xsl:call-template name="line-number"/>
  -        <xsl:variable name="src">
  -          <xsl:value-of select="@src"/>
  -        </xsl:variable>
  -        <xsl:if test="XSLTFactoryLoader:isFactory($factory-loader, string($src))">
  -          <xsl:variable name="name" select="@name"/>
  -          <xsl:variable name="type" select="translate(@name, '- ', '__')"/>
  -          <xsl:variable name="default" select="@name = ../@default"/>
  -          <xsl:variable name="config" select="descendant-or-self::*"/>
  -          private boolean <xsl:value-of select="$type"/>Select (<xsl:value-of select="XSLTFactoryLoader:getParameterSource($factory-loader, string($src),$config)"/> pattern, Map objectModel, Parameters param) {
  -            <xsl:value-of select="XSLTFactoryLoader:getMethodSource($factory-loader, string($src),$config)"/>
  -          }
  -          <xsl:for-each select="/map:sitemap/map:pipelines/map:pipeline/descendant::map:select[@type=$name or (not(@type) and $default)]/map:when
  -              | /map:sitemap/map:resources/map:resource/descendant::map:select[@type=$name or (not(@type) and $default)]/map:when">
  -            <xsl:call-template name="line-number"/>
  -            <xsl:variable name="selector-name">
  -              <xsl:call-template name="generate-name">
  -                <xsl:with-param name="prefix">selector_</xsl:with-param>
  -                <xsl:with-param name="suffix"><xsl:value-of select="$name"/>_<xsl:value-of select="generate-id(.)"/></xsl:with-param>
  -              </xsl:call-template>
  -            </xsl:variable>
  -            <!-- produce a definition for this test string -->
  -            // The generated selector for a pattern of "<xsl:value-of select="@test"/>"
  -            <xsl:value-of select="XSLTFactoryLoader:getClassSource($factory-loader,string($src),string($selector-name),string(@test),$config)"/>
  -          </xsl:for-each>
  -        </xsl:if>
  +      // Pattern for "<xsl:value-of select="@pattern"/>" (either String or prepared pattern)
  +      private Object <xsl:value-of select="$matcher-name"/>_expr;
         </xsl:for-each>
   
         /**
  -       * Method that handles non-factory selectors.
  +       * Method that handles selectors.
          */
  -      private boolean isSelected(String hint, String testValue, List listOfMaps, Parameters params, Map objectModel) throws Exception {
  -        Selector selector = (Selector)this.selectors.select(hint);
  -        try {
  -          return selector.select(substitute(listOfMaps, testValue), objectModel, params);
  -        } finally {
  -          this.selectors.release(selector);
  -        }
  +      private boolean isSelected(String hint, String testValue, Parameters params, Map objectModel) throws Exception {
  +          Selector selector = (Selector)this.selectors.select(hint);
  +          try {
  +              return selector.select(testValue, objectModel, params);
  +          } finally {
  +              this.selectors.release(selector);
  +          }
         }
   
         /**
  -       * Method that handles non-factory matchers.
  +       * Method that handles matchers.
          */
  -      private Map matches(String hint, Object preparedPattern, String pattern, List listOfMaps, Parameters params, Map objectModel) throws Exception {
  -        Component matcher = (Component)this.matchers.select(hint);
  -        try {
  -          if (preparedPattern == null) {
  -            return ((Matcher)matcher).match(substitute(listOfMaps, pattern), objectModel, params);
  -          } else {
  -            return ((PreparableMatcher)matcher).preparedMatch(preparedPattern, objectModel, params);
  +      private Map matches(String hint, Object preparedPattern, String pattern, Parameters params, Map objectModel) throws Exception {
  +          Component matcher = (Component)this.matchers.select(hint);
  +          try {
  +              if (preparedPattern == null) {
  +                  return ((Matcher)matcher).match(pattern, objectModel, params);
  +              } else {
  +                  return ((PreparableMatcher)matcher).preparedMatch(preparedPattern, objectModel, params);
  +              }
  +          } finally {
  +              this.matchers.release(matcher);
             }
  -        } finally {
  -          this.matchers.release(matcher);
  -        }
         }
   
   
  @@ -262,10 +272,10 @@
          * &lt;code&gt;Configurable&lt;/code&gt; class.
          */
         public void configure(Configuration conf) throws ConfigurationException {
  -        this.sitemapManager = new Manager();
  -        this.sitemapManager.setLogger(getLogger());
  -        this.sitemapManager.compose(this.manager);
  -        this.sitemapManager.configure(conf);
  +          this.sitemapManager = new Manager();
  +          this.sitemapManager.setLogger(getLogger());
  +          this.sitemapManager.compose(this.manager);
  +          this.sitemapManager.configure(conf);
   
           <!-- generate a HashMap relating labels to view names -->
           <xsl:for-each select="/map:sitemap/map:views/map:view">
  @@ -315,7 +325,7 @@
             this.selectors.initialize();
   
             this.manager.initialize();
  -        /* catch any exception thrown by a component during configuration */
  +          /* catch any exception thrown by a component during configuration */
           } catch (Exception e) {
             getLogger().warn(e.getMessage(), e);
             throw new ConfigurationException ("Error in sitemap configuration : " + e.getMessage(), e);
  @@ -411,39 +421,35 @@
             this.matchers.release(matcher);
           }
         }
  +
         /** Prepare patterns of PreparableMatchers. */
         public void prepareMatchers() throws Exception {
  -
  -      <!-- Generate variables for non-factory patterns -->
  +      <!-- Generate variables for patterns -->
         <xsl:for-each select="/map:sitemap/map:pipelines//map:match">
  -
           <!-- get the type of matcher used -->
           <xsl:variable name="matcher-type">
             <xsl:call-template name="get-parameter">
               <xsl:with-param name="parname">type</xsl:with-param>
               <xsl:with-param name="default"><xsl:value-of select="/map:sitemap/map:components/map:matchers/@default"/></xsl:with-param>
  +            <xsl:with-param name="required">true</xsl:with-param>
             </xsl:call-template>
           </xsl:variable>
   
  -        <xsl:variable name="src" select="/map:sitemap/map:components/map:matchers/map:matcher[@name=string($matcher-type)]/@src"/>
  -
  -        <xsl:if  test="not(XSLTFactoryLoader:isFactory($factory-loader, string($src)))">
  -          <xsl:choose>
  -            <xsl:when test="XSLTFactoryLoader:hasSubstitutions($factory-loader, @pattern)">
  -              // Pattern "<xsl:value-of select="@pattern"/>" has substitutions and is not prepared.
  -            </xsl:when>
  -            <xsl:otherwise>
  -              <xsl:variable name="matcher-name">
  -                <xsl:call-template name="generate-name">
  -                  <xsl:with-param name="prefix">matcher_</xsl:with-param>
  -                  <xsl:with-param name="suffix"><xsl:value-of select="$matcher-type"/>_<xsl:value-of select="generate-id(.)"/></xsl:with-param>
  -                </xsl:call-template>
  -              </xsl:variable>
  -                // Prepare the pattern for "<xsl:value-of select="@pattern"/>"
  -                this.<xsl:value-of select="$matcher-name"/>_expr = this.preparePattern("<xsl:value-of select="$matcher-type"/>", "<xsl:value-of select="XSLTFactoryLoader:escapeBraces($factory-loader, @pattern)"/>");
  -            </xsl:otherwise>
  -          </xsl:choose>
  -        </xsl:if>
  +        <xsl:choose>
  +          <xsl:when test="XSLTFactoryLoader:hasSubstitutions($factory-loader, @pattern)">
  +          // Pattern "<xsl:value-of select="@pattern"/>" has substitutions and is not prepared.
  +          </xsl:when>
  +          <xsl:otherwise>
  +            <xsl:variable name="matcher-name">
  +              <xsl:call-template name="generate-name">
  +                <xsl:with-param name="prefix">matcher_</xsl:with-param>
  +                <xsl:with-param name="suffix"><xsl:value-of select="generate-id(.)"/></xsl:with-param>
  +              </xsl:call-template>
  +            </xsl:variable>
  +          // Prepare the pattern for "<xsl:value-of select="@pattern"/>"
  +          this.<xsl:value-of select="$matcher-name"/>_expr = this.preparePattern("<xsl:value-of select="$matcher-type"/>", "<xsl:value-of select="XSLTFactoryLoader:escapeBraces($factory-loader, @pattern)"/>");
  +          </xsl:otherwise>
  +        </xsl:choose>
         </xsl:for-each>
         }
   
  @@ -459,15 +465,16 @@
            * @return Wether the request has been processed or not
            * @exception Exception If an error occurs during request evaluation and production
            */
  -        public boolean resource_<xsl:value-of select="translate(@name, '- ', '__')"/> (StreamPipeline pipeline,
  +        public final boolean resource_<xsl:value-of select="translate(@name, '- ', '__')"/> (StreamPipeline pipeline,
               EventPipeline eventPipeline, List listOfMaps, Environment environment, String cocoon_view, boolean internalRequest)
           throws Exception {
  -          Map map = null;
  -          Parameters param = null;
  -          Map objectModel = environment.getObjectModel();
  -          SitemapRedirector redirector = new SitemapRedirector(environment);
  -          <xsl:apply-templates select="./*"/>
  -          return internalRequest;
  +            Map map = null;
  +            Parameters param = null;
  +            final boolean debug_enabled = getLogger().isDebugEnabled();
  +            Map objectModel = environment.getObjectModel();
  +            SitemapRedirector redirector = new SitemapRedirector(environment);
  +            <xsl:apply-templates/>
  +            return internalRequest;
           }
         </xsl:for-each>
   
  @@ -482,27 +489,29 @@
            * @return Wether the request has been processed or not
            * @exception Exception If an error occurs during request evaluation and production
            */
  -        private boolean view_<xsl:value-of select="translate(@name, '- ', '__')"/> (StreamPipeline pipeline,
  +        private final boolean view_<xsl:value-of select="translate(@name, '- ', '__')"/> (StreamPipeline pipeline,
               EventPipeline eventPipeline, List listOfMaps, Environment environment, boolean internalRequest)
           throws Exception {
             Map map = null;
             Parameters param = null;
  +          final boolean debug_enabled = getLogger().isDebugEnabled();
             SitemapRedirector redirector = new SitemapRedirector(environment);
  -          <xsl:apply-templates select="./*"/>
  +          <xsl:apply-templates/>
             return internalRequest;
           }
         </xsl:for-each>
   
         <!-- generate contains_view method to check if a view request is satisfied -->
  -      private String contains_view(String labels, String cocoon_view) {
  -        if (getLogger().isDebugEnabled()) getLogger().debug("contains_view(\"" + labels + "\", \"" + cocoon_view + "\")");
  +      private final String contains_view(String labels, String cocoon_view) {
  +        final boolean debug_enabled = getLogger().isDebugEnabled();
  +        if (debug_enabled) getLogger().debug("contains_view(\"" + labels + "\", \"" + cocoon_view + "\")");
           StringTokenizer st = new StringTokenizer(labels, " ,", false);
           while (st.hasMoreTokens()) {
             String token = st.nextToken();
             String view = (String)view_label_map.get(token);
  -          if (getLogger().isDebugEnabled()) getLogger().debug("contains_view: examining token \"" + token + "\" against view \"" + view + "\"");
  +          if (debug_enabled) getLogger().debug("contains_view: examining token \"" + token + "\" against view \"" + view + "\"");
             if (view != null &amp;&amp; view.equals(cocoon_view)) {
  -            if (getLogger().isDebugEnabled()) getLogger().debug("contains_view: view \"" + view + "\" selected");
  +            if (debug_enabled) getLogger().debug("contains_view: view \"" + view + "\" selected");
               return view;
             }
           }
  @@ -510,7 +519,7 @@
         }
   
         <!-- generate call_view method to satisfy a view request -->
  -      private boolean call_view(String view_name,
  +      private final boolean call_view(String view_name,
                                   StreamPipeline pipeline,
                                   EventPipeline eventPipeline,
                                   List listOfMaps,
  @@ -528,15 +537,15 @@
                 </xsl:call-template>
               </xsl:otherwise>
             </xsl:choose>
  -          if ("<xsl:value-of select="@name"/>".equals(view_name)) {
  +          <xsl:text>if ("</xsl:text><xsl:value-of select="@name"/>".equals(view_name)) {
               return view_<xsl:value-of select="translate(@name, '- ', '__')"/>(pipeline, eventPipeline, listOfMaps, environment, internalRequest);
             }
           </xsl:for-each>
           return internalRequest;
         }
   
  -      <!-- generate methods for every map:action-set element -->
         <xsl:for-each select="/map:sitemap/map:action-sets/map:action-set">
  +        <!-- generate methods for every map:action-set element -->
           <xsl:call-template name="line-number"/>
           /**
            * This is the method to process the "<xsl:value-of select="@name"/>" action-set of the requested resource
  @@ -547,10 +556,11 @@
            * @return Wether the request has been processed or not
            * @exception Exception If an error occurs during request evaluation and production
            */
  -        private Map action_set_<xsl:value-of select="translate(@name, '- ', '__')"/> (SitemapRedirector redirector, String cocoon_action, List listOfMaps, Environment environment, Map objectModel, String src, Parameters param)
  +        private final Map action_set_<xsl:value-of select="translate(@name, '- ', '__')"/> (SitemapRedirector redirector, String cocoon_action, List listOfMaps, Environment environment, Map objectModel, String src, Parameters param)
           throws Exception {
             Map map;
             Map allMap = null;
  +          final boolean debug_enabled = getLogger().isDebugEnabled();
             Parameters nparam = null;
             <xsl:for-each select="map:act">
               map = null;
  @@ -584,7 +594,7 @@
         /**
          * Process to producing the output to the specified &lt;code&gt;OutputStream&lt;/code&gt;.
          */
  -      public boolean process(Environment environment) throws Exception {
  +      public final boolean process(Environment environment) throws Exception {
           /* the &lt;code&gt;EventPipeline&lt;/code&gt; is used to collect the xml producing sitemap
              components and the &lt;code&gt;StreamPipeline&lt;/code&gt; to produce the requested resource */
           EventPipeline eventPipeline = null;
  @@ -596,17 +606,15 @@
               pipeline = (StreamPipeline)this.manager.lookup(StreamPipeline.ROLE);
               pipeline.setEventPipeline(eventPipeline);
             } catch (Exception e) {
  -            if (getLogger().isErrorEnabled()) getLogger().error("processing of resource failed", e);
  +            getLogger().error("Processing of resource failed", e);
               throw e;
             }
   
             result = process (environment, pipeline, eventPipeline, false);
   
           } finally {
  -          if(eventPipeline != null)
  -            this.manager.release(eventPipeline);
  -          if(pipeline != null)
  -            this.manager.release(pipeline);
  +          if(eventPipeline != null) this.manager.release(eventPipeline);
  +          if(pipeline != null) this.manager.release(pipeline);
           }
           return result;
         }
  @@ -614,9 +622,9 @@
         /**
          * Process to producing the output to the specified &lt;code&gt;OutputStream&lt;/code&gt;.
          */
  -      public boolean process(Environment environment, StreamPipeline pipeline, EventPipeline eventPipeline)
  +      public final boolean process(Environment environment, StreamPipeline pipeline, EventPipeline eventPipeline)
         throws Exception {
  -        if (getLogger().isDebugEnabled()) getLogger().debug("processing internal sitemap request");
  +        getLogger().debug("Processing internal sitemap request");
           return process (environment, pipeline, eventPipeline, true);
         }
   
  @@ -635,9 +643,16 @@
              XPath kind expressions in values of src attribute used with
              generate and transform elements */
           List listOfMaps = (List) new ArrayList();
  +
  +        Map map;
  +        Map objectModel = environment.getObjectModel();
  +        String cocoon_view = environment.getView();
  +        String cocoon_action = environment.getAction();
  +        final boolean debug_enabled = getLogger().isDebugEnabled();
  +
           //Adds Constants.NOTIFYING_OBJECT to ObjectModel
           //NKB FIXME add to ObjectModel?
  -        environment.getObjectModel().put(Constants.NOTIFYING_OBJECT, new SimpleNotifyingBean(this));
  +        objectModel.put(Constants.NOTIFYING_OBJECT, new SimpleNotifyingBean(this));
           SitemapRedirector redirector = new SitemapRedirector(environment);
           <!-- process the pipelines -->
           <!-- for each pipeline element generate a try/catch block -->
  @@ -648,19 +663,8 @@
               if (internalRequest) {
             </xsl:if>
             try {
  -            <xsl:for-each select="./map:match">
  -              <!-- get the type of matcher used -->
  -              <xsl:variable name="matcher-type">
  -                <xsl:call-template name="get-parameter">
  -                  <xsl:with-param name="parname">type</xsl:with-param>
  -                  <xsl:with-param name="default"><xsl:value-of select="/map:sitemap/map:components/map:matchers/@default"/></xsl:with-param>
  -                </xsl:call-template>
  -              </xsl:variable>
  -              // method for handling "<xsl:value-of select="@pattern"/>"
  -              if(<xsl:value-of select="translate($matcher-type, '- ', '__')"/>Match<xsl:value-of select="generate-id(.)"/>(
  -                      redirector, environment, pipeline, eventPipeline, internalRequest,listOfMaps))
  -                return true;
  -            </xsl:for-each>
  +            <!-- Generate code for all components nested into pipeline -->
  +            <xsl:apply-templates/>
   
               <xsl:if test="position() = last()">
                 throw new ResourceNotFoundException("No pipeline matched request: " + environment.getURIPrefix()+'/'+environment.getURI());
  @@ -715,22 +719,19 @@
           return false;
         }
   
  -      <!-- generate methods for every map:handle-errors elements in all map:pipeline elements -->
         <xsl:for-each select="/map:sitemap/map:pipelines/map:pipeline">
           <xsl:call-template name="line-number"/>
           <xsl:variable name="pipeline-position" select="position()"/>
  -        <xsl:apply-templates select="./*"/>
  +        <!-- Generate methods (if required) for all components nested into pipeline -->
  +        <xsl:apply-templates select="*" mode="method"/>
   
  -        <xsl:for-each select="./map:handle-errors">
  +        <!-- Generate methods for every map:handle-errors elements in all map:pipeline elements -->
  +        <xsl:for-each select="map:handle-errors">
             <!-- Default error handler's type is 500 -->
             <xsl:variable name="type">
               <xsl:choose>
  -              <xsl:when test="@type">
  -                <xsl:text>_</xsl:text><xsl:value-of select="@type"/>
  -              </xsl:when>
  -              <xsl:otherwise>
  -                <xsl:text>_500</xsl:text>
  -              </xsl:otherwise>
  +              <xsl:when test="@type">_<xsl:value-of select="@type"/></xsl:when>
  +              <xsl:otherwise>_500</xsl:otherwise>
               </xsl:choose>
             </xsl:variable>
             private boolean error_process_<xsl:value-of select="concat($pipeline-position,$type)"/> (SitemapRedirector redirector, Environment environment, Map objectModel, Exception e, boolean internalRequest)
  @@ -747,19 +748,19 @@
                 List listOfMaps = (List)(new ArrayList());
                 Map map;
                 Parameters param;
  +              final boolean debug_enabled = getLogger().isDebugEnabled();
   
                 // Create a Notifying out of this exception and stick it in the object model Constants.NOTIFYING_OBJECTS
  -              boolean de = getLogger().isDebugEnabled();
  -              if(de)getLogger().debug("Starting to build Notifying");
  +              if (debug_enabled) getLogger().debug("Starting to build Notifying");
                 NotifyingBuilder notifyingBuilder= (NotifyingBuilder)this.manager.lookup(NotifyingBuilder.ROLE);
  -              if(de)getLogger().debug("Got "+notifyingBuilder);
  +              if (debug_enabled) getLogger().debug("Got " + notifyingBuilder);
                 Notifying currentNotifying = notifyingBuilder.build(this, e);
  -              if(de)getLogger().debug("Built "+currentNotifying);          
  +              if (debug_enabled) getLogger().debug("Built " + currentNotifying);
                 objectModel.put(Constants.NOTIFYING_OBJECT, currentNotifying );
  -              if(de)getLogger().debug("Added to objectModel" + currentNotifying);        
  +              if (debug_enabled) getLogger().debug("Added to objectModel" + currentNotifying);
                 eventPipeline.setGenerator ("!notifying-generator!", e.getMessage(), Parameters.EMPTY_PARAMETERS);
   
  -              <xsl:apply-templates select="./*"/>
  +              <xsl:apply-templates/>
               } catch (Exception ex) {
                 if (getLogger().isErrorEnabled()) getLogger().error("NotifyingGenerator was not able to notify the exception.", ex);
                 throw e;
  @@ -776,198 +777,126 @@
       }
     </xsl:template> <!-- match="map:sitemap" -->
   
  -  <!-- a match element calls a match method on a matcher component (or a inlined
  -       matcher method produced by a CodeFactory -->
  -  <xsl:template match="map:match//map:match">
   
  +
  +  <!-- Generate matcher invokation code for top-level matchers -->
  +  <xsl:template match="map:match">
  +    // method for handling "<xsl:value-of select="@pattern"/>"
  +    if (match<xsl:value-of select="generate-id(.)"/>(redirector, environment, pipeline, eventPipeline, internalRequest, listOfMaps))
  +        return true;
  +  </xsl:template>
  +
  +
  +
  +  <!-- Generate method body for top-level matchers -->
  +  <xsl:template match="map:match" mode="method">
       <!-- get the type of matcher used -->
       <xsl:variable name="matcher-type">
  -      <xsl:call-template name="get-parameter">
  +      <xsl:call-template name="get-parameter-substituted">
           <xsl:with-param name="parname">type</xsl:with-param>
  -        <xsl:with-param name="default"><xsl:value-of select="/map:sitemap/map:components/map:matchers/@default"/></xsl:with-param>
  -      </xsl:call-template>
  -    </xsl:variable>
  -
  -    <!-- get the pattern used -->
  -    <xsl:variable name="pattern-value">
  -      <xsl:call-template name="get-parameter">
  -        <xsl:with-param name="parname">pattern</xsl:with-param>
  +        <xsl:with-param name="default">"<xsl:value-of select="/map:sitemap/map:components/map:matchers/@default"/>"</xsl:with-param>
           <xsl:with-param name="required">true</xsl:with-param>
         </xsl:call-template>
       </xsl:variable>
   
       <!-- remove all invalid chars from the pattern. The result is used to form the name of the generated method
            in case this matcher is produced by a CodeFactory -->
  -    <xsl:variable name="matcher-name2">
  +    <xsl:variable name="matcher-name">
         <xsl:call-template name="generate-name">
           <xsl:with-param name="prefix">matcher_</xsl:with-param>
  -        <xsl:with-param name="suffix"><xsl:value-of select="$matcher-type"/>_<xsl:value-of select="generate-id(.)"/></xsl:with-param>
  +        <xsl:with-param name="suffix"><xsl:value-of select="generate-id(.)"/>_expr</xsl:with-param>
         </xsl:call-template>
       </xsl:variable>
   
  -    <!-- check if this matcher is a factory ? -->
  -    <xsl:variable name="is-factory">
  -      <xsl:value-of select="XSLTFactoryLoader:isFactory($factory-loader, string(/map:sitemap/map:components/map:matchers/map:matcher[@name=$matcher-type]/@src))"/>
  -    </xsl:variable>
  -
  -    <!-- break on error when old parameter syntax exists -->
  -    <xsl:if test="parameter">
  -      <xsl:call-template name="error">
  -        <xsl:with-param name="message">Sitemap parameters should now be in the sitemap namespace (map:parameter).</xsl:with-param>
  -      </xsl:call-template>
  -    </xsl:if>
  -
  -    <!-- test if we have to define parameters for this matcher -->
  -    <xsl:if test="count(map:parameter)>0">
  +    <!-- Define parameters for this matcher (if present) -->
  +    <xsl:if test="map:parameter">
         param = new Parameters ();
  +      <xsl:apply-templates select="map:parameter">
  +        <xsl:with-param name="param">param</xsl:with-param>
  +      </xsl:apply-templates>
       </xsl:if>
  -
  -    <!-- generate the value used for the parameter argument in the invocation of this matcher -->
       <xsl:variable name="component-param">
         <xsl:choose>
  -        <xsl:when test="count(map:parameter)>0">
  -          <xsl:text>param</xsl:text>
  -        </xsl:when>
  -        <xsl:otherwise>
  -          <xsl:text>Parameters.EMPTY_PARAMETERS</xsl:text>
  -        </xsl:otherwise>
  +        <xsl:when test="map:parameter">param</xsl:when>
  +        <xsl:otherwise>Parameters.EMPTY_PARAMETERS</xsl:otherwise>
         </xsl:choose>
       </xsl:variable>
   
  -    <!-- collect the parameters -->
  -    <xsl:apply-templates select="map:parameter">
  -        <xsl:with-param name="param">param</xsl:with-param>
  -    </xsl:apply-templates>
  -
  -    <!-- gets the string how the matcher is to be invoked in java code -->
  -    <xsl:variable name="matcher-name">
  -      <!-- check if we have a matcher definition in this sitemap otherwise get it from the parent -->
  -      <xsl:choose>
  -        <xsl:when test="string($is-factory)='true'">
  -          <xsl:value-of select="translate($matcher-type, '- ', '__')"/>Match(<xsl:value-of select="$matcher-name2"/>_expr, objectModel, <xsl:value-of select="$component-param"/>)
  -        </xsl:when>
  -        <xsl:otherwise>
  -          matches("<xsl:value-of select="$matcher-type"/>", <xsl:value-of select="$matcher-name2"/>_expr, "<xsl:value-of select="XSLTFactoryLoader:escape($factory-loader, $pattern-value)"/>", listOfMaps, <xsl:value-of select="$component-param"/>, objectModel)
  -        </xsl:otherwise>
  -      </xsl:choose>
  -    </xsl:variable>
  +    <xsl:text>// method for handling "</xsl:text><xsl:value-of select="@pattern"/>"
  +    private final boolean match<xsl:value-of select="generate-id(.)"/>(
  +                                    SitemapRedirector redirector,
  +                                    Environment environment, StreamPipeline pipeline,
  +                                    EventPipeline eventPipeline,
  +                                    boolean internalRequest, List listOfMaps)
  +            throws ConnectionResetException, ResourceNotFoundException, Exception {
  +        Map map;
  +        Parameters param;
  +        Map objectModel = environment.getObjectModel();
  +        String cocoon_view = environment.getView();
  +        String cocoon_action = environment.getAction();
  +        final boolean debug_enabled = getLogger().isDebugEnabled();
   
  -    <!-- this is the actual code produced -->
  -    // handling "<xsl:value-of select="@pattern"/>"
  -        if ((map = <xsl:value-of select="$matcher-name"/>) != null) {
  -          if (getLogger().isDebugEnabled())
  -            getLogger().debug("Matched <xsl:value-of select="$matcher-type"/><xsl:text> </xsl:text><xsl:value-of select="$matcher-name2"/><xsl:text> </xsl:text>pattern:<xsl:value-of select="XSLTFactoryLoader:escape($factory-loader, $pattern-value)"/>");
  +        if ((map = matches(<xsl:value-of select="$matcher-type"/>, <xsl:value-of select="$matcher-name"/>, <xsl:apply-templates select="@pattern"/>, <xsl:value-of select="$component-param"/>, objectModel)) != null) {
  +          if (debug_enabled) getLogger().debug("Matched " + <xsl:value-of select="$matcher-type"/> + " pattern <xsl:value-of select="XSLTFactoryLoader:escape($factory-loader, @pattern)"/>");
             listOfMaps.add (map);
             this.dumpParameters(listOfMaps);
             <xsl:apply-templates/>
             listOfMaps.remove (listOfMaps.size()-1);
             this.dumpParameters(listOfMaps);
           }
  -  </xsl:template> <!-- match="map:match//map:match" -->
  +        return false;
  +    }
  +  </xsl:template> <!-- match="map:match" mode="method" -->
   
  -  <!-- a match element calls a match method on a matcher component (or a inlined
  -       matcher method produced by a CodeFactory -->
  -  <xsl:template match="map:match">
   
  +
  +  <!-- Generate matcher invokation code for nested matchers -->
  +  <xsl:template match="map:match//map:match">
       <!-- get the type of matcher used -->
       <xsl:variable name="matcher-type">
  -      <xsl:call-template name="get-parameter">
  +      <xsl:call-template name="get-parameter-substituted">
           <xsl:with-param name="parname">type</xsl:with-param>
  -        <xsl:with-param name="default"><xsl:value-of select="/map:sitemap/map:components/map:matchers/@default"/></xsl:with-param>
  -      </xsl:call-template>
  -    </xsl:variable>
  -
  -    <!-- get the pattern used -->
  -    <xsl:variable name="pattern-value">
  -      <xsl:call-template name="get-parameter">
  -        <xsl:with-param name="parname">pattern</xsl:with-param>
  +        <xsl:with-param name="default">"<xsl:value-of select="/map:sitemap/map:components/map:matchers/@default"/>"</xsl:with-param>
           <xsl:with-param name="required">true</xsl:with-param>
         </xsl:call-template>
       </xsl:variable>
   
       <!-- remove all invalid chars from the pattern. The result is used to form the name of the generated method
            in case this matcher is produced by a CodeFactory -->
  -    <xsl:variable name="matcher-name2">
  +    <xsl:variable name="matcher-name">
         <xsl:call-template name="generate-name">
           <xsl:with-param name="prefix">matcher_</xsl:with-param>
  -        <xsl:with-param name="suffix"><xsl:value-of select="$matcher-type"/>_<xsl:value-of select="generate-id(.)"/></xsl:with-param>
  +        <xsl:with-param name="suffix"><xsl:value-of select="generate-id(.)"/>_expr</xsl:with-param>
         </xsl:call-template>
       </xsl:variable>
   
  -    <!-- check if this matcher is a factory ? -->
  -    <xsl:variable name="is-factory">
  -      <xsl:value-of select="XSLTFactoryLoader:isFactory($factory-loader, string(/map:sitemap/map:components/map:matchers/map:matcher[@name=$matcher-type]/@src))"/>
  -    </xsl:variable>
  -
  -    <!-- break on error when old parameter syntax exists -->
  -    <xsl:if test="parameter">
  -      <xsl:call-template name="error">
  -        <xsl:with-param name="message">Sitemap parameters should now be in the sitemap namespace (map:parameter).</xsl:with-param>
  -      </xsl:call-template>
  -    </xsl:if>
  -
  -    <!-- test if we have to define parameters for this matcher -->
  -    <xsl:if test="count(map:parameter)>0">
  +    <!-- Define parameters for this matcher (if present) -->
  +    <xsl:if test="map:parameter">
         param = new Parameters ();
  +      <xsl:apply-templates select="map:parameter">
  +        <xsl:with-param name="param">param</xsl:with-param>
  +      </xsl:apply-templates>
       </xsl:if>
  -
  -    <!-- generate the value used for the parameter argument in the invocation of this matcher -->
       <xsl:variable name="component-param">
         <xsl:choose>
  -        <xsl:when test="count(map:parameter)>0">
  -          <xsl:text>param</xsl:text>
  -        </xsl:when>
  -        <xsl:otherwise>
  -          <xsl:text>Parameters.EMPTY_PARAMETERS</xsl:text>
  -        </xsl:otherwise>
  +        <xsl:when test="map:parameter">param</xsl:when>
  +        <xsl:otherwise>Parameters.EMPTY_PARAMETERS</xsl:otherwise>
         </xsl:choose>
       </xsl:variable>
   
  -    <!-- collect the parameters -->
  -    <xsl:apply-templates select="map:parameter">
  -        <xsl:with-param name="param">param</xsl:with-param>
  -    </xsl:apply-templates>
  -
  -    <!-- gets the string how the matcher is to be invoked in java code -->
  -    <xsl:variable name="matcher-name">
  -      <!-- check if we have a matcher definition in this sitemap otherwise get it from the parent -->
  -      <xsl:choose>
  -        <xsl:when test="string($is-factory)='true'">
  -          <xsl:value-of select="translate($matcher-type, '- ', '__')"/>Match(<xsl:value-of select="$matcher-name2"/>_expr, objectModel, <xsl:value-of select="$component-param"/>)
  -        </xsl:when>
  -
  -        <xsl:otherwise>
  -          <xsl:text>matches("</xsl:text><xsl:value-of select="$matcher-type"/>", <xsl:value-of select="$matcher-name2"/>_expr, "<xsl:value-of select="XSLTFactoryLoader:escape($factory-loader, $pattern-value)"/>", listOfMaps, <xsl:value-of select="$component-param"/><xsl:text>, objectModel)</xsl:text>
  -        </xsl:otherwise>
  -      </xsl:choose>
  -    </xsl:variable>
  +      <!-- this is the actual code produced -->
  +      // handling "<xsl:value-of select="@pattern"/>"
  +      if ((map = matches(<xsl:value-of select="$matcher-type"/>, <xsl:value-of select="$matcher-name"/>, <xsl:apply-templates select="@pattern"/>, <xsl:value-of select="$component-param"/>, objectModel)) != null) {
  +        if (debug_enabled) getLogger().debug("Matched " + <xsl:value-of select="$matcher-type"/> + " pattern <xsl:value-of select="XSLTFactoryLoader:escape($factory-loader, @pattern)"/>");
  +        listOfMaps.add (map);
  +        this.dumpParameters(listOfMaps);
  +        <xsl:apply-templates/>
  +        listOfMaps.remove (listOfMaps.size()-1);
  +        this.dumpParameters(listOfMaps);
  +      }
  +  </xsl:template> <!-- match="map:match//map:match" -->
   
  -    <!-- this is the actual code produced -->
  -    // method for handling "<xsl:value-of select="@pattern"/>"
  -    private boolean <xsl:value-of select="translate($matcher-type, '- ', '__')"/>Match<xsl:value-of select="generate-id(.)"/>(
  -                                    SitemapRedirector redirector,
  -                                    Environment environment, StreamPipeline pipeline,
  -                                    EventPipeline eventPipeline,
  -                                    boolean internalRequest, List listOfMaps)
  -            throws ConnectionResetException, ResourceNotFoundException, Exception {
  -        Map map;
  -        Parameters param;
  -        Map objectModel = environment.getObjectModel();
  -        String cocoon_view = environment.getView();
  -        String cocoon_action = environment.getAction();
   
  -        if ((map = <xsl:value-of select="$matcher-name"/>) != null) {
  -          if (getLogger().isDebugEnabled())
  -            getLogger().debug("Matched <xsl:value-of select="$matcher-type"/> <xsl:value-of select="$matcher-name2"/><xsl:text> </xsl:text>pattern:<xsl:value-of select="XSLTFactoryLoader:escape($factory-loader, @pattern)"/>");
  -          listOfMaps.add (map);
  -          this.dumpParameters(listOfMaps);
  -          <xsl:apply-templates/>
  -          listOfMaps.remove (listOfMaps.size()-1);
  -          this.dumpParameters(listOfMaps);
  -        }
  -        return false;
  -    }
  -  </xsl:template> <!-- match="map:match" -->
   
     <!-- a select element introduces a multi branch case by calls to a select method on a selector component (or a inlined
          selector method produced by a CodeFactory -->
  @@ -975,112 +904,66 @@
   
       <!-- get the type of selector used -->
       <xsl:variable name="selector-type">
  -      <xsl:call-template name="get-parameter">
  +      <xsl:call-template name="get-parameter-substituted">
           <xsl:with-param name="parname">type</xsl:with-param>
  -        <xsl:with-param name="default"><xsl:value-of select="/map:sitemap/map:components/map:selectors/@default"/></xsl:with-param>
  +        <xsl:with-param name="default">"<xsl:value-of select="/map:sitemap/map:components/map:selectors/@default"/>"</xsl:with-param>
  +        <xsl:with-param name="required">true</xsl:with-param>
         </xsl:call-template>
       </xsl:variable>
   
  -    <!-- Modified 20010510 L.Sutic Changed to pass sitemap parameters. -->
  -
  -    <!-- break on error when old parameter syntax exists -->
  -    <xsl:if test="parameter">
  -      <xsl:call-template name="error">
  -        <xsl:with-param name="message">Sitemap parameters should now be in the sitemap namespace (map:parameter).</xsl:with-param>
  -      </xsl:call-template>
  -    </xsl:if>
  -
       <!-- test if we have to define parameters for this action -->
  -    <xsl:if test="count(map:parameter)>0">
  +    <xsl:if test="map:parameter">
         param = new Parameters ();
  +      <xsl:apply-templates select="map:parameter">
  +        <xsl:with-param name="param">param</xsl:with-param>
  +      </xsl:apply-templates>
       </xsl:if>
  -
  -    <!-- generate the value used for the parameter argument in the invocation of the act method of this action -->
       <xsl:variable name="component-param">
         <xsl:choose>
  -        <xsl:when test="count(map:parameter)>0">
  -          <xsl:text>param</xsl:text>
  -        </xsl:when>
  -        <xsl:otherwise>
  -          <xsl:text>Parameters.EMPTY_PARAMETERS</xsl:text>
  -        </xsl:otherwise>
  +        <xsl:when test="map:parameter">param</xsl:when>
  +        <xsl:otherwise>Parameters.EMPTY_PARAMETERS</xsl:otherwise>
         </xsl:choose>
       </xsl:variable>
   
  -    <!-- collect the parameters -->
  -    <xsl:apply-templates select="map:parameter">
  -        <xsl:with-param name="param">param</xsl:with-param>
  -    </xsl:apply-templates>
  -
  -    <!-- modification end -->
  -
       <!-- loop through all the when cases -->
  -    <xsl:for-each select="./map:when">
  -      <xsl:call-template name="line-number"/>
  -
  -      <!-- get the pattern used -->
  -      <xsl:variable name="test-value">
  -        <xsl:call-template name="get-parameter">
  -          <xsl:with-param name="parname">test</xsl:with-param>
  -          <xsl:with-param name="required">true</xsl:with-param>
  -        </xsl:call-template>
  -      </xsl:variable>
  -
  +    <xsl:for-each select="map:when">
         <!-- remove all invalid chars from the test expression. The result is used to form the name of the generated method
              in case this selector is produced by a CodeFactory -->
         <xsl:variable name="selector-name2">
           <xsl:call-template name="generate-name">
             <xsl:with-param name="prefix">selector_</xsl:with-param>
  -          <xsl:with-param name="suffix"><xsl:value-of select="$selector-type"/>_<xsl:value-of select="generate-id(.)"/></xsl:with-param>
  +          <xsl:with-param name="suffix">_<xsl:value-of select="generate-id(.)"/></xsl:with-param>
           </xsl:call-template>
         </xsl:variable>
   
  -      <!-- check if this selector is a factory ? -->
  -      <xsl:variable name="is-factory">
  -        <xsl:value-of select="XSLTFactoryLoader:isFactory($factory-loader, string(/map:sitemap/map:components/map:selectors/map:selector[@name=$selector-type]/@src))"/>
  -      </xsl:variable>
  -
  -      <!-- Modified 20010509 L.Sutic Changed to pass sitemap parameters. -->
  -      <!-- gets the string how the selector is to be invoked in java code -->
  -      <xsl:variable name="selector-name">
  -        <!-- check if we have a selector definition in this sitemap otherwise get it from the parent -->
  -        <xsl:choose>
  -          <xsl:when test="string($is-factory)='true'">
  -            <xsl:value-of select="translate($selector-type, '- ', '__')"/>Select(<xsl:value-of select="$selector-name2"/>_expr, objectModel, <xsl:value-of select="$component-param"/>)
  -          </xsl:when>
  -          <xsl:otherwise>
  -            isSelected("<xsl:value-of select="$selector-type"/>", "<xsl:value-of select="$test-value"/>", listOfMaps, <xsl:value-of select="$component-param"/>, objectModel)
  -          </xsl:otherwise>
  -        </xsl:choose>
  -      </xsl:variable>
  -
  -
         <!-- this is the actual code produced on the when elements -->
  +      <xsl:call-template name="line-number"/>
         <xsl:if test="position() > 1">
  -        else
  -      </xsl:if>
  -      if (<xsl:value-of select="$selector-name"/>) {
  -        if (getLogger().isDebugEnabled()) getLogger().debug("Select <xsl:value-of select="$selector-type"/>");
  +      else </xsl:if>
  +      if (isSelected(<xsl:value-of select="$selector-type"/>, <xsl:apply-templates select="@test"/>, <xsl:value-of select="$component-param"/>, objectModel)) {
  +        if (debug_enabled) getLogger().debug("Select " + <xsl:value-of select="$selector-type"/> + " Test <xsl:value-of select="XSLTFactoryLoader:escape($factory-loader, @test)"/>");
           <xsl:apply-templates/>
         }
       </xsl:for-each>
   
       <!-- this is the actual code produced on the otherwise element -->
  -    <xsl:for-each select="./map:otherwise">
  -      <xsl:call-template name="line-number"/>
  -      else {
  -        if (getLogger().isDebugEnabled()) getLogger().debug("Select Otherwise");
  -      <xsl:apply-templates/>
  +    <xsl:for-each select="map:otherwise">
  +      <xsl:text>else {
  +      </xsl:text><xsl:call-template name="line-number"/>
  +        if (debug_enabled) getLogger().debug("Select " + <xsl:value-of select="$selector-type"/> + " Otherwise");
  +        <xsl:apply-templates/>
         }
       </xsl:for-each>
     </xsl:template> <!-- match="map:select" -->
   
  +
  +
     <!-- processing of an act element having a type attribute -->
     <xsl:template match="map:act[@type]">
   
       <!-- get the type of action used -->
       <xsl:variable name="action-type">
  -      <xsl:call-template name="get-parameter">
  +      <xsl:call-template name="get-parameter-substituted">
           <xsl:with-param name="parname">type</xsl:with-param>
           <xsl:with-param name="default">null</xsl:with-param>
         </xsl:call-template>
  @@ -1088,59 +971,44 @@
   
       <!-- get the source parameter for the Action -->
       <xsl:variable name="action-source">
  -      <xsl:call-template name="get-parameter-as-string">
  +      <xsl:call-template name="get-parameter-substituted">
           <xsl:with-param name="parname">src</xsl:with-param>
           <xsl:with-param name="default">null</xsl:with-param>
         </xsl:call-template>
       </xsl:variable>
   
  -    <!-- gets the action java variable -->
  -    <xsl:variable name="action-name">
  -      <xsl:text>action_</xsl:text><xsl:value-of select="generate-id(.)"/>
  -    </xsl:variable>
  -
  -    <!-- break on error when old parameter syntax exists -->
  -    <xsl:if test="parameter">
  -      <xsl:call-template name="error">
  -        <xsl:with-param name="message">Sitemap parameters should now be in the sitemap namespace (map:parameter).</xsl:with-param>
  -      </xsl:call-template>
  -    </xsl:if>
  -
       <!-- test if we have to define parameters for this action -->
  -    <xsl:if test="count(map:parameter)>0">
  +    <xsl:if test="map:parameter">
         param = new Parameters ();
  +      <xsl:apply-templates select="map:parameter">
  +        <xsl:with-param name="param">param</xsl:with-param>
  +      </xsl:apply-templates>
       </xsl:if>
  -
  -    <!-- generate the value used for the parameter argument in the invocation of the act method of this action -->
       <xsl:variable name="component-param">
         <xsl:choose>
  -        <xsl:when test="count(map:parameter)>0">
  -          <xsl:text>param</xsl:text>
  -        </xsl:when>
  -        <xsl:otherwise>
  -          <xsl:text>Parameters.EMPTY_PARAMETERS</xsl:text>
  -        </xsl:otherwise>
  +        <xsl:when test="map:parameter">param</xsl:when>
  +        <xsl:otherwise>Parameters.EMPTY_PARAMETERS</xsl:otherwise>
         </xsl:choose>
       </xsl:variable>
   
  -    <!-- collect the parameters -->
  -    <xsl:apply-templates select="map:parameter">
  -      <xsl:with-param name="param">param</xsl:with-param>
  -    </xsl:apply-templates>
  +    <!-- gets the action java variable -->
  +    <xsl:variable name="action-name">
  +      <xsl:text>action_</xsl:text><xsl:value-of select="generate-id(.)"/>
  +    </xsl:variable>
   
       <!-- generate the invocation of the act method of the action component -->
  -    Action <xsl:value-of select="$action-name"/> = (Action)this.actions.select("<xsl:value-of select="$action-type"/>");
  +    Action <xsl:value-of select="$action-name"/> = (Action)this.actions.select(<xsl:value-of select="$action-type"/>);
       try {
       <xsl:choose>
  -      <xsl:when test="./*[namespace-uri()='http://apache.org/cocoon/sitemap/1.0' and local-name() != 'parameter']">
  -        if ((map = <xsl:value-of select="$action-name"/>.act(redirector, environment, objectModel, substitute(listOfMaps,<xsl:value-of select="$action-source"/>), <xsl:value-of select="$component-param"/>)) != null) {
  +      <xsl:when test="*[namespace-uri()=$ns and local-name() != 'parameter']">
  +        if ((map = <xsl:value-of select="$action-name"/>.act(redirector, environment, objectModel, <xsl:value-of select="$action-source"/>, <xsl:value-of select="$component-param"/>)) != null) {
             if (redirector.hasRedirected()) {
                return true;
             }
  -          if (getLogger().isDebugEnabled()) getLogger().debug("Action <xsl:value-of select="$action-type"/>");
  +          if (debug_enabled) getLogger().debug("Action " + <xsl:value-of select="$action-type"/>);
             listOfMaps.add (map);
             this.dumpParameters(listOfMaps);
  -          <xsl:apply-templates select="./*[namespace-uri()='http://apache.org/cocoon/sitemap/1.0' and local-name() != 'parameter']"/>
  +          <xsl:apply-templates select="*[namespace-uri()=$ns and local-name() != 'parameter']"/>
             listOfMaps.remove(listOfMaps.size()-1);
             this.dumpParameters(listOfMaps);
           }
  @@ -1149,7 +1017,7 @@
           }
         </xsl:when>
         <xsl:otherwise>
  -        map = <xsl:value-of select="$action-name"/>.act(redirector, environment, objectModel, substitute(listOfMaps,<xsl:value-of select="$action-source"/>), <xsl:value-of select="$component-param"/>);
  +        map = <xsl:value-of select="$action-name"/>.act(redirector, environment, objectModel, <xsl:value-of select="$action-source"/>, <xsl:value-of select="$component-param"/>);
           if (redirector.hasRedirected()) {
             return true;
           }
  @@ -1160,12 +1028,14 @@
       }
     </xsl:template> <!-- match="map:act[@type]" -->
   
  +
  +
     <!-- processing of an act element having a type attribute -->
     <xsl:template match="map:act[@type]" mode="set">
   
       <!-- get the type of action used -->
       <xsl:variable name="action-type">
  -      <xsl:call-template name="get-parameter">
  +      <xsl:call-template name="get-parameter-substituted">
           <xsl:with-param name="parname">type</xsl:with-param>
           <xsl:with-param name="default">null</xsl:with-param>
         </xsl:call-template>
  @@ -1173,45 +1043,39 @@
   
       <!-- get the source parameter for the Action -->
       <xsl:variable name="action-source">
  -      <xsl:call-template name="get-parameter-as-string">
  +      <xsl:call-template name="get-parameter-substituted">
           <xsl:with-param name="parname">src</xsl:with-param>
  -        <xsl:with-param name="default">src</xsl:with-param>
  +        <xsl:with-param name="default">null</xsl:with-param>
         </xsl:call-template>
       </xsl:variable>
   
  -    <!-- gets the action java variable -->
  -    <xsl:variable name="action-name">
  -      <xsl:text>action_</xsl:text><xsl:value-of select="generate-id(.)"/>
  -    </xsl:variable>
  -
  +    <!-- prepare parameters -->
       <xsl:text>
  -    <!-- test if we have to define parameters for this action -->
       nparam = new Parameters ();
       </xsl:text>
  -
  -    <!-- generate the value used for the parameter argument in the invocation of the act method of this action -->
  -    <xsl:variable name="component-param">nparam</xsl:variable>
  -
  -    <!-- collect the parameters -->
       <xsl:apply-templates select="map:parameter">
  -      <xsl:with-param name="param" select="$component-param"/>
  +      <xsl:with-param name="param" select="'nparam'"/>
       </xsl:apply-templates>
  -
       <xsl:text>
       nparam.merge(param);
       </xsl:text>
  +    <xsl:variable name="component-param">nparam</xsl:variable>
  +
  +    <!-- gets the action java variable -->
  +    <xsl:variable name="action-name">
  +      <xsl:text>action_</xsl:text><xsl:value-of select="generate-id(.)"/>
  +    </xsl:variable>
   
       <!-- generate the invocation of the act method of the action component -->
  -    Action <xsl:value-of select="$action-name"/> = (Action)this.actions.select("<xsl:value-of select="$action-type"/>");
  +    Action <xsl:value-of select="$action-name"/> = (Action)this.actions.select(<xsl:value-of select="$action-type"/>);
       try {
  -        map = <xsl:value-of select="$action-name"/>.act(redirector, environment, objectModel, substitute(listOfMaps,<xsl:value-of select="$action-source"/>), <xsl:value-of select="$component-param"/>);
  -        <xsl:if test="./*[namespace-uri()='http://apache.org/cocoon/sitemap/1.0' and local-name() != 'parameter']">
  -
  +        map = <xsl:value-of select="$action-name"/>.act(redirector, environment, objectModel, <xsl:value-of select="$action-source"/>, <xsl:value-of select="$component-param"/>);
  +        <xsl:if test="*[namespace-uri()=$ns and local-name() != 'parameter']">
             if (map != null) {
  -              if (getLogger().isDebugEnabled()) getLogger().debug("Action <xsl:value-of select="$action-type"/>");
  +              if (debug_enabled) getLogger().debug("Action " + <xsl:value-of select="$action-type"/>);
                 listOfMaps.add (map);
                 this.dumpParameters(listOfMaps);
  -              <xsl:apply-templates select="./*[namespace-uri()='http://apache.org/cocoon/sitemap/1.0' and local-name() != 'parameter']" mode="set"/>
  +              <xsl:apply-templates select="*[namespace-uri()=$ns and local-name() != 'parameter']" mode="set"/>
                 listOfMaps.remove(listOfMaps.size()-1);
                 this.dumpParameters(listOfMaps);
             }
  @@ -1221,6 +1085,8 @@
       }
     </xsl:template> <!-- match="map:act[@type]" mode="set" -->
   
  +
  +
     <!-- processing of an act element having a set attribute -->
     <xsl:template match="map:act[@set]">
   
  @@ -1234,57 +1100,42 @@
   
       <!-- get the source parameter for the Action -->
       <xsl:variable name="action-source">
  -      <xsl:call-template name="get-parameter-as-string">
  +      <xsl:call-template name="get-parameter-substituted">
           <xsl:with-param name="parname">src</xsl:with-param>
           <xsl:with-param name="default">null</xsl:with-param>
         </xsl:call-template>
       </xsl:variable>
   
  -    <!-- gets the string how the action is to be invoked in java code -->
  -    <xsl:variable name="action-name">
  -      <xsl:text>action_set_</xsl:text><xsl:value-of select="$action-set"/>
  -    </xsl:variable>
  -
  -    <!-- break on error when old parameter syntax exists -->
  -    <xsl:if test="parameter">
  -      <xsl:call-template name="error">
  -        <xsl:with-param name="message">Sitemap parameters should now be in the sitemap namespace (map:parameter).</xsl:with-param>
  -      </xsl:call-template>
  -    </xsl:if>
  -
       <!-- test if we have to define parameters for this action -->
  -    <xsl:if test="count(map:parameter)>0">
  +    <xsl:if test="map:parameter">
         param = new Parameters ();
  +      <xsl:apply-templates select="map:parameter">
  +        <xsl:with-param name="param">param</xsl:with-param>
  +      </xsl:apply-templates>
       </xsl:if>
  -
  -    <!-- generate the value used for the parameter argument in the invocation of the act method of this action -->
       <xsl:variable name="component-param">
         <xsl:choose>
  -        <xsl:when test="count(map:parameter)>0">
  -          <xsl:text>param</xsl:text>
  -        </xsl:when>
  -        <xsl:otherwise>
  -          <xsl:text>Parameters.EMPTY_PARAMETERS</xsl:text>
  -        </xsl:otherwise>
  +        <xsl:when test="map:parameter">param</xsl:when>
  +        <xsl:otherwise>Parameters.EMPTY_PARAMETERS</xsl:otherwise>
         </xsl:choose>
       </xsl:variable>
   
  -    <!-- collect the parameters -->
  -    <xsl:apply-templates select="map:parameter">
  -        <xsl:with-param name="param">param</xsl:with-param>
  -    </xsl:apply-templates>
  +    <!-- gets the string how the action is to be invoked in java code -->
  +    <xsl:variable name="action-name">
  +      <xsl:text>action_set_</xsl:text><xsl:value-of select="$action-set"/>
  +    </xsl:variable>
   
       <!-- generate the invocation of the act method of the action component -->
       <xsl:choose>
  -      <xsl:when test="./*[namespace-uri()='http://apache.org/cocoon/sitemap/1.0' and local-name() != 'parameter']">
  -        if ((map = <xsl:value-of select="$action-name"/> (redirector, cocoon_action, listOfMaps, environment, objectModel, substitute(listOfMaps,<xsl:value-of select="$action-source"/>), <xsl:value-of select="$component-param"/>)) != null) {
  +      <xsl:when test="*[namespace-uri()=$ns and local-name() != 'parameter']">
  +        if ((map = <xsl:value-of select="$action-name"/> (redirector, cocoon_action, listOfMaps, environment, objectModel, <xsl:value-of select="$action-source"/>, <xsl:value-of select="$component-param"/>)) != null) {
             if (redirector.hasRedirected()) {
                 return true;
             }
  -          if (getLogger().isDebugEnabled()) getLogger().debug("Action <xsl:value-of select="translate($action-name,'&quot;',' ')"/>");
  +          getLogger().debug("Action set <xsl:value-of select="$action-name"/>");
             listOfMaps.add (map);
             this.dumpParameters(listOfMaps);
  -          <xsl:apply-templates select="./*[namespace-uri()='http://apache.org/cocoon/sitemap/1.0' and local-name() != 'parameter']"/>
  +          <xsl:apply-templates select="*[namespace-uri()=$ns and local-name() != 'parameter']"/>
             listOfMaps.remove(listOfMaps.size()-1);
             this.dumpParameters(listOfMaps);
           }
  @@ -1293,7 +1144,7 @@
           }
         </xsl:when>
         <xsl:otherwise>
  -        map = <xsl:value-of select="$action-name"/> (redirector, cocoon_action, listOfMaps, environment, objectModel, substitute(listOfMaps,<xsl:value-of select="$action-source"/>), <xsl:value-of select="$component-param"/>);
  +        map = <xsl:value-of select="$action-name"/> (redirector, cocoon_action, listOfMaps, environment, objectModel, <xsl:value-of select="$action-source"/>, <xsl:value-of select="$component-param"/>);
           if (redirector.hasRedirected()) {
             return true;
           }
  @@ -1301,6 +1152,8 @@
       </xsl:choose>
     </xsl:template> <!-- match="map:act[@set]" -->
   
  +
  +
     <!-- generate the code to invoke a generator -->
     <xsl:template match="map:generate">
       <xsl:call-template name="setup-component">
  @@ -1310,6 +1163,8 @@
       </xsl:call-template>
     </xsl:template> <!-- match="map:generate" -->
   
  +
  +
     <!-- generate the code to invoke a transformer -->
     <xsl:template match="map:transform">
       <xsl:call-template name="setup-component">
  @@ -1319,6 +1174,8 @@
       </xsl:call-template>
     </xsl:template> <!-- match="map:transformer" -->
   
  +
  +
     <!-- generate the code to invoke a serializer -->
     <xsl:template match="map:serialize">
       <xsl:call-template name="setup-component">
  @@ -1339,9 +1196,11 @@
         }
       </xsl:if>
       <!-- the if(true) prevents "unreachable statement" errors during compile -->
  -    if(true) return true;
  +    if (true) return true;
     </xsl:template> <!-- match="map:serialize" -->
   
  +
  +
     <!-- generate the code to invoke a reader -->
     <xsl:template match="map:read">
       <xsl:call-template name="setup-component">
  @@ -1360,9 +1219,17 @@
       if (true) return true;
     </xsl:template> <!-- match="map:read" -->
   
  +
  +
     <!-- generate the code to invoke a sub sitemap  -->
     <xsl:template match="map:mount">
  -    <xsl:variable name="src" select="@src"/>
  +    <xsl:if test="@src=''">
  +      <xsl:call-template name="error">
  +        <xsl:with-param name="message">
  +          Required attribute src missing in element map:mount
  +        </xsl:with-param>
  +      </xsl:call-template>
  +    </xsl:if>
   
       <xsl:variable name="check-reload">
         <xsl:choose>
  @@ -1398,9 +1265,9 @@
   
       <!-- generate the code to invoke the sitemapManager which handles delegation of control to sub sitemaps -->
       if (internalRequest)
  -      return sitemapManager.invoke (this.manager, environment, substitute(listOfMaps,"<xsl:value-of select="@uri-prefix"/>"), substitute(listOfMaps,"<xsl:value-of select="@src"/>"), <xsl:value-of select="$check-reload"/>, <xsl:value-of select="$reload-method"/>, pipeline, eventPipeline);
  +      return sitemapManager.invoke (this.manager, environment, <xsl:apply-templates select="@uri-prefix"/>, <xsl:apply-templates select="@src"/>, <xsl:value-of select="$check-reload"/>, <xsl:value-of select="$reload-method"/>, pipeline, eventPipeline);
       else
  -      if (true) return sitemapManager.invoke (this.manager, environment, substitute(listOfMaps,"<xsl:value-of select="@uri-prefix"/>"), substitute(listOfMaps,"<xsl:value-of select="@src"/>"), <xsl:value-of select="$check-reload"/>, <xsl:value-of select="$reload-method"/>);
  +      if (true) return sitemapManager.invoke (this.manager, environment, <xsl:apply-templates select="@uri-prefix"/>, <xsl:apply-templates select="@src"/>, <xsl:value-of select="$check-reload"/>, <xsl:value-of select="$reload-method"/>);
     </xsl:template> <!-- match="map:mount" -->
   
   
  @@ -1408,30 +1275,15 @@
     <!-- generate the code to redirect a request to an internal resource definition -->
     <xsl:template match="map:call">
       <xsl:choose>
  -
         <xsl:when test="map:parameter">
  -      map = new HashMap(<xsl:value-of select="count(map:parameter)"/>);
  -
  -      <xsl:for-each select="map:parameter">
  -        <xsl:variable name="name">
  -          <xsl:call-template name="get-parameter">
  -            <xsl:with-param name="parname">name</xsl:with-param>
  -          </xsl:call-template>
  -        </xsl:variable>
  -        <xsl:variable name="value">
  -          <xsl:call-template name="get-parameter">
  -            <xsl:with-param name="parname">value</xsl:with-param>
  -          </xsl:call-template>
  -        </xsl:variable>
  -        map.put("<xsl:value-of select="$name"/>", substitute(listOfMaps, "<xsl:value-of select="$value"/>"));
  -      </xsl:for-each>
  -
  +        map = new HashMap(<xsl:value-of select="count(map:parameter)"/>);
  +        <xsl:for-each select="map:parameter">
  +          map.put(<xsl:apply-templates select="@name"/>, <xsl:apply-templates select="@value"/>);
  +        </xsl:for-each>
         </xsl:when>
  -
         <xsl:otherwise>
           map = new HashMap(1);
         </xsl:otherwise>
  -
       </xsl:choose>
         listOfMaps.add(map);
         this.dumpParameters(listOfMaps);
  @@ -1443,19 +1295,11 @@
   
   
   
  -
     <!-- generate the code to redirect a request -->
     <xsl:template match="map:redirect-to">
       <xsl:choose>
  -
         <!-- redirect to a internal resource definition -->
         <xsl:when test="@resource">
  -        <xsl:variable name="target">
  -          <xsl:call-template name="get-parameter">
  -            <xsl:with-param name="parname">target</xsl:with-param>
  -          </xsl:call-template>
  -        </xsl:variable>
  -
           <!-- print out deprecation message. -->
           <xsl:call-template name="warn">
             <xsl:with-param name="message">
  @@ -1470,9 +1314,9 @@
              getLogger().warn("&lt;redirect-to resource=\"<xsl:value-of select="@resource"/>\"/&gt; is deprecated. "
                             + "Please use &lt;call resource=\"<xsl:value-of select="@resource"/>\"/&gt; instead.");
   
  -        <xsl:if test="string-length($target) > 0 and string($target) != '&quot;&quot;'">
  +        <xsl:if test="string-length(@target) > 0 and string(@target) != '&quot;&quot;'">
             map = new HashMap(1);
  -          map.put("target",substitute(listOfMaps,"<xsl:value-of select="$target"/>"));
  +          map.put("target", <xsl:apply-templates select="@target"/>);
             listOfMaps.add(map);
             this.dumpParameters(listOfMaps);
           </xsl:if>
  @@ -1498,8 +1342,8 @@
               </xsl:otherwise>
             </xsl:choose>
           </xsl:variable>
  -        if (getLogger().isDebugEnabled()) getLogger().debug("Sitemap: session='<xsl:value-of select="$sess"/>', redirecting to '<xsl:value-of select="@uri"/>'");
  -        environment.redirect (<xsl:value-of select="$sess"/>, substitute(listOfMaps, "<xsl:value-of select="@uri"/>"));
  +        if (debug_enabled) getLogger().debug("Sitemap: session='<xsl:value-of select="$sess"/>', redirecting to " + <xsl:apply-templates select="@uri"/>);
  +        environment.redirect (<xsl:value-of select="$sess"/>, <xsl:apply-templates select="@uri"/>);
           if (true) return true;
         </xsl:when>
   
  @@ -1512,6 +1356,8 @@
       </xsl:choose>
     </xsl:template> <!-- match="map:redirect-to" -->
   
  +
  +
     <!-- generate the code to match a aggregate definition -->
     <xsl:template match="map:aggregate">
       <xsl:call-template name="setup-component">
  @@ -1550,7 +1396,7 @@
             </xsl:call-template>
           </xsl:for-each>
         } else {
  -        <xsl:apply-templates select="./map:part">
  +        <xsl:apply-templates select="map:part">
             <xsl:with-param name="ca"><xsl:value-of select="$ca"/></xsl:with-param>
           </xsl:apply-templates>
         }
  @@ -1564,32 +1410,71 @@
       </xsl:if>
     </xsl:template> <!-- match="map:aggregate" -->
   
  +
  +
     <!-- generate the code to match a aggregates part definition -->
     <xsl:template match="map:part">
       <xsl:param name="ca"/>
  -    <xsl:if test="not (@src)">
  +    <xsl:if test="not(@src)">
         <xsl:call-template name="error">
  -        <xsl:with-param name="message">
  -          src attribute missing in aggregates part element
  -        </xsl:with-param>
  +        <xsl:with-param name="message">src attribute missing in aggregates part element</xsl:with-param>
         </xsl:call-template>
       </xsl:if>
  -    <xsl:value-of select="$ca"/>.addPart(substitute(listOfMaps,"<xsl:value-of select="@src"/>"), "<xsl:value-of select="@element"/>", "<xsl:value-of select="@ns"/>", "<xsl:value-of select="@strip-root"/>", "<xsl:value-of select="@prefix"/>");
  +    <xsl:variable name="element">
  +      <xsl:call-template name="get-parameter-substituted">
  +        <xsl:with-param name="parname">element</xsl:with-param>
  +        <xsl:with-param name="default">""</xsl:with-param>
  +      </xsl:call-template>
  +    </xsl:variable>
  +    <xsl:variable name="ns">
  +      <xsl:call-template name="get-parameter-substituted">
  +        <xsl:with-param name="parname">ns</xsl:with-param>
  +        <xsl:with-param name="default">""</xsl:with-param>
  +      </xsl:call-template>
  +    </xsl:variable>
  +    <xsl:variable name="strip-root">
  +      <xsl:call-template name="get-parameter-substituted">
  +        <xsl:with-param name="parname">strip-root</xsl:with-param>
  +        <xsl:with-param name="default">"no"</xsl:with-param>
  +      </xsl:call-template>
  +    </xsl:variable>
  +    <xsl:variable name="prefix">
  +      <xsl:call-template name="get-parameter-substituted">
  +        <xsl:with-param name="parname">prefix</xsl:with-param>
  +        <xsl:with-param name="default">""</xsl:with-param>
  +      </xsl:call-template>
  +    </xsl:variable>
  +
  +    <xsl:value-of select="$ca"/>.addPart(<xsl:apply-templates select="@src"/>, <xsl:value-of select="$element"/>, <xsl:value-of select="$ns"/>, <xsl:value-of select="$strip-root"/>, <xsl:value-of select="$prefix"/>);
     </xsl:template> <!-- match="map:part" -->
   
  +
  +
     <!-- collect parameter definitions -->
     <xsl:template match="map:pipeline//map:parameter | map:action-set//map:parameter | map:resource//map:parameter">
       <xsl:param name="param"/>
       <xsl:if test="not($param='')">
  -      <xsl:value-of select="$param"/>.setParameter ("<xsl:value-of select="@name"/>", substitute(listOfMaps, "<xsl:value-of select="@value"/>"));
  +      <xsl:value-of select="$param"/><xsl:text>.setParameter (</xsl:text>
  +      <xsl:apply-templates select="@name"/>
  +      <xsl:text>, </xsl:text>
  +      <xsl:apply-templates select="@value"/>);
       </xsl:if>
     </xsl:template>
   
  -  <!-- FIXME:(GP) is this still valid? -->
  -  <xsl:template match="map:param">
  -    param.setParameter ("<xsl:value-of select="@name"/>", substitute(listOfMaps, "<xsl:value-of select="@map:value"/>"));
  +
  +
  +  <!-- attribute substitution template -->
  +  <xsl:template match="@*">
  +    <xsl:choose>
  +      <xsl:when test="XSLTFactoryLoader:hasSubstitutions($factory-loader, .)">
  +        <xsl:text>substitute(listOfMaps, "</xsl:text><xsl:value-of select="XSLTFactoryLoader:escape($factory-loader, .)"/><xsl:text>")</xsl:text>
  +      </xsl:when>
  +      <xsl:otherwise>"<xsl:value-of select="XSLTFactoryLoader:escape($factory-loader, .)"/>"</xsl:otherwise>
  +    </xsl:choose>
     </xsl:template>
   
  +
  +
     <!-- Sitemap Utility templates -->
   
     <!-- this template generates the code to configure a specific sitemap component -->
  @@ -1601,21 +1486,13 @@
         <xsl:value-of select="translate($name, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
       </xsl:variable>
   
  -    <xsl:variable name="qname">
  -      <xsl:value-of select="concat($nsprefix, ':value')"/>
  -    </xsl:variable>
  -
       <xsl:variable name="ns" select="namespace-uri(.)"/>
       <xsl:for-each select="$components">
         <xsl:call-template name="line-number"/>
  -      <xsl:variable name="is-factory-component"
  -        select="@src and ($name = 'matcher' or $name = 'selector') and XSLTFactoryLoader:isFactory($factory-loader, string(@src))"/>
  -      <xsl:if test="$is-factory-component=false()">
         {
           DefaultConfiguration cconf1 = new DefaultConfiguration("<xsl:value-of select="translate(@name, '- ', '__')"/>", LOCATION);
  -        <xsl:for-each select="attribute::*[name(.)!=$qname]">
  -          cconf1.addAttribute ("<xsl:value-of select="name(.)"/>",
  -                               "<xsl:value-of select="."/>");
  +        <xsl:for-each select="attribute::*">
  +        <xsl:text>cconf1.addAttribute ("</xsl:text><xsl:value-of select="name(.)"/>", "<xsl:value-of select="."/>");
           </xsl:for-each>
   
           <!-- get nested configuration definitions -->
  @@ -1630,17 +1507,22 @@
   
           <xsl:choose>
             <xsl:when test="@mime-type">
  -            sitemap.load_component (Sitemap.<xsl:value-of select="$type"/>, "<xsl:value-of select="@name"/>", "<xsl:value-of select="@src"/>", cconf1, "<xsl:value-of select="@mime-type"/>");
  +          sitemap.load_component (Sitemap.<xsl:value-of select="$type"/>, "<xsl:value-of select="@name"/>
  +          <xsl:text>", "</xsl:text><xsl:value-of select="@src"/>", cconf1, "<xsl:value-of select="@mime-type"/>
  +          <xsl:text>");</xsl:text>
             </xsl:when>
             <xsl:otherwise>
  -            sitemap.load_component (Sitemap.<xsl:value-of select="$type"/>, "<xsl:value-of select="@name"/>", "<xsl:value-of select="@src"/>", cconf1, null);
  +          sitemap.load_component (Sitemap.<xsl:value-of select="$type"/>, "<xsl:value-of select="@name"/>
  +          <xsl:text>", "</xsl:text><xsl:value-of select="@src"/>
  +          <xsl:text>", cconf1, null);</xsl:text>
             </xsl:otherwise>
           </xsl:choose>
         }
  -      </xsl:if>
       </xsl:for-each>
     </xsl:template>
   
  +
  +
     <!-- this template generates the code to collect configurations for a specific sitemap component -->
     <xsl:template name="nested-config-components">
       <xsl:param name="name"/>
  @@ -1651,34 +1533,25 @@
       <xsl:param name="subname"/>
       <xsl:param name="level"/>
   
  -    <xsl:variable name="qname">
  -      <xsl:value-of select="concat($nsprefix, ':value')"/>
  -    </xsl:variable>
  -
       <!-- break on error when old map:value syntax exists -->
  -    <xsl:if test="attribute::*[name(.)=$qname]">
  +    <xsl:if test="attribute::map:value">
         <xsl:call-template name="error">
           <xsl:with-param name="message">"map:value" has been deprecated. Use child text nodes for the value.</xsl:with-param>
         </xsl:call-template>
       </xsl:if>
   
  -
       <!-- process content -->
       <xsl:for-each select="$components">
         <xsl:call-template name="line-number"/>
         {
            DefaultConfiguration cconf<xsl:value-of select="$level"/> = new DefaultConfiguration("<xsl:value-of select="name(.)"/>", LOCATION);
  -      <xsl:for-each select="attribute::*[name(.)!=$qname]">
  +      <xsl:for-each select="attribute::*">
           cconf<xsl:value-of select="$level"/>.addAttribute ("<xsl:value-of select="name(.)"/>", "<xsl:value-of select="."/>");
         </xsl:for-each>
  -      <xsl:for-each select="attribute::*[name(.)=$qname]">
  -        cconf<xsl:value-of select="$level"/>.appendValueData("<xsl:value-of select="."/>");
  -      </xsl:for-each>
         <xsl:if test="normalize-space(text())">
           cconf<xsl:value-of select="$level"/>.appendValueData("<xsl:value-of select="text()"/>");
         </xsl:if>
           cconf<xsl:value-of select="($level - 1)"/>.addChild(cconf<xsl:value-of select="$level"/>);
  -
        <xsl:variable name="newsubname">
           <xsl:choose>
             <xsl:when test="not($subname)"><xsl:value-of select="position()"/></xsl:when>
  @@ -1689,7 +1562,7 @@
           <xsl:with-param name="level"><xsl:value-of select="($level + 1)"/></xsl:with-param>
           <xsl:with-param name="name"><xsl:value-of select="$name"/></xsl:with-param>
           <xsl:with-param name="config-name"><xsl:value-of select="local-name(.)"/></xsl:with-param>
  -        <xsl:with-param name="components" select="./*"/>
  +        <xsl:with-param name="components" select="*"/>
           <xsl:with-param name="type"><xsl:value-of select="$type"/></xsl:with-param>
           <xsl:with-param name="ns"><xsl:value-of select="namespace-uri(.)"/></xsl:with-param>
           <xsl:with-param name="subname"><xsl:value-of select="$newsubname"/></xsl:with-param>
  @@ -1710,8 +1583,8 @@
       <xsl:if test="not(ancestor::map:views) and not(ancestor::map:handle-errors)">
         <xsl:if test="$prefix='serializer'">
           <xsl:for-each select="/map:sitemap/map:views/map:view[@from-position='last']">
  -          if ("<xsl:value-of select="@name"/>".equals(cocoon_view)) {
  -            if (getLogger().isDebugEnabled()) getLogger().debug("View <xsl:value-of select="@name"/>");
  +          if (<xsl:apply-templates select="@name"/>.equals(cocoon_view)) {
  +            getLogger().debug("View <xsl:value-of select="@name"/>");
               return view_<xsl:value-of select="translate(@name, '- ', '__')"/> (pipeline, eventPipeline, listOfMaps, environment, internalRequest);
             }
           </xsl:for-each>
  @@ -1732,48 +1605,33 @@
   
       <!-- get the source attribute of the component -->
       <xsl:variable name="component-source">
  -      <xsl:call-template name="get-parameter">
  +      <xsl:call-template name="get-parameter-substituted">
           <xsl:with-param name="parname">src</xsl:with-param>
           <xsl:with-param name="default">null</xsl:with-param>
         </xsl:call-template>
       </xsl:variable>
   
  -    <!-- break on error when old parameter syntax exists -->
  -    <xsl:if test="parameter">
  -      <xsl:call-template name="error">
  -        <xsl:with-param name="message">Sitemap parameters should now be in the sitemap namespace (map:parameter).</xsl:with-param>
  -      </xsl:call-template>
  -    </xsl:if>
  -
       <!-- test if we have to define parameters for this component -->
       <xsl:if test="count(map:parameter)>0">
         param = new Parameters ();
  +      <xsl:apply-templates select="map:parameter">
  +        <xsl:with-param name="param">param</xsl:with-param>
  +      </xsl:apply-templates>
       </xsl:if>
  -
  -    <!-- generate the value used for the parameter argument in the invocation of the act method of this action -->
       <xsl:variable name="component-param">
         <xsl:choose>
  -        <xsl:when test="count(map:parameter)>0">
  -          <xsl:text>param</xsl:text>
  -        </xsl:when>
  -        <xsl:otherwise>
  -          <xsl:text>Parameters.EMPTY_PARAMETERS</xsl:text>
  -        </xsl:otherwise>
  +        <xsl:when test="map:parameter">param</xsl:when>
  +        <xsl:otherwise>Parameters.EMPTY_PARAMETERS</xsl:otherwise>
         </xsl:choose>
       </xsl:variable>
   
  -    <!-- collect the parameters -->
  -    <xsl:apply-templates select="map:parameter">
  -        <xsl:with-param name="param">param</xsl:with-param>
  -    </xsl:apply-templates>
  -
  -    if (getLogger().isDebugEnabled()) getLogger().debug("Component <xsl:value-of select="$prefix"/>:<xsl:value-of select="$component-type"/>(<xsl:value-of select="$component-param"/>)");
  -    <!-- determine the right invokation according to "has a src attribute" and "has a mime-type attribute" -->
  +    getLogger().debug("Component <xsl:value-of select="$prefix"/>:<xsl:value-of select="$component-type"/>(<xsl:value-of select="$component-param"/>)");
       <xsl:choose>
  +      <!-- determine the right invokation according to "has a src attribute" and "has a mime-type attribute" -->
         <xsl:when test="$component-source='null'">
           <xsl:choose>
             <xsl:when test="$mime-type!=''">
  -            if (getLogger().isDebugEnabled()) getLogger().debug("Mime-type: <xsl:value-of select="$mime-type"/>");
  +            getLogger().debug("Mime-type= <xsl:value-of select="$mime-type"/>");
               <xsl:value-of select="$method"/> ("<xsl:value-of select="$component-type"/>",
                 null, <xsl:value-of select="$component-param"/>,"<xsl:value-of select="$mime-type"/>"
               );
  @@ -1786,18 +1644,18 @@
           </xsl:choose>
         </xsl:when>
         <xsl:otherwise>
  -        if (getLogger().isDebugEnabled()) getLogger().debug("Source=<xsl:value-of select="$component-source"/>");
  +        if (debug_enabled) getLogger().debug("Source= " + <xsl:value-of select="$component-source"/>);
           <xsl:choose>
             <xsl:when test="$mime-type!=''">
  -            if (getLogger().isDebugEnabled()) getLogger().debug("Mime-type: <xsl:value-of select="$mime-type"/>");
  +            getLogger().debug("Mime-type= <xsl:value-of select="$mime-type"/>");
               <xsl:value-of select="$method"/> ("<xsl:value-of select="$component-type"/>",
  -                substitute(listOfMaps,"<xsl:value-of select="$component-source"/>"),
  -                <xsl:value-of select="$component-param"/>,"<xsl:value-of select="$mime-type"/>");
  +              <xsl:value-of select="$component-source"/>,
  +              <xsl:value-of select="$component-param"/>,"<xsl:value-of select="$mime-type"/>");
             </xsl:when>
             <xsl:otherwise>
               <xsl:value-of select="$method"/> ("<xsl:value-of select="$component-type"/>",
  -                substitute(listOfMaps,"<xsl:value-of select="$component-source"/>"),
  -                <xsl:value-of select="$component-param"/>);
  +              <xsl:value-of select="$component-source"/><xsl:text>,</xsl:text>
  +              <xsl:value-of select="$component-param"/>);
             </xsl:otherwise>
           </xsl:choose>
         </xsl:otherwise>
  @@ -1853,9 +1711,9 @@
       <xsl:value-of select="translate(concat($prefix,$suffix),'- ','__')"/>
     </xsl:template>
   
  -  <!-- These are the usual utility templates for logicsheets -->
   
  -  <xsl:template name="get-parameter-as-string">
  +
  +  <xsl:template name="get-parameter-substituted">
       <xsl:param name="parname"/>
       <xsl:param name="default"/>
       <xsl:param name="required">false</xsl:param>
  @@ -1867,70 +1725,46 @@
           <xsl:with-param name="required" select="$required"/>
         </xsl:call-template>
       </xsl:variable>
  -
       <xsl:choose>
  -      <xsl:when test="$result=$default">
  -        <xsl:value-of select="$default"/>
  -      </xsl:when>
  -      <xsl:otherwise>
  -        "<xsl:value-of select="$result"/>"
  -      </xsl:otherwise>
  +      <xsl:when test="$result=$default"><xsl:value-of select="$default"/></xsl:when>
  +      <xsl:when test="contains($result, '{')">substitute(listOfMaps, "<xsl:value-of select="$result"/>")</xsl:when>
  +      <xsl:otherwise>"<xsl:value-of select="$result"/>"</xsl:otherwise>
       </xsl:choose>
     </xsl:template>
   
  +
  +
  +  <!-- These are the usual utility templates for logicsheets -->
     <xsl:template name="get-parameter">
       <xsl:param name="parname"/>
       <xsl:param name="default"/>
       <xsl:param name="required">false</xsl:param>
   
  -    <xsl:variable name="qname">
  -      <xsl:value-of select="concat($nsprefix, ':param')"/>
  -    </xsl:variable>
  -
       <xsl:choose>
  -      <xsl:when test="@*[name(.) = $parname]"><xsl:value-of select="@*[name(.) = $parname]"/>	</xsl:when>
  -      <xsl:when test="(*[name(.) = $qname])[@name = $parname]">
  -        <xsl:call-template name="get-nested-content">
  -          <xsl:with-param name="content"
  -                          select="(*[name(.) = $qname])[@name = $parname]"/>
  -        </xsl:call-template>
  -      </xsl:when>
  -      <xsl:otherwise>
  +      <xsl:when test="@*[name(.) = $parname]"><xsl:value-of select="@*[name(.) = $parname]"/></xsl:when>
  +      <xsl:when test="string-length($default) = 0">
           <xsl:choose>
  -          <xsl:when test="string-length($default) = 0">
  -            <xsl:choose>
  -              <xsl:when test="$required = 'true'">
  -                <xsl:call-template name="error">
  -                  <xsl:with-param name="message">
  -                    [Logicsheet processor] Parameter '<xsl:value-of select="$parname"/>' missing in dynamic tag &lt;<xsl:value-of select="name(.)"/>&gt;
  -                  </xsl:with-param>
  -                </xsl:call-template>
  -              </xsl:when>
  -              <xsl:otherwise>""</xsl:otherwise>
  -            </xsl:choose>
  +          <xsl:when test="$required = 'true'">
  +            <xsl:call-template name="error">
  +              <xsl:with-param name="message">
  +                [Logicsheet processor] Attribute '<xsl:value-of select="$parname"/>' missing in dynamic tag &lt;<xsl:value-of select="name(.)"/>&gt;
  +              </xsl:with-param>
  +            </xsl:call-template>
             </xsl:when>
  -          <xsl:otherwise><xsl:copy-of select="$default"/></xsl:otherwise>
  +          <xsl:otherwise></xsl:otherwise>
           </xsl:choose>
  -      </xsl:otherwise>
  -    </xsl:choose>
  -  </xsl:template>
  -
  -  <xsl:template name="get-nested-content">
  -    <xsl:param name="content"/>
  -    <xsl:choose>
  -      <xsl:when test="$content/*">
  -        <xsl:apply-templates select="$content/*"/>
         </xsl:when>
  -      <xsl:otherwise><xsl:value-of select="$content"/></xsl:otherwise>
  +      <xsl:otherwise><xsl:copy-of select="$default"/></xsl:otherwise>
       </xsl:choose>
     </xsl:template>
   
  +
  +
     <xsl:template name="error">
       <xsl:param name="message"/>
       <xsl:message terminate="yes"><xsl:value-of select="$message"/></xsl:message>
     </xsl:template>
   
  -
     <xsl:template name="warn">
       <xsl:param name="message"/>
       <xsl:message terminate="no"><xsl:value-of select="$message"/></xsl:message>
  @@ -1939,5 +1773,9 @@
     <!-- Ignored elements -->
     <xsl:template match="map:logicsheet|map:dependency|map:handle-errors"/>
   
  +  <xsl:template match="*" priority="-1">
  +    <xsl:call-template name="error">
  +      <xsl:with-param name="message">Sitemap contains invalid tag: <xsl:value-of select="local-name()"/>.</xsl:with-param>
  +    </xsl:call-template>
  +  </xsl:template>
   </xsl:stylesheet>
  -
  
  
  
  1.2       +2 -77     xml-cocoon2/src/java/org/apache/cocoon/sitemap/XSLTFactoryLoader.java
  
  Index: XSLTFactoryLoader.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/sitemap/XSLTFactoryLoader.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XSLTFactoryLoader.java	3 Jan 2002 12:31:20 -0000	1.1
  +++ XSLTFactoryLoader.java	14 Jan 2002 02:58:35 -0000	1.2
  @@ -9,7 +9,6 @@
   package org.apache.cocoon.sitemap;
   
   import org.apache.avalon.framework.logger.Loggable;
  -//import org.apache.cocoon.CodeFactory;
   import org.apache.cocoon.util.ClassUtils;
   import org.apache.log.Logger;
   import org.w3c.dom.NodeList;
  @@ -26,7 +25,7 @@
    *
    * @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
    * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
  - * @version CVS $Revision: 1.1 $ $Date: 2002/01/03 12:31:20 $
  + * @version CVS $Revision: 1.2 $ $Date: 2002/01/14 02:58:35 $
    */
   public class XSLTFactoryLoader {
       protected static Logger log;
  @@ -36,26 +35,6 @@
           InstantiationException, IllegalAccessException, Exception {
               
           throw new UnsupportedOperationException("CodeFactory is no longer supported.");
  -        
  -// CodeFactory handling code - now removed.
  -//        try {
  -//            Object factory = obj.get(className);
  -//            if (factory == null) {
  -//                factory = ClassUtils.newInstance(className);
  -//            }
  -//            obj.put(className, factory);
  -//            if (factory instanceof Loggable) {
  -//                ((Loggable)factory).setLogger(XSLTFactoryLoader.log);
  -//            }
  -//            if (factory instanceof CodeFactory) {
  -//                return ((CodeFactory)factory).generateClassSource(prefix, pattern, conf);
  -//            }
  -//            throw new Exception("Wrong class \"" + factory.getClass().getName() +
  -//                "\". Should implement the CodeFactory interface");
  -//        } catch (RuntimeException re){
  -//            log.debug("Exception in XSLTFactoryLoader.getMethodSource calling className:" + className, re);
  -//            throw re;
  -//        }
       }
   
       public static void setLogger(Logger logger) {
  @@ -68,71 +47,17 @@
           IllegalAccessException, Exception {
               
           throw new UnsupportedOperationException("CodeFactory is no longer supported.");
  -        
  -// CodeFactory handling code - now removed.
  -//        try {
  -//            Object factory = obj.get(className);
  -//            if (factory == null) {
  -//                factory = ClassUtils.newInstance(className);
  -//            }
  -//            obj.put(className, factory);
  -//            if (factory instanceof Loggable) {
  -//                ((Loggable)factory).setLogger(XSLTFactoryLoader.log);
  -//            }
  -//            if (factory instanceof CodeFactory) {
  -//                return ((CodeFactory)factory).generateParameterSource(conf);
  -//            }
  -//            throw new Exception("Wrong class \"" + factory.getClass().getName() +
  -//                "\". Should implement the CodeFactory interface");
  -//        } catch (RuntimeException re){
  -//            log.debug("Exception in XSLTFactoryLoader.getMethodSource calling className:" + className, re);
  -//            throw re;
  -//        }
       }
   
       public String getMethodSource(String className, NodeList conf) throws ClassNotFoundException, InstantiationException,
           IllegalAccessException, Exception {
               
           throw new UnsupportedOperationException("CodeFactory is no longer supported.");
  -        
  -// CodeFactory handling code - now removed.
  -//        try {
  -//            Object factory = obj.get(className);
  -//            if (factory == null) {
  -//                factory = ClassUtils.newInstance(className);
  -//            }
  -//            obj.put(className, factory);
  -//            if (factory instanceof Loggable) {
  -//                ((Loggable)factory).setLogger(XSLTFactoryLoader.log);
  -//            }
  -//            if (factory instanceof CodeFactory) {
  -//                return ((CodeFactory)factory).generateMethodSource(conf);
  -//            }
  -//            throw new Exception("Wrong class \"" + factory.getClass().getName() +
  -//                "\". Should implement the CodeFactory interface");
  -//        } catch (RuntimeException re){
  -//            log.debug("Exception in XSLTFactoryLoader.getMethodSource calling className:" + className, re);
  -//            throw re;
  -//        }
       }
   
       public boolean isFactory(String className) {
  -        return false;
           
  -// CodeFactory handling code - now removed.
  -//        boolean result = false;
  -//
  -//        if (className == null)
  -//            return false;
  -//
  -//        try {
  -//            result = ClassUtils.implementsInterface(className, CodeFactory.class.getName());
  -//        } catch (ClassNotFoundException e) {
  -//            log.debug("ClassNotFoundException in XSLTFactoryLoader.isFactory checking for " + className, e);
  -//        } catch (Exception e) {
  -//            log.debug("Exception in XSLTFactoryLoader.isFactory checking for " + className, e);
  -//        }
  -//        return result;
  +        throw new UnsupportedOperationException("Factories are no longer supported.");
       }
   
       /**
  
  
  
  1.1                  xml-cocoon2/src/webapp/mount/lint/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  <?xml version="1.0"?>
  
  <!-- This sitemap shows what is possible and what is not allowed. -->
  <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
    <map:components>
      <map:generators default="file"/>
      <map:transformers default="xslt"/>
      <map:readers default="resource"/>
      <map:serializers default="html"/>
      <map:matchers default="wildcard"/>
      <map:selectors default="parameter">
        <map:selector name="parameter" logger="sitemap.selector.parameter"
                      src="org.apache.cocoon.selection.ParameterSelector">
          <!-- component configuration may have any tags -->
          <unknown-tag/>
        </map:selector>
      </map:selectors>
    </map:components>
  
    <map:pipelines>
      <!-- The only working pipeline here -->
      <map:pipeline>
        <map:generate src="sitemap.xmap">
        <!-- parameter element is deprecated, and its usage will result in error.
        <parameter name="deprecated" value="error"/>
        -->
        </map:generate>
        <map:transform src="../../stylesheets/simple-xml2html.xsl"/>
        <map:serialize/>
        <!-- any unsupported tag will result in error
        <unknown-tag/>
        -->
      </map:pipeline>
  
      <!-- Pipeline with no map:generate|read|mount|redirect-to|call is illegal
      <map:pipeline>
        <map:transform src="../../stylesheets/simple-xml2html.xsl"/>
        <map:serialize/>
      </map:pipeline>
      -->
  
      <!-- Pipeline with map:generate|transform must have serialize
      <map:pipeline>
        <map:generate src="sitemap.xmap"/>
        <map:transform src="../../stylesheets/simple-xml2html.xsl"/>
      </map:pipeline>
      -->
  
      <!-- Pipeline with component after map:serialize|read|mount|redirect-to|call is illegal
      <map:pipeline>
        <map:read src="sitemap.xmap"/>
        <map:act type="request"/>
      </map:pipeline>
      -->
  
      <!-- map:match|select without direct components are illegal
      <map:pipeline>
        <map:match pattern="oops">
          <map:act type="request">
            <map:parameter name="x" value="x"/>
          </map:act>
        </map:match>
      </map:pipeline>
      -->
  
      <!-- More invalid pipelines
      <map:pipeline>
        <map:handle-errors>
          <map:generate src="sitemap.xmap"/>
          <map:serialize/>
        </map:handle-errors>
      </map:pipeline>
  
      <map:pipeline>
        <map:generate src="sitemap.xmap"/>
        <map:handle-errors>
          <map:serialize/>
        </map:handle-errors>
      </map:pipeline>
  
      <map:pipeline>
        <map:generate src="sitemap.xmap"/>
        <map:serialize/>
        <map:handle-errors>
        </map:handle-errors>
      </map:pipeline>
  
      <map:pipeline>
        <map:generate src="sitemap.xmap"/>
        <map:serialize/>
        <map:handle-errors>
          <map:generate src="sitemap.xmap"/>
        </map:handle-errors>
      </map:pipeline>
      -->
  
      <map:pipeline>
        <!-- 1. matchers allow any nested components -->
        <map:match pattern="test-one-1">
          <map:generate src="one"/>
          <map:match pattern="test-one-2-nested">
            <map:transform src="two"/>
          </map:match>
          <map:act type="request">
            <map:transform src="three"/>
          </map:act>
          <map:select>
            <map:when test="one">
              <map:transform src="four"/>
            </map:when>
            <map:otherwise>
              <map:transform src="five"/>
            </map:otherwise>
          </map:select>
          <map:transform src="six"/>
          <map:serialize/>
        </map:match>
  
        <map:match pattern="test-one-2">
          <map:mount uri-prefix="one/" src="one/" check-reload="yes"/>
        </map:match>
  
        <map:match pattern="test-one-3">
          <map:read src="one"/>
        </map:match>
  
        <!-- 2. selectors allow any nested components -->
        <map:select>
          <map:when test="one">
            <map:generate src="one"/>
            <map:transform src="two"/>
            <map:serialize/>
          </map:when>
          <map:when test="two">
            <map:act type="request">
              <map:read src="one"/>
            </map:act>
          </map:when>
          <map:when test="three">
            <map:match pattern="one">
              <map:read src="one"/>
            </map:match>
          </map:when>
          <map:when test="four">
            <map:select>
              <map:when test="one-one">
                <map:transform src="five"/>
              </map:when>
              <map:otherwise>
                <map:transform src="six"/>
              </map:otherwise>
            </map:select>
          </map:when>
          <map:when test="five">
            <map:mount uri-prefix="one/" src="one/" check-reload="yes"/>
          </map:when>
          <map:otherwise>
            <map:read src="one"/>
          </map:otherwise>
        </map:select>
  
        <!-- 3. actions allow any nested components -->
        <map:act type="request">
          <map:generate src="one"/>
          <map:match pattern="test-one-2-nested">
            <map:transform src="two"/>
          </map:match>
          <map:act type="request">
            <map:transform src="three"/>
          </map:act>
          <map:select>
            <map:when test="one">
              <map:transform src="four"/>
            </map:when>
            <map:otherwise>
              <map:transform src="five"/>
            </map:otherwise>
          </map:select>
          <map:transform src="six"/>
          <map:serialize/>
        </map:act>
  
        <map:act type="request">
          <map:mount uri-prefix="one/" src="one/" check-reload="yes"/>
        </map:act>
  
        <map:act type="request">
          <map:read src="one"/>
        </map:act>
  
        <!-- 4. direct components are also allowed at the top level -->
        <map:generate src="test-four"/>
        <map:transform src="test-four"/>
        <map:serialize/>
  
        <!-- can put nothing after serialize|read|mount|redirect-to
          <map:mount uri-prefix="one/" src="one/" check-reload="yes"/>
          <map:read src="one"/>
        -->
  
        <map:handle-errors>
          <map:match pattern="error-one">
            <map:transform src="one"/>
          </map:match>
          <map:act type="request">
            <map:transform src="two"/>
          </map:act>
          <map:select>
            <map:when test="one">
              <map:transform src="three"/>
            </map:when>
            <map:otherwise>
              <map:transform src="four"/>
            </map:otherwise>
          </map:select>
          <map:transform src="five"/>
          <map:serialize/>
        </map:handle-errors>
  
      </map:pipeline>
  
      <!-- Test substitutions -->
      <map:pipeline>
        <map:match type="substitute-match-type-{dummy}" pattern="substitute-match-pattern-{dummy}">
          <map:generate type="not-substituted" src="substitute-generate-src-{dummy}"/>
          <map:transform type="not-substituted" src="substitute-transform-src-{dummy}"/>
  
          <map:act type="substitute-act-type-{dummy}" src="substitute-act-src-{dummy}"/>
  
          <map:select type="substitute-select-type-{dummy}">
            <map:when test="substitute-when-test-{dummy}">
              <map:transform src="dummy"/>
            </map:when>
            <map:otherwise>
            </map:otherwise>
          </map:select>
          <map:serialize type="not-substituted" src="substitute-serialize-src-{dummy}"/>
        </map:match>
  
        <map:match pattern="dummy">
          <map:mount
            uri-prefix="substitute-mount-uri-prefix-{dummy}"
            src="substitute-mount-src-{dummy}"
            check-reload="yes"/> <!-- no substitution -->
        </map:match>
  
        <map:match pattern="dummy">
          <map:read type="not-substituted" src="substitute-read-src-{dummy}"/>
        </map:match>
  
        <map:match pattern="dummy">
          <map:redirect-to uri="substitute-redirect-uri-{dummy}"/>
        </map:match>
  
        <map:aggregate 
          element="substitute-aggregate-element-{dummy}" 
          ns="substitute-aggregate-ns-{dummy}"
          prefix="substitute-aggregate-prefix-{dummy}">
          <map:part
            src="substitute-part-src-{dummy}"
            element="substitute-part-element-{dummy}"
            ns="substitute-part-ns-{dummy}"
            prefix="substitute-part-prefix-{dummy}"
            strip-root="substitute-part-strip-root-{dummy}"/>
        </map:aggregate>
        <map:call resource="substitute-call-src-{dummy}"/>
  
      </map:pipeline>
    </map:pipelines>
  </map:sitemap>
  
  <!-- end of file -->
  
  
  

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


Mime
View raw message