You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by vg...@apache.org on 2004/06/16 22:00:10 UTC

cvs commit: cocoon-2.1/tools/jetty/conf webdefaults.xml

vgritsenko    2004/06/16 13:00:10

  Modified:    .        status.xml
               src/java/org/apache/cocoon/util NetUtils.java
               src/java/org/apache/cocoon/components/modules/input
                        FlowAttributeModule.java SystemPropertyModule.java
                        URLDecodeModule.java URLEncodeModule.java
                        XMLFileModule.java
               src/webapp/WEB-INF cocoon.xconf web.xml
               src/webapp/samples/modules menu.xml properties.xml
                        sitemap.xmap
               tools/jetty/conf webdefaults.xml
  Added:       src/java/org/apache/cocoon/components/modules/input
                        NamingInputModule.java
               src/webapp/samples/modules menu2content.xsl
                        menu2navigation.xsl
  Removed:     src/webapp/samples/modules index.xhtml menu2html.xsl
  Log:
  Fix JDK1.3 compilation error with URL encode/decode methods.
  Add Naming input module to access JNDI resources.
  Add samples for URL encode/decode and naming modules.
  Removed index.xhtml from samples/modules/, generate it from menu.xml.
  
  Revision  Changes    Path
  1.367     +4 -1      cocoon-2.1/status.xml
  
  Index: status.xml
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/status.xml,v
  retrieving revision 1.366
  retrieving revision 1.367
  diff -u -r1.366 -r1.367
  --- status.xml	16 Jun 2004 14:32:32 -0000	1.366
  +++ status.xml	16 Jun 2004 20:00:07 -0000	1.367
  @@ -204,6 +204,9 @@
   
     <changes>
    <release version="@version@" date="@date@">
  +   <action dev="VG" type="add">
  +     NamingInputModule provides access to the JNDI context.
  +   </action>
      <action dev="AG" type="update">
        Updated quartz to 1.4
      </action>
  
  
  
  1.16      +84 -23    cocoon-2.1/src/java/org/apache/cocoon/util/NetUtils.java
  
  Index: NetUtils.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/util/NetUtils.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- NetUtils.java	1 May 2004 17:04:10 -0000	1.15
  +++ NetUtils.java	16 Jun 2004 20:00:07 -0000	1.16
  @@ -1,12 +1,12 @@
   /*
    * Copyright 1999-2004 The Apache Software Foundation.
  - * 
  + *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
    * You may obtain a copy of the License at
  - * 
  + *
    *      http://www.apache.org/licenses/LICENSE-2.0
  - * 
  + *
    * Unless required by applicable law or agreed to in writing, software
    * distributed under the License is distributed on an "AS IS" BASIS,
    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  @@ -15,10 +15,18 @@
    */
   package org.apache.cocoon.util;
   
  +import org.apache.cocoon.environment.Request;
  +import org.apache.commons.lang.StringUtils;
  +import org.apache.excalibur.source.SourceParameters;
  +
   import java.io.ByteArrayOutputStream;
   import java.io.IOException;
   import java.io.OutputStreamWriter;
   import java.io.UnsupportedEncodingException;
  +import java.lang.reflect.InvocationTargetException;
  +import java.lang.reflect.Method;
  +import java.net.URLDecoder;
  +import java.net.URLEncoder;
   import java.util.BitSet;
   import java.util.Enumeration;
   import java.util.Iterator;
  @@ -26,10 +34,6 @@
   import java.util.Map;
   import java.util.StringTokenizer;
   
  -import org.apache.cocoon.environment.Request;
  -import org.apache.commons.lang.StringUtils;
  -import org.apache.excalibur.source.SourceParameters;
  -
   /**
    * A collection of <code>File</code>, <code>URL</code> and filename
    * utility methods
  @@ -37,7 +41,6 @@
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
    * @version CVS $Id$
    */
  -
   public class NetUtils {
   
       /**
  @@ -45,10 +48,9 @@
        */
       private static BitSet safeCharacters;
   
  -
       private static final char[] hexadecimal =
  -    {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
  -     'A', 'B', 'C', 'D', 'E', 'F'};
  +            {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
  +             'A', 'B', 'C', 'D', 'E', 'F'};
   
       static {
           safeCharacters = new BitSet(256);
  @@ -117,12 +119,14 @@
                               byte x = (byte)Integer.parseInt(path.substring(i + 1, i + 3), 16);
                               encodedchars[encodedcharsLength] = x;
                           } catch (NumberFormatException e) {
  -                            throw new IllegalArgumentException("NetUtils.decodePath: illegal hex characters in pattern %" + path.substring(i + 1, i + 3));
  +                            throw new IllegalArgumentException("NetUtils.decodePath: " +
  +                                                               "Illegal hex characters in pattern %" + path.substring(i + 1, i + 3));
                           }
                           encodedcharsLength++;
                           i += 3;
                       } else {
  -                        throw new IllegalArgumentException("NetUtils.decodePath: % character should be followed by 2 hexadecimal characters.");
  +                        throw new IllegalArgumentException("NetUtils.decodePath: " +
  +                                                           "% character should be followed by 2 hexadecimal characters.");
                       }
                   }
                   try {
  @@ -267,12 +271,12 @@
           }
   
           boolean slash = (path.charAt(path.length() - 1) == '/');
  -        
  +
           StringBuffer b = new StringBuffer();
           b.append(path);
           if (!slash) {
               b.append('/');
  -        } 
  +        }
           b.append(resource);
           return b.toString();
       }
  @@ -366,7 +370,7 @@
        * Remove parameters from a uri.
        * Resulting Map will have either String for single value attributes,
        * or String arrays for multivalue attributes.
  -     * 
  +     *
        * @param uri The uri path to deparameterize.
        * @param parameters The map that collects parameters.
        * @return The cleaned uri
  @@ -406,7 +410,7 @@
        * Add parameters stored in the Map to the uri string.
        * Map can contain Object values which will be converted to the string,
        * or Object arrays, which will be treated as multivalue attributes.
  -     * 
  +     *
        * @param uri The uri to add parameters into
        * @param parameters The map containing parameters to be added
        * @return The uri with added parameters
  @@ -415,14 +419,14 @@
           if (parameters.size() == 0) {
               return uri;
           }
  -        
  +
           StringBuffer buffer = new StringBuffer(uri);
           if (uri.indexOf('?') == -1) {
               buffer.append('?');
           } else {
               buffer.append('&');
           }
  -        
  +
           for (Iterator i = parameters.entrySet().iterator(); i.hasNext();) {
               Map.Entry entry = (Map.Entry)i.next();
               if (entry.getValue().getClass().isArray()) {
  @@ -474,10 +478,67 @@
        * Remove any authorisation details from a URI
        */
       public static String removeAuthorisation(String uri) {
  -        if (uri.indexOf("@")!=-1 && (uri.startsWith("ftp://") || uri.startsWith("http://"))) {
  -            return uri.substring(0, uri.indexOf(":")+2)+uri.substring(uri.indexOf("@")+1);
  -        } 
  +        if (uri.indexOf("@") != -1 && (uri.startsWith("ftp://") || uri.startsWith("http://"))) {
  +            return uri.substring(0, uri.indexOf(":") + 2) + uri.substring(uri.indexOf("@") + 1);
  +        }
   
           return uri;
  +    }
  +
  +
  +    // FIXME Remove when JDK1.3 support is removed.
  +    private static Method urlEncode;
  +    private static Method urlDecode;
  +
  +    static {
  +        try {
  +            urlEncode = URLEncoder.class.getMethod("encode", new Class[]{String.class, String.class});
  +            urlDecode = URLDecoder.class.getMethod("decode", new Class[]{String.class, String.class});
  +        } catch (NoSuchMethodException e) {
  +            urlEncode = null;
  +            urlDecode = null;
  +        }
  +    }
  +
  +    /**
  +     * Pass through to the {@link java.net.URLEncoder}. If running under JDK &lt; 1.4,
  +     * default encoding will always be used.
  +     */
  +    public static String encode(String s, String enc) throws UnsupportedEncodingException {
  +        if (urlEncode != null) {
  +            try {
  +                return (String)urlEncode.invoke(s, new Object[]{ s, enc } );
  +            } catch (IllegalAccessException e) {
  +            } catch (InvocationTargetException e) {
  +                if (e.getTargetException() instanceof UnsupportedEncodingException) {
  +                    throw (UnsupportedEncodingException)e.getTargetException();
  +                } else if (e.getTargetException() instanceof RuntimeException) {
  +                    throw (RuntimeException)e.getTargetException();
  +                }
  +            }
  +        }
  +
  +        return URLEncoder.encode(s);
  +    }
  +
  +    /**
  +     * Pass through to the {@link java.net.URLDecoder}. If running under JDK &lt; 1.4,
  +     * default encoding will always be used.
  +     */
  +    public static String decode(String s, String enc) throws UnsupportedEncodingException {
  +        if (urlDecode != null) {
  +            try {
  +                return (String)urlDecode.invoke(s, new Object[]{ s, enc } );
  +            } catch (IllegalAccessException e) {
  +            } catch (InvocationTargetException e) {
  +                if (e.getTargetException() instanceof UnsupportedEncodingException) {
  +                    throw (UnsupportedEncodingException)e.getTargetException();
  +                } else if (e.getTargetException() instanceof RuntimeException) {
  +                    throw (RuntimeException)e.getTargetException();
  +                }
  +            }
  +        }
  +
  +        return URLDecoder.decode(s);
       }
   }
  
  
  
  1.2       +4 -5      cocoon-2.1/src/java/org/apache/cocoon/components/modules/input/FlowAttributeModule.java
  
  Index: FlowAttributeModule.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/modules/input/FlowAttributeModule.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FlowAttributeModule.java	4 Apr 2004 09:43:43 -0000	1.1
  +++ FlowAttributeModule.java	16 Jun 2004 20:00:07 -0000	1.2
  @@ -1,19 +1,18 @@
   /*
    * Copyright 1999-2004 The Apache Software Foundation.
  - * 
  + *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
    * You may obtain a copy of the License at
  - * 
  + *
    *      http://www.apache.org/licenses/LICENSE-2.0
  - * 
  + *
    * Unless required by applicable law or agreed to in writing, software
    * distributed under the License is distributed on an "AS IS" BASIS,
    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    * See the License for the specific language governing permissions and
    * limitations under the License.
    */
  -
   package org.apache.cocoon.components.modules.input;
   
   import org.apache.avalon.framework.configuration.Configuration;
  
  
  
  1.5       +15 -15    cocoon-2.1/src/java/org/apache/cocoon/components/modules/input/SystemPropertyModule.java
  
  Index: SystemPropertyModule.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/modules/input/SystemPropertyModule.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SystemPropertyModule.java	6 Mar 2004 02:26:17 -0000	1.4
  +++ SystemPropertyModule.java	16 Jun 2004 20:00:07 -0000	1.5
  @@ -1,18 +1,18 @@
   /*
  -* Copyright 1999-2004 The Apache Software Foundation
  -*
  -* Licensed under the Apache License, Version 2.0 (the "License");
  -* you may not use this file except in compliance with the License.
  -* You may obtain a copy of the License at
  -*
  -*     http://www.apache.org/licenses/LICENSE-2.0
  -*
  -* Unless required by applicable law or agreed to in writing, software
  -* distributed under the License is distributed on an "AS IS" BASIS,
  -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  -* See the License for the specific language governing permissions and
  -* limitations under the License.
  -*/
  + * Copyright 1999-2004 The Apache Software Foundation
  + *
  + * Licensed under the Apache License, Version 2.0 (the "License");
  + * you may not use this file except in compliance with the License.
  + * You may obtain a copy of the License at
  + *
  + *     http://www.apache.org/licenses/LICENSE-2.0
  + *
  + * Unless required by applicable law or agreed to in writing, software
  + * distributed under the License is distributed on an "AS IS" BASIS,
  + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  + * See the License for the specific language governing permissions and
  + * limitations under the License.
  + */
   package org.apache.cocoon.components.modules.input;
   
   import org.apache.avalon.framework.configuration.Configuration;
  
  
  
  1.2       +17 -18    cocoon-2.1/src/java/org/apache/cocoon/components/modules/input/URLDecodeModule.java
  
  Index: URLDecodeModule.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/modules/input/URLDecodeModule.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- URLDecodeModule.java	8 Jun 2004 21:34:05 -0000	1.1
  +++ URLDecodeModule.java	16 Jun 2004 20:00:07 -0000	1.2
  @@ -1,12 +1,12 @@
   /*
    * Copyright 1999-2004 The Apache Software Foundation.
  - * 
  + *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
    * You may obtain a copy of the License at
  - * 
  + *
    *      http://www.apache.org/licenses/LICENSE-2.0
  - * 
  + *
    * Unless required by applicable law or agreed to in writing, software
    * distributed under the License is distributed on an "AS IS" BASIS,
    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  @@ -23,32 +23,31 @@
   import org.apache.avalon.framework.configuration.ConfigurationException;
   import org.apache.avalon.framework.thread.ThreadSafe;
   import org.apache.cocoon.components.modules.input.AbstractInputModule;
  +import org.apache.cocoon.util.NetUtils;
   
   /**
    * This module provides functionality for converting a String from the
    * application/x-www-form-urlencoded MIME format. It is useful for example for
    * calling remote services: <br/>
    * &lt;map:generate src="http://remote/page?param1={url-encode:{request-param:param1}}"/&gt;<br/>
  - * Module configuration takes only one configuration parameter: 
  + * Module configuration takes only one configuration parameter:
    * "encoding" which is a target string encoding. This is utf-8 by default.
    */
  -public final class URLDecodeModule 
  -    extends AbstractInputModule 
  -    implements ThreadSafe {
  +public final class URLDecodeModule extends AbstractInputModule
  +                                   implements ThreadSafe {
   
  -    public Object getAttribute( String name,
  -                                Configuration modeConf,
  -                                Map objectModel ) throws ConfigurationException {
  -        if ( name == null )
  +    public Object getAttribute(String name,
  +                               Configuration modeConf,
  +                               Map objectModel) throws ConfigurationException {
  +        if (name == null) {
               return null;
  +        }
   
  -        String encoding = (String) this.settings.get(   "encoding",
  -                                                        "utf-8" );
  +        String encoding = (String) this.settings.get("encoding", "utf-8");
           try {
  -            return URLDecoder.decode(   name,
  -                                        encoding );
  -        } catch ( UnsupportedEncodingException e ) {
  -            throw new ConfigurationException( "URLDecodeModule, invalid encoding: " + encoding );
  +            return NetUtils.decode(name, encoding);
  +        } catch (UnsupportedEncodingException e) {
  +            throw new ConfigurationException("URLDecodeModule, invalid encoding: " + encoding);
           }
       }
  -}
  \ No newline at end of file
  +}
  
  
  
  1.2       +17 -18    cocoon-2.1/src/java/org/apache/cocoon/components/modules/input/URLEncodeModule.java
  
  Index: URLEncodeModule.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/modules/input/URLEncodeModule.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- URLEncodeModule.java	8 Jun 2004 21:34:05 -0000	1.1
  +++ URLEncodeModule.java	16 Jun 2004 20:00:07 -0000	1.2
  @@ -1,12 +1,12 @@
   /*
    * Copyright 1999-2004 The Apache Software Foundation.
  - * 
  + *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
    * You may obtain a copy of the License at
  - * 
  + *
    *      http://www.apache.org/licenses/LICENSE-2.0
  - * 
  + *
    * Unless required by applicable law or agreed to in writing, software
    * distributed under the License is distributed on an "AS IS" BASIS,
    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  @@ -23,32 +23,31 @@
   import org.apache.avalon.framework.configuration.ConfigurationException;
   import org.apache.avalon.framework.thread.ThreadSafe;
   import org.apache.cocoon.components.modules.input.AbstractInputModule;
  +import org.apache.cocoon.util.NetUtils;
   
   /**
    * This module provides functionality for converting a String to the
    * application/x-www-form-urlencoded MIME format. It is useful for example for
    * calling remote services: <br/>
    * &lt;map:generate src="http://remote/page?param1={url-encode:{request-param:param1}}"/&gt;<br/>
  - * Module configuration takes only one configuration parameter: 
  + * Module configuration takes only one configuration parameter:
    * "encoding" which is a target string encoding. This is utf-8 by default.
    */
  -public final class URLEncodeModule 
  -    extends AbstractInputModule 
  -    implements ThreadSafe {
  +public final class URLEncodeModule extends AbstractInputModule
  +                                   implements ThreadSafe {
   
  -    public Object getAttribute( String name,
  -                                Configuration modeConf,
  -                                Map objectModel ) throws ConfigurationException {
  -        if ( name == null )
  +    public Object getAttribute(String name,
  +                               Configuration modeConf,
  +                               Map objectModel) throws ConfigurationException {
  +        if (name == null) {
               return null;
  +        }
   
  -        String encoding = (String) this.settings.get(   "encoding",
  -                                                        "utf-8" );
  +        String encoding = (String) this.settings.get("encoding", "utf-8");
           try {
  -            return URLEncoder.encode(   name,
  -                                        encoding );
  -        } catch ( UnsupportedEncodingException e ) {
  -            throw new ConfigurationException( "URLEncodeModule, invalid encoding: " + encoding );
  +            return NetUtils.encode(name, encoding);
  +        } catch (UnsupportedEncodingException e) {
  +            throw new ConfigurationException("URLEncodeModule, invalid encoding: " + encoding);
           }
       }
  -}
  \ No newline at end of file
  +}
  
  
  
  1.18      +1 -2      cocoon-2.1/src/java/org/apache/cocoon/components/modules/input/XMLFileModule.java
  
  Index: XMLFileModule.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/modules/input/XMLFileModule.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- XMLFileModule.java	16 Jun 2004 14:57:54 -0000	1.17
  +++ XMLFileModule.java	16 Jun 2004 20:00:07 -0000	1.18
  @@ -13,7 +13,6 @@
    * See the License for the specific language governing permissions and
    * limitations under the License.
    */
  -
   package org.apache.cocoon.components.modules.input;
   
   import org.apache.avalon.framework.component.ComponentException;
  
  
  
  1.1                  cocoon-2.1/src/java/org/apache/cocoon/components/modules/input/NamingInputModule.java
  
  Index: NamingInputModule.java
  ===================================================================
  /*
   * Copyright 1999-2004 The Apache Software Foundation.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  package org.apache.cocoon.components.modules.input;
  
  import org.apache.avalon.framework.configuration.Configuration;
  import org.apache.avalon.framework.configuration.ConfigurationException;
  import org.apache.avalon.framework.thread.ThreadSafe;
  import org.apache.avalon.framework.activity.Initializable;
  import org.apache.cocoon.components.modules.input.AbstractInputModule;
  
  import javax.naming.InitialContext;
  import javax.naming.NamingException;
  import java.util.Collections;
  import java.util.Iterator;
  import java.util.Map;
  import java.util.Properties;
  
  /**
   * NamingInputModule accesses values stored in the JNDI context.
   *
   * <p>This module accept any configuration parameters and passes them as
   * properties to the InitialContext. When connecting to the Naming context
   * of the server Cocoon is running in, no parameters are required.</p>
   *
   * <p>Example module configuration when connecting to external WebLogic server:
   * <pre>
   *   &lt;java.naming.factory.initial&gt;weblogic.jndi.WLInitialContextFactory&lt;/java.naming.factory.initial&gt;
   *   &lt;java.naming.provider.url&gt;t3://localhost:7001&lt;/java.naming.provider.url&gt;
   * </pre>
   *
   * <p>Example usage:
   * <pre>
   *   &lt;map:generate src="{naming:java:comp/env/url}"/&gt;
   * </pre>
   * This lookups <code>env/url</code> entry from the environment of the webapp.
   *
   * @author <a href="mailto:vgritsenko@apache.org">Vadim Gritsenko</a>
   * @version CVS $Id: NamingInputModule.java,v 1.1 2004/06/16 20:00:07 vgritsenko Exp $
   */
  public class NamingInputModule extends AbstractInputModule implements ThreadSafe, Initializable {
  
      /**
       * Initial context properties.
       */
      private Properties properties;
  
      /**
       * Initial context.
       */
      private InitialContext context;
  
      /**
       * Fill in InitialContext properties from passed configuration.
       */
      public void configure(Configuration conf) throws ConfigurationException {
          Configuration[] parameters = conf.getChildren();
          this.properties = new Properties();
          for (int i = 0; i < parameters.length; i++) {
              String key = parameters[i].getName();
              String val = parameters[i].getValue("");
              this.properties.put(key, val);
          }
      }
  
      /**
       * Creates InitialContext with configured properties.
       */
      public void initialize() throws Exception {
          this.context = new InitialContext(this.properties);
      }
  
      /**
       * Close InitialContext.
       */
      public void dispose() {
          super.dispose();
          if (this.context != null) {
              try {
                  this.context.close();
              } catch (NamingException ignored) {
              }
          }
      }
  
      /**
       * Look up <code>name</code> from the InitialContext.
       */
      public Object getAttribute(String name, Configuration modeConf, Map objectModel)
      throws ConfigurationException {
  
          // Why properties can override passed name parameter? See RequestParameterModule
          String pname = (String) this.properties.get("path");
          if (pname == null) {
              pname = name;
          }
  
          if (modeConf != null) {
              pname = modeConf.getAttribute("path", pname);
              // preferred
              pname = modeConf.getChild("path").getValue(pname);
          }
  
          try {
              return this.context.lookup(pname);
          } catch (NamingException e) {
              if (getLogger().isDebugEnabled()) {
                  getLogger().debug("Can't get parameter " + pname, e);
              }
              return null;
          }
      }
  
      /**
       * Returns empty iterator
       */
      public Iterator getAttributeNames(Configuration modeConf, Map objectModel)
      throws ConfigurationException {
  
          return Collections.EMPTY_LIST.iterator();
      }
  }
  
  
  
  1.51      +14 -12    cocoon-2.1/src/webapp/WEB-INF/cocoon.xconf
  
  Index: cocoon.xconf
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/webapp/WEB-INF/cocoon.xconf,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- cocoon.xconf	16 Jun 2004 14:44:56 -0000	1.50
  +++ cocoon.xconf	16 Jun 2004 20:00:07 -0000	1.51
  @@ -146,10 +146,10 @@
         +-->
     <input-modules>
       <component-instance logger="core.modules.input" name="url-encode"       class="org.apache.cocoon.components.modules.input.URLEncodeModule">
  -        <encoding>UTF-8</encoding>
  +      <encoding>UTF-8</encoding>
       </component-instance>
       <component-instance logger="core.modules.input" name="url-decode"       class="org.apache.cocoon.components.modules.input.URLDecodeModule">
  -        <encoding>UTF-8</encoding>
  +      <encoding>UTF-8</encoding>
       </component-instance>
       <component-instance logger="core.modules.input" name="global"           class="org.apache.cocoon.components.modules.input.GlobalInputModule"/>
       <component-instance logger="core.modules.input" name="request"          class="org.apache.cocoon.components.modules.input.RequestModule"/>
  @@ -170,22 +170,28 @@
       </component-instance>
       <component-instance logger="core.modules.input" name="nullinput"    class="org.apache.cocoon.components.modules.input.NullInputModule"/>
       <component-instance logger="core.modules.input" name="realpath"     class="org.apache.cocoon.components.modules.input.RealPathModule"/> 
  +    <component-instance logger="core.modules.input" name="naming"       class="org.apache.cocoon.components.modules.input.NamingInputModule">
  +    </component-instance>
  +    <component-instance logger="core.modules.input" name="cocoon-properties" class="org.apache.cocoon.components.modules.input.PropertiesFileModule">
  +      <file src="resource://org/apache/cocoon/cocoon.properties" />
  +    </component-instance>
  +    <component-instance logger="core.modules.input" name="flow-attribute"     class="org.apache.cocoon.components.modules.input.FlowAttributeModule"/>
  +    <component-instance logger="core.modules.input" name="flow-continuation"  class="org.apache.cocoon.components.modules.input.FlowContinuationModule"/>
  +
       <component-instance logger="core.modules.input" name="xmlmeta"      class="org.apache.cocoon.components.modules.input.XMLMetaModule"/>
       <component-instance logger="core.modules.input" name="mapmeta"      class="org.apache.cocoon.components.modules.input.MapMetaModule"/>
       <component-instance logger="core.modules.input" name="datemeta"     class="org.apache.cocoon.components.modules.input.DateMetaInputModule"/>
       <component-instance logger="core.modules.input" name="jxpath"       class="org.apache.cocoon.components.modules.input.JXPathMetaModule"/>
       <component-instance logger="core.modules.input" name="simplemap"    class="org.apache.cocoon.components.modules.input.SimpleMappingMetaModule"/>
       <component-instance logger="core.modules.input" name="locate"       class="org.apache.cocoon.components.modules.input.LocateResource"/>
  -    <component-instance logger="core.modules.input" name="chain"    class="org.apache.cocoon.components.modules.input.ChainMetaModule">
  +    <component-instance logger="core.modules.input" name="chain"        class="org.apache.cocoon.components.modules.input.ChainMetaModule">
         <input-module name="request-param"/>
         <input-module name="request-attr"/>
         <input-module name="session-attr"/>
         <input-module name="defaults"/>
       </component-instance>
  -    <component-instance class="org.apache.cocoon.components.modules.input.PropertiesFileModule" logger="core.modules.input" name="cocoon-properties">
  -      <file src="resource://org/apache/cocoon/cocoon.properties" />
  -    </component-instance>
  -    
  +
  +
       <!-- The 'defaults', 'myxml' and 'slashdot' input modules are used
            in the samples -->
       <component-instance logger="core.modules.input" name="defaults"     class="org.apache.cocoon.components.modules.input.DefaultsModule">
  @@ -194,16 +200,12 @@
           <base-url>http://localhost:8080/cocoon</base-url>
         </values>
       </component-instance>
  -
       <component-instance class="org.apache.cocoon.components.modules.input.XMLFileModule" logger="core.modules.xml" name="myxml">
  -      <file src="context:///samples/modules/forrestconf.xml"/>
  +      <file src="context://samples/modules/forrestconf.xml"/>
       </component-instance>
       <component-instance class="org.apache.cocoon.components.modules.input.XMLFileModule" logger="core.modules.xml" name="slashdot">
         <file src="http://slashdot.org/slashdot.rss"/>
       </component-instance>
  -
  -    <component-instance logger="core.modules.input" name="flow-attribute"     class="org.apache.cocoon.components.modules.input.FlowAttributeModule"/>
  -    <component-instance logger="core.modules.input" name="flow-continuation"  class="org.apache.cocoon.components.modules.input.FlowContinuationModule"/>
   
     </input-modules>
   
  
  
  
  1.17      +8 -1      cocoon-2.1/src/webapp/WEB-INF/web.xml
  
  Index: web.xml
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/webapp/WEB-INF/web.xml,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- web.xml	11 Jun 2004 20:29:29 -0000	1.16
  +++ web.xml	16 Jun 2004 20:00:07 -0000	1.17
  @@ -432,5 +432,12 @@
       <mime-type>text/plain</mime-type>
     </mime-mapping>
   
  -</web-app>
   
  +  <!-- Sample environment entry for the NamingInputModule -->
  +  <env-entry>
  +    <env-entry-name>greeting</env-entry-name>
  +    <env-entry-value>Hello, World</env-entry-value>
  +    <env-entry-type>java.lang.String</env-entry-type>
  +  </env-entry>
  +
  +</web-app>
  
  
  
  1.12      +17 -17    cocoon-2.1/src/webapp/samples/modules/menu.xml
  
  Index: menu.xml
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/webapp/samples/modules/menu.xml,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- menu.xml	10 Mar 2004 13:36:09 -0000	1.11
  +++ menu.xml	16 Jun 2004 20:00:07 -0000	1.12
  @@ -14,12 +14,10 @@
     See the License for the specific language governing permissions and
     limitations under the License.
   -->
  -<!--DOCTYPE book PUBLIC "-//APACHE//DTD Cocoon Documentation Book V1.0//EN" "dtd/book-cocoon-v10.dtd" -->
   
   <book software="Apache Cocoon" 
         title="Apache Cocoon Input Modules Samples" 
  -      copyright="@year@ The Apache Software Foundation"
  ->
  +      copyright="@year@ The Apache Software Foundation">
   
     <menu label="Overview">
       <menu-item label="Index" href="index.html"/>
  @@ -27,19 +25,22 @@
     </menu>  
    
     <menu label="Modules">
  -    <menu-item label="RequestModule" href="request.html"/>
  -    <menu-item label="BaseLinkModule" href="baselink.html"/>
  -    <menu-item label="RequestParameterModule" href="requestparam.html"/>
  -    <menu-item label="DateInputModule" href="date.html"/>
  -    <menu-item label="DefaultsModule" href="defaults.html"/>
  -    <menu-item label="SessionModule" href="session.html"/>
  -    <menu-item label="SessionAttributeModule" href="session-attr.html"/>
  -    <menu-item label="SystemPropertyModule" href="system-property.html"/>
  -    <menu-item label="XMLFileModule" href="xml.html"/>
  -    <menu-item label="ChainMetaModule" href="chain.html"/>
  -    <menu-item label="RandomNumberModule" href="randomnumber.html"/>
  -    <menu-item label="RealPathModule" href="realpath.html"/>
  -    <menu-item label="PropertiesFileModule" href="properties.html"/>
  +    <menu-item label="RequestModule" href="request.html" desc="Request object properties"/>
  +    <menu-item label="BaseLinkModule" href="baselink.html" desc="BaseLink properties"/>
  +    <menu-item label="RequestParameterModule" href="requestparam.html" desc="Request parameters"/>
  +    <menu-item label="DateInputModule" href="date.html" desc="Date"/>
  +    <menu-item label="DefaultsModule" href="defaults.html" desc="Default (static) values"/>
  +    <menu-item label="SessionModule" href="session.html" desc="Session object properties"/>
  +    <menu-item label="SessionAttributeModule" href="session-attr.html" desc="Session attributes"/>
  +    <menu-item label="SystemPropertyModule" href="system-property.html" desc="System properties (environment variables)"/>
  +    <menu-item label="XMLFileModule" href="xml.html" desc="XML node values"/>
  +    <menu-item label="ChainMetaModule" href="chain.html" desc="Chained values"/>
  +    <menu-item label="RandomNumberModule" href="randomnumber.html" desc="Random number"/>
  +    <menu-item label="RealPathModule" href="realpath.html" desc="Real filesystem paths of context paths"/>
  +    <menu-item label="PropertiesFileModule" href="properties.html" desc="Properties file values"/>
  +    <menu-item label="URLEncodeModule" href="url-encode.html" desc="URLEncode passed parameter"/>
  +    <menu-item label="URLDecodeModule" href="url-decode.html" desc="URLDecode passed parameter"/>
  +    <menu-item label="NamingInputModule" href="naming.html" desc="JNDI Resources. This sample does not work with built-in Jetty as it does not provide JNDI."/>
     </menu>
   
     <menu label="Documentation">
  @@ -52,5 +53,4 @@
       <menu-item label="Konstantin Piroumian" href="mailto:kpiroumian@apache.org"/>  
       <menu-item label="Many others..." href="/docs/who.html"/>      
     </menu>  
  -   
   </book>
  
  
  
  1.3       +6 -1      cocoon-2.1/src/webapp/samples/modules/properties.xml
  
  Index: properties.xml
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/webapp/samples/modules/properties.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- properties.xml	5 Apr 2004 12:34:23 -0000	1.2
  +++ properties.xml	16 Jun 2004 20:00:07 -0000	1.3
  @@ -14,7 +14,12 @@
     See the License for the specific language governing permissions and
     limitations under the License.
   -->
  -<!-- $Id$ -->
  +
  +<!--+
  +    | Prints out all passed parameters.
  +    |
  +    | $Id$
  +    +-->
   <properties xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
     <jx:forEach var="name" items="${parameters.names}">
       <property>
  
  
  
  1.12      +83 -44    cocoon-2.1/src/webapp/samples/modules/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/webapp/samples/modules/sitemap.xmap,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- sitemap.xmap	7 May 2004 09:52:26 -0000	1.11
  +++ sitemap.xmap	16 Jun 2004 20:00:07 -0000	1.12
  @@ -14,12 +14,13 @@
     See the License for the specific language governing permissions and
     limitations under the License.
   -->
  -<!-- $Id$ -->
  -<!--
  -Input Modules sample sitemap.
   
  -Author: Konstantin Piroumian "kpiroumian@apache.org" 
  --->
  +<!--+
  +    | Input Modules sample sitemap.
  +    | Author: Konstantin Piroumian "kpiroumian@apache.org"
  +    |
  +    | $Id$
  +    +-->
   <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
   
     <!-- =========================== Resources =============================== -->
  @@ -27,11 +28,11 @@
       <!-- This resource is used to create a composite page from menu and content -->
       <map:resource name="composite">
         <map:aggregate element="site">
  -        <map:part src="cocoon:/menu/{../1}.xml"/>
  +        <map:part src="cocoon:/menu/{../1}.html"/>
           <map:part src="cocoon:/content/{../1}.xml" label="content"/>
         </map:aggregate>
         <map:transform src="site2html.xsl">
  -        <map:parameter name="page" value="{../0}" />
  +        <map:parameter name="page" value="{../0}"/>
         </map:transform>
         <map:serialize/>
       </map:resource>
  @@ -43,17 +44,29 @@
   
         <!-- Default URL matcher. Matches '/' URLs-->
         <map:match pattern="">
  -        <map:redirect-to uri="index.html" />
  +        <map:redirect-to uri="index.html"/>
         </map:match>
   
         <map:match pattern="*.html">
  -        <map:call resource="composite" />
  -      </map:match>                
  +        <map:call resource="composite"/>
  +      </map:match>
   
  +      <!-- Index page content -->
         <map:match pattern="content/index.xml">
  -        <map:generate src="index.xhtml"/>
  +        <map:generate src="menu.xml"/>
  +        <map:transform src="menu2content.xsl"/>
           <map:serialize/>
  -      </map:match>                            
  +      </map:match>
  +
  +      <!-- Menu -->
  +      <map:match pattern="menu/*">
  +        <map:generate src="menu.xml"/>
  +        <map:transform src="menu2navigation.xsl">
  +          <map:parameter name="page" value="{1}"/>
  +        </map:transform>
  +        <map:serialize/>
  +      </map:match>
  +
   
         <map:match pattern="content/request.xml">
           <map:generate type="jx" src="properties.xml">
  @@ -96,7 +109,7 @@
           <map:transform src="properties2html.xsl">
             <map:parameter name="title" value="Request Input Module (RequestModule)"/>
           </map:transform>
  -        <map:serialize />
  +        <map:serialize/>
         </map:match>
   
         <map:match pattern="content/baselink.xml">
  @@ -113,8 +126,8 @@
               In this demonstration, the request URI is {0} (an internal request not
               equivalent to what the user sees)"/>
           </map:transform>
  -        <map:serialize />
  -      </map:match>               
  +        <map:serialize/>
  +      </map:match>
   
         <map:match pattern="requestparam">
           <map:redirect-to uri="content/requestparam.xml?foo=foo+param&amp;bar=bar+param"/>
  @@ -130,7 +143,7 @@
               parameters. Edit the URL of this page to see the request parameter
               values change (parts after the '?' are request parameters) ."/>
           </map:transform>
  -        <map:serialize />
  +        <map:serialize/>
         </map:match>
   
         <map:match pattern="content/session.xml">
  @@ -147,8 +160,8 @@
             <map:parameter name="description" value="SessionModule provides access
               to Session object properties."/>
           </map:transform>
  -        <map:serialize />
  -      </map:match>               
  +        <map:serialize/>
  +      </map:match>
   
         <map:match pattern="content/system-property.xml">
           <map:generate type="jx" src="properties.xml">
  @@ -183,9 +196,8 @@
           <map:transform src="properties2html.xsl">
             <map:parameter name="title" value="System Properties Input Module (SystemPropertiesModule)"/>
           </map:transform>
  -        <map:serialize />
  -      </map:match>               
  -
  +        <map:serialize/>
  +      </map:match>
   
         <map:match pattern="content/xml.xml">
           <map:generate type="jx" src="properties.xml">
  @@ -197,13 +209,13 @@
             -->
           </map:generate>
           <map:transform src="properties2html.xsl">
  -          <map:parameter name="title" value="XML File Input Module (XMLFileModule)"/>  
  +          <map:parameter name="title" value="XML File Input Module (XMLFileModule)"/>
             <map:parameter name="description" value="XMLFileModule uses an XML
               file as a data source, with XPath expressions as the key values. In
               this example, the keys identify nodes in
  -            context:///samples/modules/forrestconf.xml"/>
  +            context://samples/modules/forrestconf.xml"/>
           </map:transform>
  -        <map:serialize />
  +        <map:serialize/>
         </map:match>
   
         <map:match pattern="content/defaults.xml">
  @@ -217,10 +229,9 @@
               contains 'default' values, hardcoded into cocoon.xconf.
               It is simply a lookup table containing static values."/>
           </map:transform>
  -        <map:serialize />
  +        <map:serialize/>
         </map:match>
   
  -
         <map:match pattern="content/chain.xml">
           <map:generate type="jx" src="properties.xml">
             <map:parameter name="skin" value="{chain:skin}"/>
  @@ -236,10 +247,9 @@
               Try adding '?skin=myskin' to the URL, and it should
               change."/>
           </map:transform>
  -        <map:serialize />
  +        <map:serialize/>
         </map:match>
   
  -
         <map:match pattern="content/date.xml">
           <map:generate type="jx" src="properties.xml">
             <map:parameter name="date" value="{date:date}"/>
  @@ -249,20 +259,20 @@
             <map:parameter name="description" value="Returns the current
               date and time.  The format is specified in cocoon.xconf"/>
           </map:transform>
  -        <map:serialize />
  +        <map:serialize/>
         </map:match>
   
         <map:match pattern="content/session-attr.xml">
           <map:generate type="jx" src="properties.xml">
  -          <map:parameter name="fruit" value="{session-attr:fruit}"/>               
  +          <map:parameter name="fruit" value="{session-attr:fruit}"/>
           </map:generate>
           <map:transform src="properties2html.xsl">
             <map:parameter name="title" value="Session Attribute Input Module
  -            (SessionAttributeModule)"/>  
  +            (SessionAttributeModule)"/>
             <map:parameter name="description" value="SessionAttributeModule provides access
               to Session attributes."/>
           </map:transform>
  -        <map:serialize />
  +        <map:serialize/>
         </map:match>
   
         <map:match pattern="content/randomnumber.xml">
  @@ -274,10 +284,9 @@
             <map:parameter name="description" value="Returns a random number in a
               user-configurable range (by default 0 to 9999999999)"/>
           </map:transform>
  -        <map:serialize />
  +        <map:serialize/>
         </map:match>
   
  -
         <map:match pattern="content/realpath.xml">
           <map:generate type="jx" src="properties.xml">
             <map:parameter name="/" value="{realpath:/}"/>
  @@ -289,8 +298,8 @@
             <map:parameter name="description" value="Returns the real path of a
               context-relative virtual path (if not deployed from a .war)."/>
           </map:transform>
  -        <map:serialize />
  -      </map:match>               
  +        <map:serialize/>
  +      </map:match>
   
         <map:match pattern="content/properties.xml">
           <map:generate type="jx" src="properties.xml">
  @@ -308,24 +317,54 @@
               to properties from a properties file. In this example the keys identify properties in
               resource://org/apache/cocoon/cocoon.properties"/>
           </map:transform>
  -        <map:serialize />
  +        <map:serialize/>
         </map:match>
   
  -      <!-- Menu generation -->
  -      <map:match pattern="menu/*">
  -        <map:generate src="menu.xml"/>
  -        <map:transform src="menu2html.xsl">
  -          <map:parameter name="page" value="{1}" />
  +      <map:match pattern="content/url-encode.xml">
  +        <map:generate type="jx" src="properties.xml">
  +          <map:parameter name="foo bar" value="{url-encode:foo bar}"/>
  +          <map:parameter name="foo/bar" value="{url-encode:foo/bar}"/>
  +        </map:generate>
  +        <map:transform src="properties2html.xsl">
  +          <map:parameter name="title" value="URL Encoding Module (URLEncodeModule)"/>
  +          <map:parameter name="description" value="URLEncodeModule performs
  +            URL encoding of the passed parameter"/>
  +        </map:transform>
  +        <map:serialize/>
  +      </map:match>
  +
  +      <map:match pattern="content/url-decode.xml">
  +        <map:generate type="jx" src="properties.xml">
  +          <map:parameter name="foo%20bar" value="{url-decode:foo%20bar}"/>
  +          <map:parameter name="foo%2Fbar" value="{url-decode:foo%2Fbar}"/>
  +        </map:generate>
  +        <map:transform src="properties2html.xsl">
  +          <map:parameter name="title" value="URL Decoding Module (URLDecodeModule)"/>
  +          <map:parameter name="description" value="URLDecodeModule performs
  +            URL decoding of the passed parameter"/>
           </map:transform>
           <map:serialize/>
         </map:match>
   
  +      <map:match pattern="content/naming.xml">
  +        <map:generate type="jx" src="properties.xml">
  +          <map:parameter name="java:comp/env/greeting" value="{naming:java:comp/env/greeting}"/>
  +        </map:generate>
  +        <map:transform src="properties2html.xsl">
  +          <map:parameter name="title" value="Naming Module (NamingInputModule)"/>
  +          <map:parameter name="description" value="NamingInputModule provides access
  +            to JNDI resources. This sample does not work with built-in Jetty as it does not provide JNDI."/>
  +        </map:transform>
  +        <map:serialize/>
  +      </map:match>
  +
  +
         <!-- Display this sitemap source-->
         <map:match pattern="sitemap.xmap">
           <map:generate src="sitemap.xmap"/>
           <map:transform src="context://stylesheets/system/xml2html.xslt"/>
           <map:serialize/>
  -      </map:match>            
  +      </map:match>
   
         <map:match pattern="*.css">
           <map:read src="{1}.css" mime-type="text/css"/>
  @@ -335,6 +374,6 @@
           <map:read src="images/{1}.gif" mime-type="image/gif"/>
         </map:match>
   
  -    </map:pipeline>                
  +    </map:pipeline>
     </map:pipelines>
   </map:sitemap>
  
  
  
  1.1                  cocoon-2.1/src/webapp/samples/modules/menu2content.xsl
  
  Index: menu2content.xsl
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <!--
    Copyright 1999-2004 The Apache Software Foundation
  
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at
  
        http://www.apache.org/licenses/LICENSE-2.0
  
    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
  -->
  
  <!--+
      | Transforms menu.xml to the index page
      | CVS $Id: menu2content.xsl,v 1.1 2004/06/16 20:00:07 vgritsenko Exp $
      +-->
  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  
    <xsl:template match="book">
      <page>
        <title>Input Modules</title>
        <table>
          <tr>
            <td>
              <h3>Input Modules</h3>
              <p>Modules are used to access input and output data in 
                 modular way. Below there are samples for some of the
                 available input modules.
              </p>
              <table class="table">
                <xsl:apply-templates select="menu/menu-item[@desc]"/>
              </table>
            </td>
          </tr>
        </table>
      </page>
    </xsl:template>
  
    <xsl:template match="menu-item[@desc]">
      <tr>
        <td>
          <a href="{@href}"><xsl:value-of select="@label" /></a>
        </td>
        <td>
          <xsl:value-of select="@desc" />
        </td>
      </tr>
    </xsl:template>
  </xsl:stylesheet>
  
  
  
  1.1                  cocoon-2.1/src/webapp/samples/modules/menu2navigation.xsl
  
  Index: menu2navigation.xsl
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <!--
    Copyright 1999-2004 The Apache Software Foundation
  
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at
  
        http://www.apache.org/licenses/LICENSE-2.0
  
    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
  -->
  
  <!--+
      | Transforms menu.xml to the navigation bar
      | CVS $Id: menu2navigation.xsl,v 1.1 2004/06/16 20:00:07 vgritsenko Exp $
      +-->
  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:param name="page" />
  
    <xsl:template match="book">
      <table class="menu">
        <tr>
          <td>
            <ul><xsl:apply-templates select="menu"/></ul>
          </td>
        </tr>
      </table>
    </xsl:template>
  
    <!-- Process only current book -->
    <xsl:template match="book[@current]">
      <ul><xsl:apply-templates /></ul>
    </xsl:template>
  
    <!-- Current (open) menu -->
    <xsl:template match="menu">
      <li>
        <xsl:if test="@icon">
          <img src="{@icon}" align="middle"/><xsl:text> </xsl:text>
        </xsl:if>
        <span class="chapter open"><xsl:value-of select="@label" /></span>
      </li>
      <ul><xsl:apply-templates /></ul>
    </xsl:template>
  
    <!-- Display a link to a page -->
  
    <xsl:template match="menu-item[@href=$page]">
      <li class="current" title="{@href}">
        <xsl:if test="@icon">
          <img src="{@icon}" align="middle"/><xsl:text> </xsl:text>
        </xsl:if>
        <xsl:value-of select="@label" />
      </li>
    </xsl:template>
  
    <xsl:template match="menu-item | external">
      <li class="page">
        <xsl:if test="@icon">
          <img src="{@icon}" align="middle"/><xsl:text> </xsl:text>
        </xsl:if>
        <a href="{@href}" class="page"><xsl:value-of select="@label" /></a>
      </li>
    </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  1.2       +1 -2      cocoon-2.1/tools/jetty/conf/webdefaults.xml
  
  Index: webdefaults.xml
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/tools/jetty/conf/webdefaults.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- webdefaults.xml	9 Mar 2003 00:11:40 -0000	1.1
  +++ webdefaults.xml	16 Jun 2004 20:00:09 -0000	1.2
  @@ -1,5 +1,5 @@
   <?xml version="1.0" encoding="UTF-8"?>
  -<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">   
  +<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
   
   <!-- ===================================================================== -->
   <web-app>
  @@ -33,4 +33,3 @@
     </session-config>
   
   </web-app>
  -