cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From giac...@locus.apache.org
Subject cvs commit: xml-cocoon/src/org/apache/cocoon/components/language/markup/sitemap/java sitemap.xsl
Date Sun, 08 Oct 2000 21:05:03 GMT
giacomo     00/10/08 14:05:03

  Modified:    src/org/apache/cocoon/components/language/markup/sitemap/java
                        Tag: xml-cocoon2 sitemap.xsl
  Log:
  integrated component pooling and action handling
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.45  +754 -712  xml-cocoon/src/org/apache/cocoon/components/language/markup/sitemap/java/Attic/sitemap.xsl
  
  Index: sitemap.xsl
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/markup/sitemap/java/Attic/sitemap.xsl,v
  retrieving revision 1.1.2.44
  retrieving revision 1.1.2.45
  diff -u -r1.1.2.44 -r1.1.2.45
  --- sitemap.xsl	2000/10/07 17:44:10	1.1.2.44
  +++ sitemap.xsl	2000/10/08 21:05:02	1.1.2.45
  @@ -56,18 +56,12 @@
       import org.apache.cocoon.Cocoon;
       import org.apache.cocoon.ProcessingException;
       import org.apache.cocoon.environment.Environment;
  -    import org.apache.cocoon.generation.Generator;
  -    import org.apache.cocoon.matching.Matcher;
  -    import org.apache.cocoon.reading.Reader;
  -    import org.apache.cocoon.selection.Selector;
  -    //import org.apache.cocoon.acting.Action;
  -    import org.apache.cocoon.serialization.Serializer;
       import org.apache.cocoon.sitemap.AbstractSitemap;
  +    import org.apache.cocoon.sitemap.ComponentHolder;
       import org.apache.cocoon.sitemap.ResourcePipeline;
       import org.apache.cocoon.sitemap.Sitemap;
       import org.apache.cocoon.sitemap.ErrorNotifier;
       import org.apache.cocoon.sitemap.Manager;
  -    import org.apache.cocoon.transformation.Transformer;
   
       import org.xml.sax.SAXException;
       import org.xml.sax.helpers.AttributesImpl;
  @@ -76,75 +70,124 @@
        * This is the automatically generated class from the sitemap definitions
        *
        * @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
  -     * @version CVS $Revision: 1.1.2.44 $ $Date: 2000/10/07 17:44:10 $
  +     * @version CVS $Revision: 1.1.2.45 $ $Date: 2000/10/08 21:05:02 $
        */
       public class <xsl:value-of select="@file-name"/> extends AbstractSitemap {
         static {
           dateCreated = <xsl:value-of select="@creation-date"/>L;
         }
   
  -      /** An empty <code>Parameter</code> used to pass to the sitemap components */
  +      /** An empty &lt;code&gt;Parameter&lt;/code&gt; used to pass to the sitemap components */
         private Parameters emptyParam = new Parameters();
  -      /** The <code>Generator</code> used to generate a SAX event stream out of an <code>Exception</code> */
  -      private Generator generator_error_handler;
  -      /** The <code>Configuration</code> for the error generator above */
  -      private Configuration generator_config_error_handler;
  -      /** The <code>Transformer</code> used when link transformation is requested */
  -      private Transformer transformer_link_translator = null;
  -      /** The <code>Configuration</code> for the link transformer above */
  +      /** The &lt;code&gt;Generator&lt;/code&gt; used to generate a SAX event stream out of an &lt;code&gt;Exception&lt;/code&gt; */
  +      private ComponentHolder generator_error_handler = null;
  +      /** The &lt;code&gt;Configuration&lt;/code&gt; for the error generator above */
  +      private Configuration generator_config_error_handler = null;
  +      /** The &lt;code&gt;Transformer&lt;/code&gt; used when link transformation is requested */
  +      private ComponentHolder transformer_link_translator = null;
  +      /** The &lt;code&gt;Configuration&lt;/code&gt; for the link transformer above */
         private Configuration transformer_config_link_translator = null;
   
         <!-- generate variables for all components -->
         /** The generators */
         <xsl:for-each select="/map:sitemap/map:components/map:generators/map:generator">
  -        private Generator generator_<xsl:value-of select="translate(./@name, '- ', '__')"/>;
  -        private Configuration generator_config_<xsl:value-of select="translate(./@name, '- ', '__')"/>;
  +        private ComponentHolder generator_<xsl:value-of select="translate(./@name, '- ', '__')"/> = null;
  +        private Configuration generator_config_<xsl:value-of select="translate(./@name, '- ', '__')"/> = null;
         </xsl:for-each>
   
         /** The transformers */
         <xsl:for-each select="/map:sitemap/map:components/map:transformers/map:transformer">
  -        private Transformer transformer_<xsl:value-of select="translate(./@name, '- ', '__')"/>;
  -        private Configuration transformer_config_<xsl:value-of select="translate(./@name, '- ', '__')"/>;
  +        private ComponentHolder transformer_<xsl:value-of select="translate(./@name, '- ', '__')"/> = null;
  +        private Configuration transformer_config_<xsl:value-of select="translate(./@name, '- ', '__')"/> = null;
         </xsl:for-each>
   
         /** The readers */
         <xsl:for-each select="/map:sitemap/map:components/map:readers/map:reader">
  -        private Reader reader_<xsl:value-of select="translate(./@name, '- ', '__')"/>;
  -        private Configuration reader_config_<xsl:value-of select="translate(./@name, '- ', '__')"/>;
  +        private ComponentHolder reader_<xsl:value-of select="translate(./@name, '- ', '__')"/> = null;
  +        private Configuration reader_config_<xsl:value-of select="translate(./@name, '- ', '__')"/> = null;
         </xsl:for-each>
   
         /** The serializers */
         <xsl:for-each select="/map:sitemap/map:components/map:serializers/map:serializer">
  -        private Serializer serializer_<xsl:value-of select="translate(./@name, '- ', '__')"/>;
  -        private Configuration serializer_config_<xsl:value-of select="translate(./@name, '- ', '__')"/>;
  +        private ComponentHolder serializer_<xsl:value-of select="translate(./@name, '- ', '__')"/> = null;
  +        private Configuration serializer_config_<xsl:value-of select="translate(./@name, '- ', '__')"/> = null;
         </xsl:for-each>
   
         /** The matchers */
         <xsl:for-each select="/map:sitemap/map:components/map:matchers/map:matcher[@src]">
  -        private Matcher matcher_<xsl:value-of select="translate(./@name, '- ', '__')"/>;
  -        private Configuration matcher_config_<xsl:value-of select="translate(./@name, '- ', '__')"/>;
  +        <xsl:variable name="src" select="@src"/>
  +        <xsl:variable name="is-factory" select="java:isFactory($factory-loader, string(@src))"/>
  +        <xsl:choose>
  +          <xsl:when test="$is-factory">
  +            <xsl:variable name="type" select="@name"/>
  +            <xsl:variable name="default"><xsl:if test="$type = ../@default">true</xsl:if></xsl:variable>
  +            <xsl:variable name="config"><xsl:copy-of select="."/></xsl:variable>
  +            <!-- 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=$type or (not(@type) and $default!='')]">
  +              <xsl:variable name="matcher-name">
  +                <xsl:call-template name="generate-name">
  +                  <xsl:with-param name="prefix">matcher_</xsl:with-param>
  +                  <xsl:with-param name="value" select="@pattern"/>
  +                </xsl:call-template>
  +              </xsl:variable>
  +              /** The generated matcher for a pattern of "<xsl:value-of select="@pattern"/>" */
  +              <xsl:value-of select="java:getClassSource($factory-loader,string($src),string($matcher-name),string(@pattern),$config)"/>
  +              private List <xsl:value-of select="$matcher-name"/> (String pattern, Map objectModel) {
  +                <xsl:value-of select="java:getMethodSource($factory-loader,string($src),string($matcher-name),string(@pattern),$config)"/>
  +              }
  +            </xsl:for-each>
  +          </xsl:when>
  +          <xsl:otherwise>
  +            private ComponentHolder matcher_<xsl:value-of select="translate(./@name, '- ', '__')"/> = null;
  +          </xsl:otherwise>
  +        </xsl:choose>
  +        private Configuration matcher_config_<xsl:value-of select="translate(./@name, '- ', '__')"/> = null;
         </xsl:for-each>
   
         /** The selectors */
         <xsl:for-each select="/map:sitemap/map:components/map:selectors/map:selector[@src]">
  -        private Selector selector_<xsl:value-of select="translate(./@name, '- ', '__')"/>;
  -        private Configuration selector_config_<xsl:value-of select="translate(./@name, '- ', '__')"/>;
  -      </xsl:for-each>
  -
  -      /** The actions */
  -      <xsl:for-each select="/map:sitemap/map:components/map:actions/map:action[@src]">
  -        private Action action_<xsl:value-of select="translate(./@name, '- ', '__')"/>;
  -        private Configuration action_config_<xsl:value-of select="translate(./@name, '- ', '__')"/>;
  +        <xsl:variable name="src" select="@src"/>
  +        <xsl:variable name="is-factory" select="java:isFactory($factory-loader, string(@src))"/>
  +        <xsl:choose>
  +          <xsl:when test="$is-factory">
  +            <xsl:variable name="type" select="@name"/>
  +            <xsl:variable name="default"><xsl:if test="$type = ../@default">true</xsl:if></xsl:variable>
  +            <xsl:variable name="config"><xsl:copy-of select="."/></xsl:variable>
  +            <!-- process all map:when elements with are in a map:chooser element having a type attribute
  +                 refering to the current selector factory iteration -->
  +            <xsl:for-each select="/map:sitemap/map:pipelines/map:pipeline/descendant-or-self::map:when[../map:select/@type=$type or (not(../map:select/@type) and $default!='')]">
  +              <xsl:variable name="selector-name">
  +                <xsl:call-template name="generate-name">
  +                  <xsl:with-param name="prefix">selector_</xsl:with-param>
  +                  <xsl:with-param name="value" select="@test"/>
  +                </xsl:call-template>
  +              </xsl:variable>
  +              <xsl:variable name="this-test">
  +                <xsl:value-of select="@test"/>
  +              </xsl:variable>
  +              <xsl:if test="not(preceding::map:when[@test = $this-test])">
  +              /** The generated selector for a test of "<xsl:value-of select="@test"/>" */
  +                <xsl:value-of select="java:getClassSource($factory-loader,string($src),string(@test),string($selector-name),$config)"/>
  +                private boolean <xsl:value-of select="$selector-name"/> (String pattern, Map objectModel) {
  +                  <xsl:value-of select="java:getMethodSource($factory-loader,string($src),string(@test),string($selector-name),$config)"/>
  +                }
  +              </xsl:if>
  +            </xsl:for-each>
  +          </xsl:when>
  +          <xsl:otherwise>
  +            private ComponentHolder selector_<xsl:value-of select="translate(./@name, '- ', '__')"/> = null;
  +          </xsl:otherwise>
  +        </xsl:choose>
  +        private Configuration selector_config_<xsl:value-of select="translate(./@name, '- ', '__')"/> = null;
         </xsl:for-each>
   
  -      /** The generated matchers */
  -      <!-- process all map:matcher elements with a factory attribute -->
  +<!--
  +      /** The generated matchers (for backward compatability. Should be removed in the future) */
         <xsl:for-each select="/map:sitemap/map:components/map:matchers/map:matcher[@factory]">
           <xsl:variable name="factory" select="@factory"/>
           <xsl:variable name="type" select="@name"/>
           <xsl:variable name="default"><xsl:if test="$type = ../@default">true</xsl:if></xsl:variable>
           <xsl:variable name="config"><xsl:copy-of select="."/></xsl:variable>
  -        <!-- 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=$type or (not(@type) and $default!='')]">
             <xsl:variable name="matcher-name">
               <xsl:call-template name="generate-name">
  @@ -152,7 +195,6 @@
                 <xsl:with-param name="value" select="@pattern"/>
               </xsl:call-template>
             </xsl:variable>
  -          /** The generated matcher for a pattern of "<xsl_value-of select="@pattern"/>" */
             <xsl:value-of select="java:getClassSource($factory-loader,string($factory),string($matcher-name),string(@pattern),$config)"/>
             private List <xsl:value-of select="$matcher-name"/> (String pattern, Map objectModel) {
               <xsl:value-of select="java:getMethodSource($factory-loader,string($factory),string($matcher-name),string(@pattern),$config)"/>
  @@ -160,15 +202,12 @@
           </xsl:for-each>
         </xsl:for-each>
   
  -      /** The generated selectors */
  -      <!-- process all map:selector elements with a factory attribute -->
  +      /** The generated selectors (for backward compatability. Should be removed in the future) */
         <xsl:for-each select="/map:sitemap/map:components/map:selectors/map:selector[@factory]">
           <xsl:variable name="factory" select="@factory"/>
           <xsl:variable name="type" select="@name"/>
           <xsl:variable name="default"><xsl:if test="$type = ../@default">true</xsl:if></xsl:variable>
           <xsl:variable name="config"><xsl:copy-of select="."/></xsl:variable>
  -        <!-- process all map:when elements with are in a map:chooser element having a type attribute 
  -             refering to the current selector factory iteration -->
           <xsl:for-each select="/map:sitemap/map:pipelines/map:pipeline/descendant-or-self::map:when[../map:select/@type=$type or (not(../map:select/@type) and $default!='')]">
             <xsl:variable name="selector-name">
               <xsl:call-template name="generate-name">
  @@ -179,23 +218,31 @@
             <xsl:variable name="this-test">
               <xsl:value-of select="@test"/>
             </xsl:variable>
  -          /** The generated selector for a test of "<xsl_value-of select="@test"/>" */
             <xsl:if test="not(preceding::map:when[@test = $this-test])">
               <xsl:value-of select="java:getClassSource($factory-loader,string($factory),string(@test),string($selector-name),$config)"/>
  -            private boolean <xsl:value-of select="$selector-name"/> (String pattern, Environment environment) {
  +            private boolean <xsl:value-of select="$selector-name"/> (String pattern, Map objectModel) {
                 <xsl:value-of select="java:getMethodSource($factory-loader,string($factory),string(@test),string($selector-name),$config)"/>
               }
             </xsl:if>
           </xsl:for-each>
         </xsl:for-each>
  +-->
   
  +      /** The actions */
  +      <xsl:for-each select="/map:sitemap/map:components/map:actions/map:action">
  +        private ComponentHolder action_<xsl:value-of select="translate(./@name, '- ', '__')"/> = null;
  +        private Configuration action_config_<xsl:value-of select="translate(./@name, '- ', '__')"/> = null;
  +      </xsl:for-each>
  +
         /**
          * Pass a &lt;code&gt;Configuration&lt;/code&gt; instance to this
          * &lt;code&gt;Configurable&lt;/code&gt; class.
          */
  -      public void setConfiguration(Configuration conf) throws ConfigurationException {
  +      public void setConfiguration(Configuration conf)
  +      throws ConfigurationException /*, SAXException, ClassNotFoundException,
  +             InstantiationException, IllegalAccessException */ {
           SAXConfigurationBuilder confBuilder = new SAXConfigurationBuilder ();
  -        Configuration cconf;
  +        Configuration cconf = null;
           AttributesImpl attr = new AttributesImpl();
   
           this.sitemapManager = new Manager();
  @@ -208,16 +255,15 @@
             confBuilder.endDocument ();
             Configuration cconf2 = confBuilder.getConfiguration();
             generator_config_error_handler = cconf2;
  -          generator_error_handler = 
  -            (Generator) load_component ("org.apache.cocoon.sitemap.ErrorNotifier", cconf2);
  +          generator_error_handler =
  +            (ComponentHolder) load_component ("org.apache.cocoon.sitemap.ErrorNotifier", cconf2);
             transformer_config_link_translator = cconf2;
  -          transformer_link_translator = 
  -            (Transformer) load_component ("org.apache.cocoon.sitemap.LinkTranslator", cconf2);
  +          transformer_link_translator =
  +            (ComponentHolder) load_component ("org.apache.cocoon.sitemap.LinkTranslator", cconf2);
   
             /* Configure generators */
             <xsl:call-template name="config-components">
               <xsl:with-param name="name">generator</xsl:with-param>
  -            <xsl:with-param name="interface">Generator</xsl:with-param>
               <xsl:with-param name="components"
                   select="/map:sitemap/map:components/map:generators/map:generator"/>
             </xsl:call-template>
  @@ -225,7 +271,6 @@
             /* Configure transformers */
             <xsl:call-template name="config-components">
               <xsl:with-param name="name">transformer</xsl:with-param>
  -            <xsl:with-param name="interface">Transformer</xsl:with-param>
               <xsl:with-param name="components"
                   select="/map:sitemap/map:components/map:transformers/map:transformer"/>
             </xsl:call-template>
  @@ -233,7 +278,6 @@
             /* Configure readers */
             <xsl:call-template name="config-components">
               <xsl:with-param name="name">reader</xsl:with-param>
  -            <xsl:with-param name="interface">Reader</xsl:with-param>
               <xsl:with-param name="components"
                   select="/map:sitemap/map:components/map:readers/map:reader"/>
             </xsl:call-template>
  @@ -241,7 +285,6 @@
             /* Configure serializers */
             <xsl:call-template name="config-components">
               <xsl:with-param name="name">serializer</xsl:with-param>
  -            <xsl:with-param name="interface">Serializer</xsl:with-param>
               <xsl:with-param name="components"
                   select="/map:sitemap/map:components/map:serializers/map:serializer"/>
             </xsl:call-template>
  @@ -249,537 +292,540 @@
             /* Configure matchers */
             <xsl:call-template name="config-components">
               <xsl:with-param name="name">matcher</xsl:with-param>
  -            <xsl:with-param name="interface">Matcher</xsl:with-param>
               <xsl:with-param name="components"
  -                select="/map:sitemap/map:components/map:matchers/map:matcher[@src]"/>
  +                select="/map:sitemap/map:components/map:matchers/map:matcher"/>
             </xsl:call-template>
   
             /* Configure selectors */
             <xsl:call-template name="config-components">
               <xsl:with-param name="name">selector</xsl:with-param>
  -            <xsl:with-param name="interface">Selector</xsl:with-param>
               <xsl:with-param name="components"
  -                select="/map:sitemap/map:components/map:selectors/map:selector[@src]"/>
  +                select="/map:sitemap/map:components/map:selectors/map:selector"/>
             </xsl:call-template>
   
             /* Configure actions */
             <xsl:call-template name="config-components">
               <xsl:with-param name="name">action</xsl:with-param>
  -            <xsl:with-param name="interface">Action</xsl:with-param>
               <xsl:with-param name="components"
                   select="/map:sitemap/map:components/map:actions/map:action"/>
             </xsl:call-template>
   
  -          /* catch any exception thrown by a component during configuration */
  -          } catch (Exception e) {
  -            throw new ConfigurationException (e.toString(), cconf);
  -          }
  +        /* catch any exception thrown by a component during configuration */
  +        } catch (Exception e) {
  +          throw new ConfigurationException (e.toString(), cconf);
           }
  -
  -        <!-- generate methods for every map:resource element -->
  -        <xsl:for-each select="/map:sitemap/map:resources/map:resource">
  -          /** 
  -           * This is the internal resource named "<xsl:value-of select="@name"/>" 
  -           * @param pipeline A <code>ResourcePipeline</code> holding the sitemap component collected so far
  -           * @param listOfLists A <code>List</code> holding replacement values for src attributes
  -           * @param environment The <code>Environment</code> requesting a resource
  -           * @param cocoon_view The view of the resource requested
  -           * @return Wether the request has been processed or not
  -           * @exception Exception If an error occurs during request evaluation and production
  -           */
  -          private boolean resource_<xsl:value-of select="translate(@name, '- ', '__')"/> (ResourcePipeline pipeline,
  -              List listOfLists, Environment environment, String cocoon_view)
  -          throws Exception {
  -            List list = null;
  -            Parameters param = null;
  -            <xsl:apply-templates select="./*"/>
  -            return false;
  -          }
  -        </xsl:for-each>
  +      }
   
  -        <!-- generate methods for every map:resource element -->
  -        <xsl:for-each select="/map:sitemap/map:views/map:view">
  -          /** 
  -           * This is the method to produce the "<xsl:value-of select="@name"/>" view of the requested resource
  -           * @param pipeline A <code>ResourcePipeline</code> holding the sitemap component collected so far
  -           * @param listOfLists A <code>List</code> holding replacement values for src attributes
  -           * @param environment The <code>Environment</code> requesting a resource
  -           * @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, '- ', '__')"/> (ResourcePipeline pipeline,
  -              List listOfLists, Environment environment)
  -          throws Exception {
  -            List list = null;
  -            Parameters param = null;
  -            <xsl:apply-templates select="./*"/>
  -            return false;
  -          }
  -        </xsl:for-each>
  +      <!-- generate methods for every map:resource element -->
  +      <xsl:for-each select="/map:sitemap/map:resources/map:resource">
  +        /**
  +         * This is the internal resource named "<xsl:value-of select="@name"/>"
  +         * @param pipeline A &lt;code&gt;ResourcePipeline&lt;/code&gt; holding the sitemap component collected so far
  +         * @param listOfLists A &lt;code&gt;List&lt;/code&gt; holding replacement values for src attributes
  +         * @param environment The &lt;code&gt;Environment&lt;/code&gt; requesting a resource
  +         * @param cocoon_view The view of the resource requested
  +         * @return Wether the request has been processed or not
  +         * @exception Exception If an error occurs during request evaluation and production
  +         */
  +        private boolean resource_<xsl:value-of select="translate(@name, '- ', '__')"/> (ResourcePipeline pipeline,
  +            List listOfLists, Environment environment, String cocoon_view)
  +        throws Exception {
  +          List list = null;
  +          Parameters param = null;
  +          <xsl:apply-templates select="./*"/>
  +          return false;
  +        }
  +      </xsl:for-each>
   
  +      <!-- generate methods for every map:resource element -->
  +      <xsl:for-each select="/map:sitemap/map:views/map:view">
           /**
  -         * The generated process method of a Sitemap object
  -         * @param environment The <code>Environment</code> requesting a resource
  +         * This is the method to produce the "<xsl:value-of select="@name"/>" view of the requested resource
  +         * @param pipeline A &lt;code&gt;ResourcePipeline&lt;/code&gt; holding the sitemap component collected so far
  +         * @param listOfLists A &lt;code&gt;List&lt;/code&gt; holding replacement values for src attributes
  +         * @param environment The &lt;code&gt;Environment&lt;/code&gt; requesting a resource
  +         * @return Wether the request has been processed or not
  +         * @exception Exception If an error occurs during request evaluation and production
            */
  -        public boolean process(Environment environment) throws Exception {
  -          /* the <code>ResourcePipeline</code> used to collect the sitemap 
  -             components to produce the requested resource */
  -          ResourcePipeline pipeline = new ResourcePipeline ();
  -          pipeline.setComponentManager (this.manager);
  -          /* the <code>List</code> objects to hold the replacement values 
  -             delivered from matchers and selectors to replace occurences of 
  -             XPath kind expressions in values of src attribute used with 
  -             generate and transform elements */
  -          List listOfLists = (List)(new ArrayList());
  -          List list;
  -          Parameters param;
  -          Map objectModel = environment.getObjectModel();
  -          String cocoon_view = environment.getView();
  -
  -          <!-- process the pipelines -->
  -          <!-- for each pipeline element generate a try/catch block -->
  -          <xsl:for-each select="/map:sitemap/map:pipelines/map:pipeline">
  -            <xsl:variable name="pipeline-position" select="position()"/>
  -            try {
  -              <xsl:apply-templates select="./*"/>
  -            } catch (Exception e) {
  -              <xsl:choose>
  -                <xsl:when test="(./map:handle-errors)">
  -                  try {
  -                    return error_process_<xsl:value-of select="$pipeline-position"/> (environment, objectModel, e);
  -                  } catch (Exception ex) {
  -                    System.out.println (ex.toString());
  -                    ex.printStackTrace(System.out);
  -                  }
  -                </xsl:when>
  -                <xsl:otherwise>
  -                  System.out.println (e.toString());
  -                  e.printStackTrace(System.out);
  -                </xsl:otherwise>
  -              </xsl:choose>
  -            }
  -          </xsl:for-each>
  +        private boolean view_<xsl:value-of select="translate(@name, '- ', '__')"/> (ResourcePipeline pipeline,
  +            List listOfLists, Environment environment)
  +        throws Exception {
  +          List list = null;
  +          Parameters param = null;
  +          <xsl:apply-templates select="./*"/>
             return false;
           }
  +      </xsl:for-each>
   
  -        <!-- generate methods for every map:handle-errors elements in all map:pipeline elements -->
  +      /**
  +       * Process to producing the output to the specified &gt;code&lt;OutputStream&gt;/code&lt;.
  +       */
  +      public boolean process(Environment environment)
  +      throws Exception {
  +        /* the &lt;code&gt;ResourcePipeline&lt;/code&gt; used to collect the sitemap
  +           components to produce the requested resource */
  +        ResourcePipeline pipeline = new ResourcePipeline ();
  +        pipeline.setComponentManager (this.manager);
  +        /* the &lt;code&gt;List&lt;/code&gt; objects to hold the replacement values
  +           delivered from matchers and selectors to replace occurences of
  +           XPath kind expressions in values of src attribute used with
  +           generate and transform elements */
  +        List listOfLists = (List)(new ArrayList());
  +        List list;
  +        Parameters param;
  +        Map objectModel = environment.getObjectModel();
  +        String cocoon_view = environment.getView();
  +
  +        <!-- process the pipelines -->
  +        <!-- for each pipeline element generate a try/catch block -->
           <xsl:for-each select="/map:sitemap/map:pipelines/map:pipeline">
             <xsl:variable name="pipeline-position" select="position()"/>
  -          <xsl:if test="(./map:handle-errors)">
  -            private boolean error_process_<xsl:value-of select="$pipeline-position"/> (Environment environment, Map objectModel, Exception e)
  -            throws Exception {
  -              ResourcePipeline pipeline = new ResourcePipeline ();
  -              pipeline.setComponentManager (this.manager);
  -              List listOfLists = (List)(new ArrayList());
  -              List list;
  -              Parameters param;
  -              pipeline.setGenerator (generator_error_handler, e.getMessage(), null, emptyParam);
  -              ErrorNotifier eg = (ErrorNotifier) pipeline.getGenerator();
  -              eg.setException (e);
  -              <xsl:apply-templates select="./map:handle-errors/*"/>
  -              return false;
  -            }
  -          </xsl:if>
  +          try {
  +            <xsl:apply-templates select="./*"/>
  +          } catch (Exception e) {
  +            <xsl:choose>
  +              <xsl:when test="(./map:handle-errors)">
  +                try {
  +                  return error_process_<xsl:value-of select="$pipeline-position"/> (environment, objectModel, e);
  +                } catch (Exception ex) {
  +                  System.out.println (ex.toString());
  +                  ex.printStackTrace(System.out);
  +                }
  +              </xsl:when>
  +              <xsl:otherwise>
  +                System.out.println (e.toString());
  +                e.printStackTrace(System.out);
  +              </xsl:otherwise>
  +            </xsl:choose>
  +          }
           </xsl:for-each>
  +        return false;
         }
  -    </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">
  +      <!-- generate methods for every map:handle-errors elements in all map:pipeline elements -->
  +      <xsl:for-each select="/map:sitemap/map:pipelines/map:pipeline">
  +        <xsl:variable name="pipeline-position" select="position()"/>
  +        <xsl:if test="(./map:handle-errors)">
  +          private boolean error_process_<xsl:value-of select="$pipeline-position"/> (Environment environment, Map objectModel, Exception e)
  +          throws Exception {
  +            ResourcePipeline pipeline = new ResourcePipeline ();
  +            pipeline.setComponentManager (this.manager);
  +            List listOfLists = (List)(new ArrayList());
  +            List list;
  +            Parameters param;
  +            pipeline.setGenerator (generator_error_handler, e.getMessage(), emptyParam);
  +            ErrorNotifier eg = (ErrorNotifier) pipeline.getGenerator();
  +            eg.setException (e);
  +            <xsl:apply-templates select="./map:handle-errors/*"/>
  +            return false;
  +          }
  +        </xsl:if>
  +      </xsl:for-each>
  +    }
  +  </xsl:template> <!-- match="map:sitemap" -->
   
  -      <!-- 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>
  +  <!-- 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">
  +
  +    <!-- 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>
  +
  +    <!-- 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="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:call-template name="generate-name">
  +        <xsl:with-param name="value"><xsl:value-of select="@pattern"/></xsl:with-param>
  +      </xsl:call-template>
  +    </xsl:variable>
  +
  +    <!-- gets the string how the matcher is to be invoced in java code -->
  +    <xsl:variable name="matcher-name">
  +      <xsl:for-each select="/map:sitemap/map:components/map:matchers/map:matcher[@name=$matcher-type]">
  +        <xsl:variable name="is-factory" select="java:isFactory($factory-loader, string(@src))"/>
  +        <xsl:choose>
  +          <xsl:when test="(./@src) and not($is-factory)">
  +            matcher_<xsl:value-of select="translate($matcher-type, '- ', '__')"/>.match
  +          </xsl:when>
  +          <xsl:when test="(./@factory) or $is-factory">
  +            matcher_<xsl:value-of select="$matcher-name2"/>
  +          </xsl:when>
  +          <xsl:otherwise>
  +            <xsl:call-template name="error">
  +              <xsl:with-param name="message">cannot choose a matcher name <xsl:value-of select="$matcher-type"/></xsl:with-param>
  +            </xsl:call-template>
  +          </xsl:otherwise>
  +        </xsl:choose>
  +      </xsl:for-each>
  +    </xsl:variable>
  +
  +    <!-- this is the actual code produced -->
  +    if ((list = <xsl:value-of select="$matcher-name"/> ("<xsl:value-of select="$pattern-value"/>", objectModel)) != null) {
  +      listOfLists.add (list);
  +      <xsl:apply-templates/>
  +      listOfLists.remove (list);
  +    }
  +  </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 -->
  +  <xsl:template match="map:select">
  +
  +    <!-- get the type of selector used -->
  +    <xsl:variable name="selector-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:selectors/@default"/></xsl:with-param>
  +      </xsl:call-template>
  +    </xsl:variable>
  +
  +    <!-- loop through all the when cases -->
  +    <xsl:for-each select="./map:when">
  +
         <!-- get the pattern used -->
  -      <xsl:variable name="pattern-value">
  +      <xsl:variable name="test-value">
           <xsl:call-template name="get-parameter">
  -          <xsl:with-param name="parname">pattern</xsl:with-param>
  +          <xsl:with-param name="parname">test</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">
  +      <!-- 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="value"><xsl:value-of select="@pattern"/></xsl:with-param>
  +          <xsl:with-param name="value" select="@test"/>
           </xsl:call-template>
         </xsl:variable>
   
  -      <!-- gets the string how the matcher is to be invoced in java code -->
  -      <xsl:variable name="matcher-name">
  -        <xsl:for-each select="/map:sitemap/map:components/map:matchers/map:matcher[@name=$matcher-type]">
  +      <!-- gets the string how the selector is to be invoced in java code -->
  +      <xsl:variable name="selector-name">
  +        <xsl:for-each select="/map:sitemap/map:components/map:selectors/map:selector[@name=$selector-type]">
  +          <xsl:variable name="is-factory" select="java:isFactory($factory-loader, string(@src))"/>
             <xsl:choose>
  -            <xsl:when test="(./@src)">
  -              matcher_<xsl:value-of select="translate($matcher-type, '- ', '__')"/>.match
  +            <xsl:when test="(./@src) and not($is-factory)">
  +              selector_<xsl:value-of select="translate($selector-type, '- ', '__')"/>.select
               </xsl:when>
  -            <xsl:when test="(./@factory)">
  -              matcher_<xsl:value-of select="$matcher-name2"/>
  +            <xsl:when test="(./@factory) or $is-factory">
  +              selector_<xsl:value-of select="$selector-name2"/>
               </xsl:when>
               <xsl:otherwise>
                 <xsl:call-template name="error">
  -                <xsl:with-param name="message">cannot choose a matcher name <xsl:value-of select="$matcher-type"/></xsl:with-param>
  +                <xsl:with-param name="message">cannot choose a selector name <xsl:value-of select="$selector-type"/></xsl:with-param>
                 </xsl:call-template>
               </xsl:otherwise>
             </xsl:choose>
           </xsl:for-each>
         </xsl:variable>
   
  -      <!-- this is the actual code produced -->
  -      if ((list = <xsl:value-of select="$matcher-name"/> ("<xsl:value-of select="$pattern-value"/>", objectModel)) != null) {
  -        listOfLists.add (list);
  -        <xsl:apply-templates/>
  -        listOfLists.remove (list);
  +      <!-- this is the actual code produced on the when elements -->
  +      <xsl:if test="position() > 1">
  +        else
  +      </xsl:if>
  +      if (<xsl:value-of select="$selector-name"/> ("<xsl:value-of select="$test-value"/>", environment)) {
  +       <xsl:apply-templates/>
         }
  -    </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 -->
  -    <xsl:template match="map:select">
  -
  -      <!-- get the type of selector used -->
  -      <xsl:variable name="selector-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:selectors/@default"/></xsl:with-param>
  -        </xsl:call-template>
  -      </xsl:variable>
  -
  -      <!-- loop through all the when cases -->
  -      <xsl:for-each select="./map:when">
  -
  -        <!-- 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>
  -
  -        <!-- 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="value" select="@test"/>
  -          </xsl:call-template>
  -        </xsl:variable>
  -
  -        <!-- gets the string how the selector is to be invoced in java code -->
  -        <xsl:variable name="selector-name">
  -          <xsl:for-each select="/map:sitemap/map:components/map:selectors/map:selector[@name=$selector-type]">
  -            <xsl:choose>
  -              <xsl:when test="(./@src)">
  -                selector_<xsl:value-of select="translate($selector-type, '- ', '__')"/>.select
  -              </xsl:when>
  -              <xsl:when test="(./@factory)">
  -                selector_<xsl:value-of select="$selector-name2"/>
  -              </xsl:when>
  -              <xsl:otherwise>
  -                <xsl:call-template name="error">
  -                  <xsl:with-param name="message">cannot choose a selector name <xsl:value-of select="$selector-type"/></xsl:with-param>
  -                </xsl:call-template>
  -              </xsl:otherwise>
  -            </xsl:choose>
  -          </xsl:for-each>
  -        </xsl:variable>
  -
  -        <!-- this is the actual code produced on the when elements -->
  -        <xsl:if test="position() > 1">
  -          else
  -        </xsl:if>
  -        if (<xsl:value-of select="$selector-name"/> ("<xsl:value-of select="$test-value"/>", environment)) {
  -         <xsl:apply-templates/>
  -        }
  -      </xsl:for-each>
  -
  -      <!-- this is the actual code produced on the otherwise element -->
  -      <xsl:for-each select="./map:otherwise">
  -        else {
  -        <xsl:apply-templates/>
  -        }
  -      </xsl:for-each>
  -    </xsl:template> <!-- match="/map:sitemap/map:select" -->
  +    </xsl:for-each>
   
  -
  -    <!-- processing of an act element -->
  -    <xsl:template match="map:act">
  -
  -      <!-- get the type of action used -->
  -      <xsl:variable name="action-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:actions/@default"/></xsl:with-param>
  -        </xsl:call-template>
  -      </xsl:variable>
  +    <!-- this is the actual code produced on the otherwise element -->
  +    <xsl:for-each select="./map:otherwise">
  +      else {
  +      <xsl:apply-templates/>
  +      }
  +    </xsl:for-each>
  +  </xsl:template> <!-- match="/map:sitemap/map:select" -->
   
  -      <!-- gets the string how the action is to be invoced in java code -->
  -      <xsl:variable name="action-name">
  -        <xsl:for-each select="/map:sitemap/map:components/map:actions/map:action[@name=$action-type]">
  -          <xsl:choose>
  -            <xsl:when test="(./@src)">
  -              action_<xsl:value-of select="translate($action-type, '- ', '__')"/>.act
  -            </xsl:when>
  -            <xsl:otherwise>
  -              <xsl:call-template name="error">
  -                <xsl:with-param name="message">cannot choose an action name <xsl:value-of select="$action-type"/></xsl:with-param>
  -              </xsl:call-template>
  -            </xsl:otherwise>
  -          </xsl:choose>
  -        </xsl:for-each>
  -      </xsl:variable>
  +  <!-- processing of an act element -->
  +  <xsl:template match="map:act">
   
  -      <!-- test if we have to define parameters for this action -->
  -      <xsl:if test="count(parameter)>0">
  -        param = new Parameters ();
  -      </xsl:if>
  +    <!-- get the type of action used -->
  +    <xsl:variable name="action-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:actions/@default"/></xsl:with-param>
  +      </xsl:call-template>
  +    </xsl:variable>
   
  -      <!-- generate the value used for the parameter argument in the invocation of the act method of this action -->
  -      <xsl:variable name="component-param">
  +    <!-- gets the string how the action is to be invoced in java code -->
  +    <xsl:variable name="action-name">
  +      <xsl:for-each select="/map:sitemap/map:components/map:actions/map:action[@name=$action-type]">
           <xsl:choose>
  -          <xsl:when test="count(parameter)>0">
  -            param
  +          <xsl:when test="(./@src)">
  +            action_<xsl:value-of select="translate($action-type, '- ', '__')"/>.act
             </xsl:when>
             <xsl:otherwise>
  -            emptyParam
  +            <xsl:call-template name="error">
  +              <xsl:with-param name="message">cannot choose an action name <xsl:value-of select="$action-type"/></xsl:with-param>
  +            </xsl:call-template>
             </xsl:otherwise>
           </xsl:choose>
  -      </xsl:variable>
  +      </xsl:for-each>
  +    </xsl:variable>
   
  -      <!-- collect the parameters -->
  -      <xsl:apply-templates select="parameter"/>
  +    <!-- test if we have to define parameters for this action -->
  +    <xsl:if test="count(parameter)>0">
  +      param = new Parameters ();
  +    </xsl:if>
   
  -      <!-- generate the invocation of the act method of the action component -->
  +    <!-- 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="./*">
  -          if ((list = <xsl:value-of select="$action-name"/> (environment, objectModel, <xsl:value-of select="$src-param"/>, <xsl:value-of select="$component-param"/>)) != null) {
  -            listOfLists.add (list);
  -            <xsl:apply-templates/>
  -            listOfList.remove(list);
  -          }
  +        <xsl:when test="count(parameter)>0">
  +          param
           </xsl:when>
           <xsl:otherwise>
  -          list = <xsl:value-of select="$action-name"/> (environment, objectModel, <xsl:value-of select="$src-param"/>, <xsl:value-of select="$component-param"/>);
  +          emptyParam
           </xsl:otherwise>
         </xsl:choose>
  -    </xsl:template> <!-- match="map:act" -->
  +    </xsl:variable>
   
  -    <!-- generate the code to invoke a generator -->
  -    <xsl:template match="map:generate">
  -      <xsl:call-template name="setup-component">
  -        <xsl:with-param name="default-component" select="/map:sitemap/map:components/map:generators/@default"/>
  -        <xsl:with-param name="method">setGenerator</xsl:with-param>
  -        <xsl:with-param name="prefix">generator</xsl:with-param>
  -      </xsl:call-template>
  -    </xsl:template> <!-- match="map:generate" -->
  +    <!-- collect the parameters -->
  +    <xsl:apply-templates select="parameter"/>
   
  -    <!-- generate the code to invoke a transformer -->
  -    <xsl:template match="map:transform">
  -      <xsl:call-template name="setup-component">
  -        <xsl:with-param name="default-component" select="/map:sitemap/map:components/map:transformers/@default"/>
  -        <xsl:with-param name="method">addTransformer</xsl:with-param>
  -        <xsl:with-param name="prefix">transformer</xsl:with-param>
  -      </xsl:call-template>
  -    </xsl:template> <!-- match="map:transformer" -->
  -
  -    <!-- generate the code to invoke a transformer -->
  -    <xsl:template match="map:serialize">
  +    <!-- generate the invocation of the act method of the action component -->
  +    <xsl:choose>
  +      <xsl:when test="./*">
  +        if ((list = <xsl:value-of select="$action-name"/> (environment, objectModel, <xsl:value-of select="$src-param"/>, <xsl:value-of select="$component-param"/>)) != null) {
  +          listOfLists.add (list);
  +          <xsl:apply-templates/>
  +          listOfList.remove(list);
  +        }
  +      </xsl:when>
  +      <xsl:otherwise>
  +        list = <xsl:value-of select="$action-name"/> (environment, objectModel, <xsl:value-of select="$src-param"/>, <xsl:value-of select="$component-param"/>);
  +      </xsl:otherwise>
  +    </xsl:choose>
  +  </xsl:template> <!-- match="map:act" -->
  +
  +  <!-- generate the code to invoke a generator -->
  +  <xsl:template match="map:generate">
  +    <xsl:call-template name="setup-component">
  +      <xsl:with-param name="default-component" select="/map:sitemap/map:components/map:generators/@default"/>
  +      <xsl:with-param name="method">setGenerator</xsl:with-param>
  +      <xsl:with-param name="prefix">generator</xsl:with-param>
  +    </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">
  +      <xsl:with-param name="default-component" select="/map:sitemap/map:components/map:transformers/@default"/>
  +      <xsl:with-param name="method">addTransformer</xsl:with-param>
  +      <xsl:with-param name="prefix">transformer</xsl:with-param>
  +    </xsl:call-template>
  +  </xsl:template> <!-- match="map:transformer" -->
  +
  +  <!-- generate the code to invoke a transformer -->
  +  <xsl:template match="map:serialize">
  +
  +    <!-- get the type of serializer used -->
  +    <xsl:variable name="default-serializer-type">
  +      <xsl:value-of select="/map:sitemap/map:components/map:serializers/@default"/>
  +    </xsl:variable>
  +    <xsl:variable name="this-type">
  +      <xsl:choose>
  +        <xsl:when test="@type">
  +          <xsl:value-of select="@type"/>
  +        </xsl:when>
  +        <xsl:otherwise>
  +          <xsl:value-of select="$default-serializer-type"/>
  +        </xsl:otherwise>
  +      </xsl:choose>
  +    </xsl:variable>
   
  -      <!-- get the type of serializer used -->
  -      <xsl:variable name="default-serializer-type">
  -        <xsl:value-of select="/map:sitemap/map:components/map:serializers/@default"/>
  -      </xsl:variable>
  -      <xsl:variable name="this-type">
  +    <!-- get the mime-type to be used for this serializer -->
  +    <xsl:variable name="default-mime-type">
  +      <xsl:value-of select="/map:sitemap/map:components/map:serializers/map:serializer[@name=$this-type]/@mime-type"/>
  +    </xsl:variable>
  +
  +    <!-- generate the code to invoke a serializer -->
  +    <xsl:call-template name="setup-component">
  +      <xsl:with-param name="default-component" select="$default-serializer-type"/>
  +      <xsl:with-param name="method">setSerializer</xsl:with-param>
  +      <xsl:with-param name="prefix">serializer</xsl:with-param>
  +      <xsl:with-param name="mime-type">
           <xsl:choose>
  -          <xsl:when test="@type">
  -            <xsl:value-of select="@type"/>
  +          <xsl:when test="@mime-type">
  +              <xsl:value-of select="@mime-type"/>
             </xsl:when>
             <xsl:otherwise>
  -            <xsl:value-of select="$default-serializer-type"/>
  +            <xsl:value-of select="$default-mime-type"/>
             </xsl:otherwise>
           </xsl:choose>
  -      </xsl:variable>
  +      </xsl:with-param>
  +    </xsl:call-template>
   
  -      <!-- get the mime-type to be used for this serializer -->
  -      <xsl:variable name="default-mime-type">
  -        <xsl:value-of select="/map:sitemap/map:components/map:serializers/map:serializer[@name=$this-type]/@mime-type"/>
  -      </xsl:variable>
  -
  -      <!-- generate the code to invoke a serializer -->
  -      <xsl:call-template name="setup-component">
  -        <xsl:with-param name="default-component" select="$default-serializer-type"/>
  -        <xsl:with-param name="method">setSerializer</xsl:with-param>
  -        <xsl:with-param name="prefix">serializer</xsl:with-param>
  -        <xsl:with-param name="mime-type">
  -          <xsl:choose>
  -            <xsl:when test="@mime-type">
  -                <xsl:value-of select="@mime-type"/>
  -            </xsl:when>
  -            <xsl:otherwise>
  -              <xsl:value-of select="$default-mime-type"/>
  -            </xsl:otherwise>
  -          </xsl:choose>
  -        </xsl:with-param>
  -      </xsl:call-template>
  -
  -      <!-- if there is a status-code attribute tell it to the environment -->
  -      <xsl:if test="@status-code">
  -        environment.setStatus(<xsl:value-of select="@status-code"/>);
  -      </xsl:if>
  +    <!-- if there is a status-code attribute tell it to the environment -->
  +    <xsl:if test="@status-code">
  +      environment.setStatus(<xsl:value-of select="@status-code"/>);
  +    </xsl:if>
  +
  +    <!-- the "if(true)" is needed to prevent "statement not reachable" error messages during compile -->
  +    if(true)return pipeline.process (environment);
  +  </xsl:template> <!-- match="map:serialize" -->
  +
  +  <!-- generate the code to invoke a transformer -->
  +  <xsl:template match="map:read">
  +
  +    <!-- get the type of reader used -->
  +    <xsl:variable name="default-reader-type">
  +      <xsl:value-of select="/map:sitemap/map:components/map:readers/@default"/>
  +    </xsl:variable>
  +    <xsl:variable name="this-type">
  +      <xsl:choose>
  +        <xsl:when test="@type">
  +          <xsl:value-of select="@type"/>
  +        </xsl:when>
  +        <xsl:otherwise>
  +          <xsl:value-of select="$default-reader-type"/>
  +        </xsl:otherwise>
  +      </xsl:choose>
  +    </xsl:variable>
   
  -      <!-- the "if(true)" is needed to prevent "statement not reachable" error messages during compile -->
  -      if(true)return pipeline.process (environment);
  -    </xsl:template> <!-- match="map:serialize" -->
  -
  -    <!-- generate the code to invoke a transformer -->
  -    <xsl:template match="map:read">
  -
  -      <!-- get the type of reader used -->
  -      <xsl:variable name="default-reader-type">
  -        <xsl:value-of select="/map:sitemap/map:components/map:readers/@default"/>
  -      </xsl:variable>
  -      <xsl:variable name="this-type">
  +    <!-- get the mime-type to be used for this reader -->
  +    <xsl:variable name="default-mime-type">
  +      <xsl:value-of select="/map:sitemap/map:components/map:readers/map:reader[@name=$this-type]/@mime-type"/>
  +    </xsl:variable>
  +
  +    <!-- generate the code to invoke a reader -->
  +    <xsl:call-template name="setup-component">
  +      <xsl:with-param name="default-component" select="/map:sitemap/map:components/map:readers/@default"/>
  +      <xsl:with-param name="method">setReader</xsl:with-param>
  +      <xsl:with-param name="prefix">reader</xsl:with-param>
  +      <xsl:with-param name="mime-type">
           <xsl:choose>
  -          <xsl:when test="@type">
  -            <xsl:value-of select="@type"/>
  +          <xsl:when test="@mime-type">
  +            <xsl:value-of select="@mime-type"/>
             </xsl:when>
  -          <xsl:otherwise>
  -            <xsl:value-of select="$default-reader-type"/>
  -          </xsl:otherwise>
  -        </xsl:choose>
  -      </xsl:variable>
  -
  -      <!-- get the mime-type to be used for this serializer -->
  -      <xsl:variable name="default-mime-type">
  -        <xsl:value-of select="/map:sitemap/map:components/map:readers/map:reader[@name=$this-type]/@mime-type"/>
  -      </xsl:variable>
  -
  -      <!-- generate the code to invoke a serializer -->
  -      <xsl:call-template name="setup-component">
  -        <xsl:with-param name="default-component" select="/map:sitemap/map:components/map:readers/@default"/>
  -        <xsl:with-param name="method">setReader</xsl:with-param>
  -        <xsl:with-param name="prefix">reader</xsl:with-param>
  -        <xsl:with-param name="mime-type">
  -          <xsl:choose>
  -            <xsl:when test="@mime-type">
  -              <xsl:value-of select="@mime-type"/>
  -            </xsl:when>
  -            <xsl:otherwise>
  -              <xsl:value-of select="$default-mime-type"/>
  -            </xsl:otherwise>
  -          </xsl:choose>
  -        </xsl:with-param>
  -      </xsl:call-template>
  -
  -      <!-- the "if(true)" is needed to prevent "statement not reachable" error messages during compile -->
  -      if(true)return pipeline.process (environment);
  -    </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:variable name="check-reload">
  -        <xsl:choose>
  -          <xsl:when test="@check-reload='yes'">true</xsl:when>
  -          <xsl:when test="@check-reload='true'">true</xsl:when>
  -          <xsl:when test="@check-reload='no'">false</xsl:when>
  -          <xsl:when test="@check-reload='false'">false</xsl:when>
  -          <xsl:when test="not(@check-reload)">true</xsl:when>
             <xsl:otherwise>
  -            <xsl:call-template name="error">
  -              <xsl:with-param name="message">
  -                element <xsl:value-of select="name(.)"/> with uri-prefix="<xsl:value-of select="@uri-prefix"/>" has a wrong value in 'check-reload' attribute . Use "yes" or "no" but not "<xsl:value-of select="@check-reload"/>".
  -              </xsl:with-param>
  -            </xsl:call-template>
  +            <xsl:value-of select="$default-mime-type"/>
             </xsl:otherwise>
           </xsl:choose>
  -      </xsl:variable>
  +      </xsl:with-param>
  +    </xsl:call-template>
   
  -      <!-- generate the code to invoke the sitemapManager which handles delegation of control to sub sitemaps -->
  -      <!-- here we make sure the uri-prefix ends with a slash -->
  -      <xsl:choose>
  -        <xsl:when test="substring(@uri-prefix,string-length(@uri-prefix))='/'">
  -          if(true)return sitemapManager.invoke (environment, substitute(listOfLists,"<xsl:value-of select="@uri-prefix"/>"), substitute(listOfLists,"<xsl:value-of select="@src"/>"), <xsl:value-of select="$check-reload"/>);
  -        </xsl:when>
  -        <xsl:when test="substring(@uri-prefix,string-length(@uri-prefix))='}'">
  -          String uri_prefix<xsl:value-of select="count(.)"/>=substitute(listOfLists,"<xsl:value-of select="@uri-prefix"/>");
  -          if (uri_prefix<xsl:value-of select="count(.)"/>.charAt(uri_prefix<xsl:value-of select="count(.)"/>.length()-1)=='/'){
  -            return sitemapManager.invoke (environment, uri_prefix<xsl:value-of select="count(.)"/>, substitute(listOfLists,"<xsl:value-of select="@src"/>"), <xsl:value-of select="$check-reload"/>);
  -          } else {
  -            return sitemapManager.invoke (environment, uri_prefix<xsl:value-of select="count(.)"/>+"/", substitute(listOfLists,"<xsl:value-of select="@src"/>"), <xsl:value-of select="$check-reload"/>);
  -          }
  -        </xsl:when>
  -        <xsl:otherwise>
  -          if(true)return sitemapManager.invoke (environment, substitute(listOfLists,"<xsl:value-of select="@uri-prefix"/>/"), substitute(listOfLists,"<xsl:value-of select="@src"/>"), <xsl:value-of select="$check-reload"/>);
  -        </xsl:otherwise>
  -      </xsl:choose>
  -    </xsl:template> <!-- match="map:mount" -->
  +    <!-- the "if(true)" is needed to prevent "statement not reachable" error messages during compile -->
  +    if(true)return pipeline.process (environment);
  +  </xsl:template> <!-- match="map:read" -->
  +
  +  <!-- generate the code to invoke a sub sitemap  -->
  +  <xsl:template match="map:mount">
  +    <xsl:variable name="src" select="@src"/>
   
  -    <!-- generate the code to redirect a request -->
  -    <xsl:template match="map:redirect-to">
  +    <xsl:variable name="check-reload">
         <xsl:choose>
  -
  -        <!-- redirect to a internal resource definition -->
  -        <xsl:when test="@resource">
  -          if(true)return resource_<xsl:value-of select="translate(@resource, '- ', '__')"/>(pipeline, listOfLists, environment, cocoon_view);
  -        </xsl:when>
  -
  -        <!-- redirect to a external resource definition. Let the environment do the redirect -->
  -        <xsl:when test="@uri">
  -          environment.redirect (substitute(listOfLists, "<xsl:value-of select="@uri"/>"));
  -          if(true)return true;
  -        </xsl:when>
  -
  -        <!-- any other combination generates an error message -->
  +        <xsl:when test="@check-reload='yes'">true</xsl:when>
  +        <xsl:when test="@check-reload='true'">true</xsl:when>
  +        <xsl:when test="@check-reload='no'">false</xsl:when>
  +        <xsl:when test="@check-reload='false'">false</xsl:when>
  +        <xsl:when test="not(@check-reload)">true</xsl:when>
           <xsl:otherwise>
             <xsl:call-template name="error">
  -            <xsl:with-param name="message">Missing attribute uri= or resource= to element redirect-to</xsl:with-param>
  +            <xsl:with-param name="message">
  +              element <xsl:value-of select="name(.)"/> with uri-prefix="<xsl:value-of select="@uri-prefix"/>" has a wrong value in 'check-reload' attribute . Use "yes" or "no" but not "<xsl:value-of select="@check-reload"/>".
  +            </xsl:with-param>
             </xsl:call-template>
           </xsl:otherwise>
         </xsl:choose>
  -    </xsl:template> <!-- match="map:redirect-to" -->
  -
  -    <!-- generate the code to match a label definition -->
  -    <xsl:template match="map:label">
  -      <xsl:apply-templates/>
  -      if ("<xsl:value-of select="@name"/>".equals(cocoon_view))
  -        return view_<xsl:value-of select="translate(@name, '- ', '__')"/> (pipeline, listOfLists, environment);
  -    </xsl:template> <!-- match="map:label" -->
  -
  -    <!-- collect parameter definitions -->
  -    <xsl:template match="map:pipeline//parameter">
  -      param.setParameter ("<xsl:value-of select="@name"/>", "<xsl:value-of select="@value"/>");
  -    </xsl:template>
  -
  -    <!-- FIXME:(GP) is this still valid? -->
  -    <xsl:template match="map:param">
  -      param.setParameter ("<xsl:value-of select="@name"/>", "<xsl:value-of select="@map:value"/>");
  -    </xsl:template>
  -
  -    <!-- Sitemap Utility templates -->
  -
  -    <!-- this template generates the code to configure a specific sitemap component -->
  -    <xsl:template name="config-components">
  -      <xsl:param name="name"/>
  -      <xsl:param name="interface"/>
  -      <xsl:param name="components"/>
  +    </xsl:variable>
   
  -      <xsl:variable name="qname">
  -        <xsl:value-of select="concat($prefix, ':value')"/>
  +    <!-- generate the code to invoke the sitemapManager which handles delegation of control to sub sitemaps -->
  +    <!-- here we make sure the uri-prefix ends with a slash -->
  +    <xsl:choose>
  +      <xsl:when test="substring(@uri-prefix,string-length(@uri-prefix))='/'">
  +        if(true)return sitemapManager.invoke (environment, substitute(listOfLists,"<xsl:value-of select="@uri-prefix"/>"), substitute(listOfLists,"<xsl:value-of select="@src"/>"), <xsl:value-of select="$check-reload"/>);
  +      </xsl:when>
  +      <xsl:when test="substring(@uri-prefix,string-length(@uri-prefix))='}'">
  +        String uri_prefix<xsl:value-of select="count(.)"/>=substitute(listOfLists,"<xsl:value-of select="@uri-prefix"/>");
  +        if (uri_prefix<xsl:value-of select="count(.)"/>.charAt(uri_prefix<xsl:value-of select="count(.)"/>.length()-1)=='/'){
  +          return sitemapManager.invoke (environment, uri_prefix<xsl:value-of select="count(.)"/>, substitute(listOfLists,"<xsl:value-of select="@src"/>"), <xsl:value-of select="$check-reload"/>);
  +        } else {
  +          return sitemapManager.invoke (environment, uri_prefix<xsl:value-of select="count(.)"/>+"/", substitute(listOfLists,"<xsl:value-of select="@src"/>"), <xsl:value-of select="$check-reload"/>);
  +        }
  +      </xsl:when>
  +      <xsl:otherwise>
  +        if(true)return sitemapManager.invoke (environment, substitute(listOfLists,"<xsl:value-of select="@uri-prefix"/>/"), substitute(listOfLists,"<xsl:value-of select="@src"/>"), <xsl:value-of select="$check-reload"/>);
  +      </xsl:otherwise>
  +    </xsl:choose>
  +  </xsl:template> <!-- match="map:mount" -->
  +
  +  <!-- 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">
  +        if(true)return resource_<xsl:value-of select="translate(@resource, '- ', '__')"/>(pipeline, listOfLists, environment, cocoon_view);
  +      </xsl:when>
  +
  +      <!-- redirect to a external resource definition. Let the environment do the redirect -->
  +      <xsl:when test="@uri">
  +        environment.redirect (substitute(listOfLists, "<xsl:value-of select="@uri"/>"));
  +        if(true)return true;
  +      </xsl:when>
  +
  +      <!-- any other combination generates an error message -->
  +      <xsl:otherwise>
  +        <xsl:call-template name="error">
  +          <xsl:with-param name="message">Missing attribute uri= or resource= to element redirect-to</xsl:with-param>
  +        </xsl:call-template>
  +      </xsl:otherwise>
  +    </xsl:choose>
  +  </xsl:template> <!-- match="map:redirect-to" -->
  +
  +  <!-- generate the code to match a label definition -->
  +  <xsl:template match="map:label">
  +    <xsl:apply-templates/>
  +    if ("<xsl:value-of select="@name"/>".equals(cocoon_view))
  +      return view_<xsl:value-of select="translate(@name, '- ', '__')"/> (pipeline, listOfLists, environment);
  +  </xsl:template> <!-- match="map:label" -->
  +
  +  <!-- collect parameter definitions -->
  +  <xsl:template match="map:pipeline//parameter">
  +    param.setParameter ("<xsl:value-of select="@name"/>", "<xsl:value-of select="@value"/>");
  +  </xsl:template>
  +
  +  <!-- FIXME:(GP) is this still valid? -->
  +  <xsl:template match="map:param">
  +    param.setParameter ("<xsl:value-of select="@name"/>", "<xsl:value-of select="@map:value"/>");
  +  </xsl:template>
  +
  +  <!-- Sitemap Utility templates -->
  +
  +  <!-- this template generates the code to configure a specific sitemap component -->
  +  <xsl:template name="config-components">
  +    <xsl:param name="name"/>
  +    <xsl:param name="interface"/>
  +    <xsl:param name="components"/>
  +
  +    <xsl:variable name="qname">
  +      <xsl:value-of select="concat($prefix, ':value')"/>
  +    </xsl:variable>
  +
  +    <xsl:variable name="ns" select="namespace-uri(.)"/>
  +    <xsl:for-each select="$components">
  +      <xsl:variable name="factory-component">
  +        <xsl:if test="$name = 'matcher' or $name = 'selector'"><xsl:value-of select="java:isFactory($factory-loader, string(@src))"/></xsl:if>
         </xsl:variable>
  -
  -      <xsl:variable name="ns" select="namespace-uri(.)"/>
  -      <xsl:for-each select="$components">
  +      <xsl:if test="not($factory-component)">
           confBuilder.startDocument ();
           <xsl:if test="$ns">
             confBuilder.startPrefixMapping("","<xsl:value-of select="namespace-uri(.)"/>");
           </xsl:if>
  +
           <!-- Create root configuration -->
           attr.clear();
           <xsl:for-each select="attribute::*[name(.)!=$qname]">
  @@ -804,257 +850,253 @@
           confBuilder.endElement ("", "<xsl:value-of select="translate(@name, '- ', '__')"/>",
                                       "<xsl:value-of select="translate(@name, '- ', '__')"/>");
           <xsl:if test="$ns">
  -          confBuilder.endPrefixMapping("");
  +        confBuilder.endPrefixMapping("");
           </xsl:if>
           confBuilder.endDocument ();
           cconf = confBuilder.getConfiguration();
           <xsl:value-of select="$name"/>_config_<xsl:value-of select="translate(@name, '- ', '__')"/> = cconf;
           <xsl:value-of select="$name"/>_<xsl:value-of select="translate(@name, '- ', '__')"/> =
  -          (<xsl:value-of select="$interface"/>)load_component ("<xsl:value-of select="@src"/>",
  -              cconf);
  -      </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"/>
  -      <xsl:param name="config-name"/>
  -      <xsl:param name="interface"/>
  -      <xsl:param name="components"/>
  -      <xsl:param name="type"/>
  -      <xsl:param name="ns"/>
  -      <xsl:param name="subname"/>
  -
  -      <xsl:variable name="qname">
  -        <xsl:value-of select="concat($prefix, ':value')"/>
  -      </xsl:variable>
  +          (ComponentHolder)load_component ("<xsl:value-of select="@src"/>", cconf);
  +      </xsl:if>
  +    </xsl:for-each>
  +  </xsl:template>
   
  -      <!-- process content -->
  -      <xsl:for-each select="$components">
  -        <xsl:if test="$ns!=namespace-uri(.)">
  -          confBuilder.startPrefixMapping("","<xsl:value-of select="namespace-uri(.)"/>");
  -        </xsl:if>
  -        attr.clear();
  -        <xsl:for-each select="attribute::*[name(.)!=$qname]">
  -          attr.addAttribute ("", "<xsl:value-of select="local-name(.)"/>", "<xsl:value-of select="name(.)"/>", "CDATA", "<xsl:value-of select="."/>");
  -        </xsl:for-each>
  -        confBuilder.startElement("<xsl:value-of select="namespace-uri(.)"/>", "<xsl:value-of select="local-name(.)"/>", "<xsl:value-of select="name(.)"/>", attr);
  -        <xsl:for-each select="attribute::*[name(.)=$qname]">
  -          confBuilder.characters("<xsl:value-of select="."/>".toCharArray(), 0, <xsl:value-of select="string-length(.)"/>);
  -        </xsl:for-each>
  -        <xsl:if test="normalize-space(text())">
  -          confBuilder.characters("<xsl:value-of select="text()"/>".toCharArray(), 0, <xsl:value-of select="string-length(text())"/>);
  -        </xsl:if>
  -        <xsl:variable name="newsubname">
  -          <xsl:choose>
  -            <xsl:when test="not($subname)"><xsl:value-of select="position()"/></xsl:when>
  -            <xsl:otherwise><xsl:value-of select="concat($subname,position())"/></xsl:otherwise>
  -          </xsl:choose>
  -        </xsl:variable>
  -        <xsl:call-template name="nested-config-components">
  -          <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="interface"><xsl:value-of select="$interface"/></xsl:with-param>
  -          <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>
  -        </xsl:call-template>
  -        confBuilder.endElement("<xsl:value-of select="namespace-uri(.)"/>", "<xsl:value-of select="local-name(.)"/>", "<xsl:value-of select="name(.)"/>");
  -        <xsl:if test="$ns!=namespace-uri(.)">
  -          confBuilder.endPrefixMapping("");
  -        </xsl:if>
  +  <!-- this template generates the code to collect configurations for a specific sitemap component -->
  +  <xsl:template name="nested-config-components">
  +    <xsl:param name="name"/>
  +    <xsl:param name="config-name"/>
  +    <xsl:param name="interface"/>
  +    <xsl:param name="components"/>
  +    <xsl:param name="type"/>
  +    <xsl:param name="ns"/>
  +    <xsl:param name="subname"/>
  +
  +    <xsl:variable name="qname">
  +      <xsl:value-of select="concat($prefix, ':value')"/>
  +    </xsl:variable>
  +
  +    <!-- process content -->
  +    <xsl:for-each select="$components">
  +      <xsl:if test="$ns!=namespace-uri(.)">
  +        confBuilder.startPrefixMapping("","<xsl:value-of select="namespace-uri(.)"/>");
  +      </xsl:if>
  +      attr.clear();
  +      <xsl:for-each select="attribute::*[name(.)!=$qname]">
  +        attr.addAttribute ("", "<xsl:value-of select="local-name(.)"/>", "<xsl:value-of select="name(.)"/>", "CDATA", "<xsl:value-of select="."/>");
         </xsl:for-each>
  -    </xsl:template>
  -
  -    <!-- this template is used to setup a individua÷l sitemap component before putting it into a pipeline -->
  -    <xsl:template name="setup-component">
  -      <xsl:param name="default-component"/>
  -      <xsl:param name="method"/>
  -      <xsl:param name="prefix"/>
  -      <xsl:param name="mime-type"/>
  -      <!-- view/label 'last' check -->
  -      <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)) {
  -              return view_<xsl:value-of select="translate(@name, '- ', '__')"/> (pipeline, listOfLists, environment);
  -            }
  -          </xsl:for-each>
  -          // performing link translation
  -          if (environment.getObjectModel().containsKey(Cocoon.LINK_OBJECT)) {
  -              pipeline.addTransformer (transformer_link_translator, null, transformer_config_link_translator, emptyParam);
  -          }
  -        </xsl:if>
  +      confBuilder.startElement("<xsl:value-of select="namespace-uri(.)"/>", "<xsl:value-of select="local-name(.)"/>", "<xsl:value-of select="name(.)"/>", attr);
  +      <xsl:for-each select="attribute::*[name(.)=$qname]">
  +        confBuilder.characters("<xsl:value-of select="."/>".toCharArray(), 0, <xsl:value-of select="string-length(.)"/>);
  +      </xsl:for-each>
  +      <xsl:if test="normalize-space(text())">
  +        confBuilder.characters("<xsl:value-of select="text()"/>".toCharArray(), 0, <xsl:value-of select="string-length(text())"/>);
         </xsl:if>
  -
  -      <!-- get the type of the component -->
  -      <xsl:variable name="component-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="$default-component"/></xsl:with-param>
  -        </xsl:call-template>
  -      </xsl:variable>
  -
  -      <!-- get the source attribute of the component -->
  -      <xsl:variable name="component-source">
  -        <xsl:call-template name="get-parameter">
  -          <xsl:with-param name="parname">src</xsl:with-param>
  -          <xsl:with-param name="default">null</xsl:with-param>
  -        </xsl:call-template>
  +      <xsl:variable name="newsubname">
  +        <xsl:choose>
  +          <xsl:when test="not($subname)"><xsl:value-of select="position()"/></xsl:when>
  +          <xsl:otherwise><xsl:value-of select="concat($subname,position())"/></xsl:otherwise>
  +        </xsl:choose>
         </xsl:variable>
  +      <xsl:call-template name="nested-config-components">
  +        <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="interface"><xsl:value-of select="$interface"/></xsl:with-param>
  +        <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>
  +      </xsl:call-template>
  +      confBuilder.endElement("<xsl:value-of select="namespace-uri(.)"/>", "<xsl:value-of select="local-name(.)"/>", "<xsl:value-of select="name(.)"/>");
  +      <xsl:if test="$ns!=namespace-uri(.)">
  +        confBuilder.endPrefixMapping("");
  +      </xsl:if>
  +    </xsl:for-each>
  +  </xsl:template>
   
  -      <!-- test if we have to define parameters for this action -->
  -      <xsl:if test="count(parameter)>0">
  -        param = new Parameters ();
  +  <!-- this template is used to setup a individual sitemap component before putting it into a pipeline -->
  +  <xsl:template name="setup-component">
  +    <xsl:param name="default-component"/>
  +    <xsl:param name="method"/>
  +    <xsl:param name="prefix"/>
  +    <xsl:param name="mime-type"/>
  +    <!-- view/label 'last' check -->
  +    <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)) {
  +            return view_<xsl:value-of select="translate(@name, '- ', '__')"/> (pipeline, listOfLists, environment);
  +          }
  +        </xsl:for-each>
  +        // performing link translation
  +        if (environment.getObjectModel().containsKey(Cocoon.LINK_OBJECT)) {
  +            pipeline.addTransformer (transformer_link_translator, null, emptyParam);
  +        }
         </xsl:if>
  +    </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(parameter)>0">
  -            param
  -          </xsl:when>
  -          <xsl:otherwise>
  -            emptyParam
  -          </xsl:otherwise>
  -        </xsl:choose>
  -      </xsl:variable>
  +    <!-- get the type of the component -->
  +    <xsl:variable name="component-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="$default-component"/></xsl:with-param>
  +      </xsl:call-template>
  +    </xsl:variable>
   
  -      <!-- collect the parameters -->
  -      <xsl:apply-templates select="parameter"/>
  +    <!-- get the source attribute of the component -->
  +    <xsl:variable name="component-source">
  +      <xsl:call-template name="get-parameter">
  +        <xsl:with-param name="parname">src</xsl:with-param>
  +        <xsl:with-param name="default">null</xsl:with-param>
  +      </xsl:call-template>
  +    </xsl:variable>
  +
  +    <!-- test if we have to define parameters for this action -->
  +    <xsl:if test="count(parameter)>0">
  +      param = new Parameters ();
  +    </xsl:if>
   
  -      <!-- determine the right invokation according to "has a src attribute" and "has a mime-type attribute" -->
  +    <!-- 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="$component-source='null'">
  -          <xsl:choose>
  -            <xsl:when test="$mime-type!=''">
  -              pipeline.<xsl:value-of select="$method"/> (<xsl:value-of select="$prefix"/>_<xsl:value-of select="$component-type"/>,
  -                  null, <xsl:value-of select="$prefix"/>_config_<xsl:value-of select="$component-type"/>,
  -                  <xsl:value-of select="$component-param"/>,"<xsl:value-of select="$mime-type"/>");
  -            </xsl:when>
  -            <xsl:otherwise>
  -              pipeline.<xsl:value-of select="$method"/> (<xsl:value-of select="$prefix"/>_<xsl:value-of select="$component-type"/>,
  -                  null, <xsl:value-of select="$prefix"/>_config_<xsl:value-of select="$component-type"/>,
  -                  <xsl:value-of select="$component-param"/>);
  -            </xsl:otherwise>
  -          </xsl:choose>
  +        <xsl:when test="count(parameter)>0">
  +          param
           </xsl:when>
           <xsl:otherwise>
  -          <xsl:choose>
  -            <xsl:when test="$mime-type!=''">
  -              pipeline.<xsl:value-of select="$method"/> (<xsl:value-of select="$prefix"/>_<xsl:value-of select="$component-type"/>,
  -                  substitute(listOfLists,"<xsl:value-of select="$component-source"/>"),
  -                  <xsl:value-of select="$prefix"/>_config_<xsl:value-of select="$component-type"/>,
  -                  <xsl:value-of select="$component-param"/>,"<xsl:value-of select="$mime-type"/>");
  -            </xsl:when>
  -            <xsl:otherwise>
  -              pipeline.<xsl:value-of select="$method"/> (<xsl:value-of select="$prefix"/>_<xsl:value-of select="$component-type"/>,
  -                  substitute(listOfLists,"<xsl:value-of select="$component-source"/>"),
  -                  <xsl:value-of select="$prefix"/>_config_<xsl:value-of select="$component-type"/>,
  -                  <xsl:value-of select="$component-param"/>);
  -            </xsl:otherwise>
  -          </xsl:choose>
  +          emptyParam
           </xsl:otherwise>
         </xsl:choose>
  +    </xsl:variable>
   
  -      <!-- view/label check -->
  -      <xsl:if test="not(ancestor::map:views) and not(ancestor::map:handle-errors)">
  -        <xsl:variable name="component-label">
  -          <xsl:if test="$prefix='generator'">
  -            <xsl:value-of select="/map:sitemap/map:components/map:generators/map:generator[@name=$component-type]/@label"/>
  -          </xsl:if>
  -          <xsl:if test="$prefix='transformer'">
  -            <xsl:value-of select="/map:sitemap/map:components/map:transformers/map:transformer[@name=$component-type]/@label"/>
  -          </xsl:if>
  -        </xsl:variable>
  -        <xsl:if test="$component-label">
  -          <xsl:for-each select="/map:sitemap/map:views/map:view[@from-label=$component-label]">
  -            if ("<xsl:value-of select="@name"/>".equals(cocoon_view)) {
  -              return view_<xsl:value-of select="translate(@name, '- ', '__')"/> (pipeline, listOfLists, environment);
  -            }
  -          </xsl:for-each>
  -        </xsl:if>
  +    <!-- collect the parameters -->
  +    <xsl:apply-templates select="parameter"/>
  +
  +    <!-- determine the right invokation according to "has a src attribute" and "has a mime-type attribute" -->
  +    <xsl:choose>
  +      <xsl:when test="$component-source='null'">
  +        <xsl:choose>
  +          <xsl:when test="$mime-type!=''">
  +            pipeline.<xsl:value-of select="$method"/> (<xsl:value-of select="$prefix"/>_<xsl:value-of select="$component-type"/>,
  +                null, <xsl:value-of select="$component-param"/>,"<xsl:value-of select="$mime-type"/>");
  +          </xsl:when>
  +          <xsl:otherwise>
  +            pipeline.<xsl:value-of select="$method"/> (<xsl:value-of select="$prefix"/>_<xsl:value-of select="$component-type"/>,
  +                null, <xsl:value-of select="$component-param"/>);
  +          </xsl:otherwise>
  +        </xsl:choose>
  +      </xsl:when>
  +      <xsl:otherwise>
  +        <xsl:choose>
  +          <xsl:when test="$mime-type!=''">
  +            pipeline.<xsl:value-of select="$method"/> (<xsl:value-of select="$prefix"/>_<xsl:value-of select="$component-type"/>,
  +                substitute(listOfLists,"<xsl:value-of select="$component-source"/>"),
  +                <xsl:value-of select="$component-param"/>,"<xsl:value-of select="$mime-type"/>");
  +          </xsl:when>
  +          <xsl:otherwise>
  +            pipeline.<xsl:value-of select="$method"/> (<xsl:value-of select="$prefix"/>_<xsl:value-of select="$component-type"/>,
  +                substitute(listOfLists,"<xsl:value-of select="$component-source"/>"),
  +                <xsl:value-of select="$component-param"/>);
  +          </xsl:otherwise>
  +        </xsl:choose>
  +      </xsl:otherwise>
  +    </xsl:choose>
  +
  +    <!-- view/label check -->
  +    <xsl:if test="not(ancestor::map:views) and not(ancestor::map:handle-errors)">
  +      <xsl:variable name="component-label">
           <xsl:if test="$prefix='generator'">
  -          <xsl:for-each select="/map:sitemap/map:views/map:view[@from-position='first']">
  -            if ("<xsl:value-of select="@name"/>".equals(cocoon_view)) {
  -              return view_<xsl:value-of select="translate(@name, '- ', '__')"/> (pipeline, listOfLists, environment);
  -            }
  -          </xsl:for-each>
  +          <xsl:value-of select="/map:sitemap/map:components/map:generators/map:generator[@name=$component-type]/@label"/>
  +        </xsl:if>
  +        <xsl:if test="$prefix='transformer'">
  +          <xsl:value-of select="/map:sitemap/map:components/map:transformers/map:transformer[@name=$component-type]/@label"/>
           </xsl:if>
  +      </xsl:variable>
  +      <xsl:if test="$component-label">
  +        <xsl:for-each select="/map:sitemap/map:views/map:view[@from-label=$component-label]">
  +          if ("<xsl:value-of select="@name"/>".equals(cocoon_view)) {
  +            return view_<xsl:value-of select="translate(@name, '- ', '__')"/> (pipeline, listOfLists, environment);
  +          }
  +        </xsl:for-each>
         </xsl:if>
  -    </xsl:template>
  +      <xsl:if test="$prefix='generator'">
  +        <xsl:for-each select="/map:sitemap/map:views/map:view[@from-position='first']">
  +          if ("<xsl:value-of select="@name"/>".equals(cocoon_view)) {
  +            return view_<xsl:value-of select="translate(@name, '- ', '__')"/> (pipeline, listOfLists, environment);
  +          }
  +        </xsl:for-each>
  +      </xsl:if>
  +    </xsl:if>
  +  </xsl:template>
   
  -    <!-- replace invalid characters with underscores -->
  -    <xsl:template name="generate-name">
  -      <xsl:param name="value"/>
  -      <xsl:param name="prefix"/>
  -      <xsl:param name="suffix"/>
  -      <xsl:variable name="value1" select="translate($value,'/- *?@:{}()[].#^\\$|&#33;~\','______________________')"/>
  -      <xsl:value-of select="$prefix"/><xsl:value-of select='translate($value1,"&#39;","")'/><xsl:value-of select="$suffix"/>
  -    </xsl:template>
  -
  -    <!-- These are the usual utility templates for logicsheets -->
  -
  -    <xsl:template name="get-parameter-as-string">
  -      <xsl:param name="parname"/>
  -      <xsl:param name="default"/>
  -      <xsl:param name="required">false</xsl:param>
  +  <!-- replace invalid characters with underscores -->
  +  <xsl:template name="generate-name">
  +    <xsl:param name="value"/>
  +    <xsl:param name="prefix"/>
  +    <xsl:param name="suffix"/>
  +    <xsl:variable name="value1" select="translate($value,'/- *?@:{}()[].#^\\$|&#33;~\','______________________')"/>
  +    <xsl:value-of select="$prefix"/><xsl:value-of select='translate($value1,"&#39;","")'/><xsl:value-of select="$suffix"/>
  +  </xsl:template>
  +
  +  <!-- These are the usual utility templates for logicsheets -->
  +
  +  <xsl:template name="get-parameter-as-string">
  +    <xsl:param name="parname"/>
  +    <xsl:param name="default"/>
  +    <xsl:param name="required">false</xsl:param>
  +
  +    <xsl:variable name="result">
  +      <xsl:call-template name="get-parameter">
  +        <xsl:with-param name="parname"  select="$parname"/>
  +        <xsl:with-param name="default"  select="$default"/>
  +        <xsl:with-param name="required" select="$required"/>
  +      </xsl:call-template>
  +    </xsl:variable>
   
  -      <xsl:variable name="result">
  -        <xsl:call-template name="get-parameter">
  -          <xsl:with-param name="parname"  select="$parname"/>
  -          <xsl:with-param name="default"  select="$default"/>
  -          <xsl:with-param name="required" select="$required"/>
  +    <xsl:choose>
  +      <xsl:when test="$result=$default">
  +        <xsl:value-of select="$default"/>
  +      </xsl:when>
  +      <xsl:otherwise>
  +        "<xsl:value-of select="$result"/>"
  +      </xsl:otherwise>
  +    </xsl:choose>
  +  </xsl:template>
  +
  +  <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($prefix, ':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: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:choose>
  -    </xsl:template>
  -
  -    <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($prefix, ':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: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>
  -            <xsl:otherwise><xsl:copy-of select="$default"/></xsl:otherwise>
  -          </xsl:choose>
  -        </xsl:otherwise>
  -      </xsl:choose>
  -    </xsl:template>
  +      </xsl:when>
  +      <xsl:otherwise>
  +        <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>
  +          <xsl:otherwise><xsl:copy-of select="$default"/></xsl:otherwise>
  +        </xsl:choose>
  +      </xsl:otherwise>
  +    </xsl:choose>
  +  </xsl:template>
   
     <xsl:template name="get-nested-content">
       <xsl:param name="content"/>
  
  
  

Mime
View raw message