cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From step...@apache.org
Subject cvs commit: xml-cocoon2/src/scratchpad/webapp/mount/chaperon/stylesheets java2html.xsl mathexp2html.xsl parsefragment.xsl rgrm2grm.xsl wiki2html.xsl
Date Fri, 14 Jun 2002 12:39:41 GMT
stephan     2002/06/14 05:39:41

  Added:       src/scratchpad/lib LICENSE.chaperon chaperon-1.3-dev.jar
               src/scratchpad/src/org/apache/cocoon/generation
                        TextParserGenerator.java
               src/scratchpad/src/org/apache/cocoon/transformation
                        TextFragmentParserTransformer.java
               src/scratchpad/webapp/mount/chaperon sitemap.xmap
               src/scratchpad/webapp/mount/chaperon/grammars java.rgrm
                        mathexp.grm rgrm.grm wiki.grm wiki.rgrm
               src/scratchpad/webapp/mount/chaperon/misc index.html
                        java.css matex.xsp mathexp.xsp test2.java wiki.xsp
               src/scratchpad/webapp/mount/chaperon/stylesheets
                        java2html.xsl mathexp2html.xsl parsefragment.xsl
                        rgrm2grm.xsl wiki2html.xsl
  Log:
  Add the chaperon examples from the bugzilla patch with the id '8975'.
  
  Revision  Changes    Path
  1.1                  xml-cocoon2/src/scratchpad/lib/LICENSE.chaperon
  
  Index: LICENSE.chaperon
  ===================================================================
  /*
   * Chaperon. Apache-Style Software License
   *
   *
   * Copyright (c) 2002 Chaperon. All rights reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by 
   *        Chaperon (http://www.sourceforge.net/projects/chaperon/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The name "Chaperon" must not be used to endorse 
   *    or promote products derived from this software without prior written 
   *    permission.  For written permission, please contact 
   *    stephan@vern.chem.tu-berlin.de.
   *
   * 5. Products derived from this software may not be called "Chaperon",
   *    nor may "Chaperon" appear in their name, without prior written
   *    permission of stephan@vern.chem.tu-berlin.de.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL TOUCHGRAPH OR ITS CONTRIBUTORS BE 
   * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
   * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
   * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 
   * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
   * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 
   * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 
   * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   * ====================================================================
   *
   */
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/lib/chaperon-1.3-dev.jar
  
  	<<Binary file>>
  
  
  1.1                  xml-cocoon2/src/scratchpad/src/org/apache/cocoon/generation/TextParserGenerator.java
  
  Index: TextParserGenerator.java
  ===================================================================
  /*
   *  Copyright (C) Chaperon. All rights reserved.                               
   *  ------------------------------------------------------------------------- 
   *  This software is published under the terms of the Apache Software License 
   *  version 1.1, a copy of which has been included  with this distribution in 
   *  the LICENSE file.                                                         
   */
  
  package org.apache.cocoon.generation;
  
  import org.apache.avalon.excalibur.pool.Recyclable;
  
  import org.apache.avalon.framework.activity.Disposable;
  import org.apache.avalon.framework.component.Component;
  import org.apache.avalon.framework.component.ComponentException;
  import org.apache.avalon.framework.component.ComponentManager;
  import org.apache.avalon.framework.component.Composable;
  import org.apache.avalon.framework.configuration.Configurable;
  import org.apache.avalon.framework.configuration.Configuration;
  import org.apache.avalon.framework.configuration.ConfigurationException;
  import org.apache.avalon.framework.logger.LogEnabled;
  import org.apache.avalon.framework.logger.Logger;
  import org.apache.avalon.framework.parameters.ParameterException;
  import org.apache.avalon.framework.parameters.Parameters;
  
  import org.apache.cocoon.ProcessingException;
  import org.apache.cocoon.components.source.SourceUtil;
  import org.apache.cocoon.caching.CacheableProcessingComponent;
  import org.apache.cocoon.environment.Request;
  import org.apache.cocoon.environment.SourceResolver;
  import org.apache.cocoon.generation.ComposerGenerator;
  import org.apache.cocoon.util.HashUtil;
  
  import org.apache.excalibur.source.Source;
  import org.apache.excalibur.source.SourceException;
  import org.apache.excalibur.source.SourceValidity;
  import org.apache.excalibur.source.impl.validity.AggregatedValidity;
  import org.apache.excalibur.store.Store;
  
  import org.xml.sax.Attributes;
  import org.xml.sax.InputSource;
  import org.xml.sax.SAXException;
  import org.xml.sax.helpers.AttributesImpl;
  import org.xml.sax.ContentHandler;
  import org.xml.sax.helpers.AttributesImpl;
  
  import java.io.ByteArrayInputStream;
  import java.io.IOException;
  import java.io.Serializable;
  import java.util.Map;
  
  import net.sourceforge.chaperon.grammar.Grammar;
  import net.sourceforge.chaperon.grammar.SyntaxErrorException;
  import net.sourceforge.chaperon.grammar.generator.SAXGrammarGenerator;
  import net.sourceforge.chaperon.parser.ParserException;
  import net.sourceforge.chaperon.parser.Parser;
  import net.sourceforge.chaperon.parser.ParserTable;
  import net.sourceforge.chaperon.parser.generator.ParserTableGenerator;
  import net.sourceforge.chaperon.parser.output.EventQueue;
  import net.sourceforge.chaperon.parser.output.SAXEventAdapter;
  
  /**
   * A genrator that parse text
   *
   * @author Stephan Michels
   * @version CVS $Id: TextParserGenerator.java,v 1.1 2002/06/14 12:39:40 stephan Exp $
   */
  public class TextParserGenerator extends ComposerGenerator
          implements Composable, CacheableProcessingComponent {
  
      /** The URI of the parser exception */
      public final static String URI = "http://chaperon.sourceforge.net/schema/parser-exception/1.0";
  
      /** Element name */
      public final static String ELEMENT = "parser-exception";
  
      /** Attribute name of the message property */
      public final static String MESSAGE_ATTRIBUTE = "message";
  
      /** Attribute name of the message property */
      public final static String LINENUMBER_ATTRIBUTE = "linenr";
  
      /** Attribute name of the message property */
      public final static String COLUMNNUMBER_ATTRIBUTE = "columnnr";
  
      /** Element name for acceptedsymbols */
      public final static String ACCEPTEDSYMBOL_ELEMENT = "parser-exception-accept";
  
      /** The input source */
      private Source      inputSource = null;
      private Source      grammarSource = null;
  
      private String      grammar = null;
      private boolean     includeIgnorableTokens = false;
  
      private ParserTable parsertable = null;
  
      private Parser      parser = null;
  
      private Logger      avalonlogger = null;
  
      /**
       * Provide component with a logger.
       */ 
      public void enableLogging(Logger logger) {
          this.avalonlogger = logger;
      }
  
      /**
       * Recycle this component.
       * All instance variables are set to <code>null</code>.
       */
    	public void recycle()	{
          if (this.inputSource!=null)
              super.resolver.release(this.inputSource);
          this.inputSource = null;
          if (this.grammarSource!=null)
              super.resolver.release(this.grammarSource);
          this.grammarSource = null;
  
          super.recycle();
    	}
  
      /**
       * Set the SourceResolver, objectModel Map, the source and sitemap 
       * Parameters used to process the request.
       *
       * @param resolver Source resolver
       * @param objectmodel Object model
       * @param src Source
       * @param parameters Parameters
       *
       * @throws IOException
       * @throws ProcessingException
       * @throws SAXException
       */
      public void setup(SourceResolver resolver, Map objectmodel, String src,
                        Parameters parameters)
                        throws ProcessingException, SAXException, IOException {
          super.setup(resolver, objectmodel, src, parameters);
          Store store = null;
          try {
              this.includeIgnorableTokens = parameters.getParameterAsBoolean("includeignorabletokens", false);
              this.grammar = parameters.getParameter("grammar");
  
              this.grammarSource = resolver.resolveURI(this.grammar);
  
              // Retrieve the parser table from the transient store 
              store = (Store)this.manager.lookup(Store.TRANSIENT_STORE);
              ParserTableEntry entry = (ParserTableEntry)store.get(this.grammarSource.getSystemId());
  
              // If the parser table has changed, rebuild the parser table
              if ((entry==null) ||
                  (entry.getValidity()==null) ||
                  (!entry.getValidity().isValid(this.grammarSource.getValidity()))) {
                  getLogger().debug("(Re)building the parsertable from '"+this.grammarSource.getSystemId()+"'");
  
                  SAXGrammarGenerator grammargenerator = new SAXGrammarGenerator();
                  SourceUtil.toSAX(this.grammarSource, grammargenerator, this.manager);
  
                  Grammar grammar = grammargenerator.getGrammar();
                  SyntaxErrorException see = grammar.validate();
                  if (see!=null) {
                      getLogger().error("Grammar is not correct", see);
                      throw new ProcessingException("Grammar is not correct", see);
                  }
  
                  ParserTableGenerator parsertablegenerator = new ParserTableGenerator(grammar);
                  this.parsertable = parsertablegenerator.getParserTable();
  
                  store.store(this.grammarSource.getSystemId(), new ParserTableEntry(this.parsertable,
                                                                    this.grammarSource.getValidity()));
              } else {
                  getLogger().debug("Getting parsertable from store for '"+this.grammarSource.getSystemId()+"'");
                  this.parsertable = entry.getParserTable();
              }
  
              this.inputSource = resolver.resolveURI(src);
  
          } catch (ParameterException pe) {
              getLogger().error("Error during retrieving a parameter", pe);
              throw new ProcessingException("Error during retrieving a parameter", pe);
          } catch (SourceException se) {
              getLogger().error("Error during resolving of '" + src + "'.", se);
              throw new ProcessingException("Error during resolving of '" + src + "'.", se);
          } catch (ComponentException ce) {
              getLogger().error("Could not lookup for component", ce);
              throw new ProcessingException("Could not lookup for component", ce);
          } catch (SyntaxErrorException see) {
              getLogger().error("Grammar is not correct", see);
              throw new ProcessingException("Grammar is not correct", see);
          } finally {
              if (store!=null)
              this.manager.release(store);
          }
      }
  
      /**
       * Generate the unique key.
       * This key must be unique inside the space of this component.
       *
       * @return The generated key hashes the src
       */
      public Serializable generateKey() {
          return "TPG("+this.inputSource.getSystemId()+";"+this.grammarSource.getSystemId()+")";
      }
  
      /**
       * Generate the validity object.
       *
       * @return The generated validity object or <code>null</code> if the
       *         component is currently not cacheable.
       */
      public SourceValidity generateValidity() {
          AggregatedValidity validity = new AggregatedValidity();
          validity.add(this.inputSource.getValidity());
          validity.add(this.grammarSource.getValidity());
          return validity;
      }
  
      /**
       * Generate XML data.
       */
      public void generate() throws IOException, SAXException, ProcessingException {
          try {
              if (parser==null) {
                  parser = new Parser();
                  parser.enableLogging(this.avalonlogger);
              }
  
              EventQueue queue = parser.parse(this.parsertable, this.inputSource.getInputStream());
  
              SAXEventAdapter adapter = new SAXEventAdapter(super.contentHandler, 
                                                          this.includeIgnorableTokens, false);
              queue.fireEvents(adapter);
          } catch (ParserException pe) {
              getLogger().error("Could not parse source", pe);
              throw new ProcessingException("Could not parse source", pe);
          } catch (SourceException se) {
              getLogger().error("Could not get inputstream from source", se);
              throw new ProcessingException("Could not get inputstream from source", se);
          }
      }
  
      /** 
       * Serialize the exception to a SAX stream
       *
       * @param handler The content handler, which receives the SAX events
       *
       * @throws SAXException
       */
      public void toSAX(ContentHandler handler, ParserException pe) throws SAXException { 
          handler.startDocument();
      
          AttributesImpl attributes = new AttributesImpl();
      
          attributes.addAttribute(URI, MESSAGE_ATTRIBUTE, MESSAGE_ATTRIBUTE,
                                  "CDATA", pe.getMessage());
          attributes.addAttribute(URI, LINENUMBER_ATTRIBUTE, LINENUMBER_ATTRIBUTE,
                                  "CDATA", String.valueOf(pe.getLineNumber()));
          attributes.addAttribute(URI, COLUMNNUMBER_ATTRIBUTE, COLUMNNUMBER_ATTRIBUTE,
                                  "CDATA", String.valueOf(pe.getColumnNumber()));
        
          handler.startElement(URI, ELEMENT, ELEMENT, attributes);
    
          for(int i=0; i<pe.getAcceptedSymbols().length; i++) { 
              handler.startElement(URI, ACCEPTEDSYMBOL_ELEMENT, ACCEPTEDSYMBOL_ELEMENT, new AttributesImpl());
              handler.characters(pe.getAcceptedSymbols()[i].toCharArray(), 0, 
                                 pe.getAcceptedSymbols()[i].length());
              handler.endElement(URI, ACCEPTEDSYMBOL_ELEMENT, ACCEPTEDSYMBOL_ELEMENT);
          } 
  
          handler.endElement(URI, ELEMENT, ELEMENT);
    
          handler.endDocument();
      }
  
      /**
       * This class represent a entry in a store to cache the parsertable.
       */
      public class ParserTableEntry implements Serializable {
          private SourceValidity validity    = null;
          private ParserTable    parsertable = null;
  
          public ParserTableEntry(ParserTable parsertable, SourceValidity validity) {
              this.parsertable = parsertable;
              this.validity = validity;
          }
  
          public SourceValidity getValidity() {
              return this.validity;
          }
  
          public ParserTable getParserTable() {
              return this.parsertable;
          }
      }
  }
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/src/org/apache/cocoon/transformation/TextFragmentParserTransformer.java
  
  Index: TextFragmentParserTransformer.java
  ===================================================================
  /*
   *  Copyright (C) Chaperon. All rights reserved.
   *  -------------------------------------------------------------------------
   *  This software is published under the terms of the Apache Software License
   *  version 1.1, a copy of which has been included  with this distribution in
   *  the LICENSE file.
   */
  
  package org.apache.cocoon.transformation;
  
  import org.apache.avalon.excalibur.pool.Recyclable;
  
  import org.apache.avalon.framework.activity.Disposable;
  import org.apache.avalon.framework.component.Component;
  import org.apache.avalon.framework.component.ComponentException;
  import org.apache.avalon.framework.component.ComponentManager;
  import org.apache.avalon.framework.component.Composable;
  import org.apache.avalon.framework.configuration.Configurable;
  import org.apache.avalon.framework.configuration.Configuration;
  import org.apache.avalon.framework.configuration.ConfigurationException;
  import org.apache.avalon.framework.logger.LogEnabled;
  import org.apache.avalon.framework.logger.Logger;
  import org.apache.avalon.framework.parameters.ParameterException;
  import org.apache.avalon.framework.parameters.Parameters;
  
  import org.apache.cocoon.ProcessingException;
  import org.apache.cocoon.caching.CacheableProcessingComponent;
  import org.apache.cocoon.components.source.SourceUtil;
  import org.apache.cocoon.environment.SourceResolver;
  import org.apache.cocoon.transformation.AbstractTransformer;
  import org.apache.cocoon.util.HashUtil;
  import org.apache.cocoon.xml.EmbeddedXMLPipe;
  
  import org.apache.excalibur.source.Source;
  import org.apache.excalibur.source.SourceException;
  import org.apache.excalibur.source.SourceValidity;
  import org.apache.excalibur.store.Store;
  
  import org.xml.sax.Attributes;
  import org.xml.sax.InputSource;
  import org.xml.sax.SAXException;
  import org.xml.sax.ContentHandler;
  import org.xml.sax.helpers.AttributesImpl;
  
  import java.io.ByteArrayInputStream;
  import java.io.IOException;
  import java.io.Serializable;
  import java.util.Map;
  
  import net.sourceforge.chaperon.grammar.Grammar;
  import net.sourceforge.chaperon.grammar.SyntaxErrorException;
  import net.sourceforge.chaperon.grammar.generator.SAXGrammarGenerator;
  import net.sourceforge.chaperon.parser.ParserException;
  import net.sourceforge.chaperon.parser.Parser;
  import net.sourceforge.chaperon.parser.ParserTable;
  import net.sourceforge.chaperon.parser.generator.ParserTableGenerator;
  import net.sourceforge.chaperon.parser.output.EventQueue;
  import net.sourceforge.chaperon.parser.output.SAXEventAdapter;
  
  /**
   * The FragmentTextParser parse text in a XML document
   *
   * @author Stephan Michels
   * @version CVS $Id: TextFragmentParserTransformer.java,v 1.1 2002/06/14 12:39:40 stephan Exp $
   */
  public class TextFragmentParserTransformer extends AbstractTransformer
          implements Composable, Recyclable, Disposable, CacheableProcessingComponent {
      private static String EXTRACT_URI = "http://chaperon.sourceforge.net/schema/textfragment/1.0";
      private static String EXTRACT_ELEMENT = "textfragment";
  
      /** The URI of the parser exception DTD */
      public final static String URI = "http://chaperon.sourceforge.net/schema/parser-exception/1.0";
  
      /** Element name */
      public final static String ELEMENT = "parser-exception";
  
      /** Attribute name of the message property */
      public final static String MESSAGE_ATTRIBUTE = "message";
  
      /** Attribute name of the message property */
      public final static String LINENUMBER_ATTRIBUTE = "linenr";
  
      /** Attribute name of the message property */
      public final static String COLUMNNUMBER_ATTRIBUTE = "columnnr";
  
      /** Element name for acceptedsymbols */
      public final static String ACCEPTEDSYMBOL_ELEMENT = "parser-exception-accept";
  
      private int              extractLevel = 0;
  
      private StringBuffer     text = null;
  
      private Source           grammarSource = null;
    
      private ComponentManager manager = null;
      private SourceResolver   resolver = null;
    
      private String           grammar = null;
      private boolean          includeIgnorableTokens = false;
    
      private ParserTable      parsertable = null;
  
      private Parser      parser = null;
  
      private Logger      avalonlogger = null;
  
      /**
       * Provide component with a logger.
       */
      public void enableLogging(Logger logger) {
          this.avalonlogger = logger;
      }
  
      /**
       * Pass the ComponentManager to the composer. The Composable 
       * implementation should use the specified ComponentManager
       * to acquire the components it needs for execution.
       *
       * @param manager The ComponentManager which this Composable uses.
       */
      public void compose(ComponentManager manager) {
          this.manager = manager;
      }
  
      /**
       * Recycle this component.
       * All instance variables are set to <code>null</code>.
       */
      public void recycle() {
          if ((this.resolver!=null) && (this.grammarSource!=null)) {
              this.resolver.release(this.grammarSource);
              this.grammarSource = null;
          }
  
          this.parsertable = null;
      }
  
      /**
       * The dispose operation is called at the end of a 
       * components lifecycle.
       */
      public void dispose() {
          if ((this.resolver!=null) && (this.grammarSource!=null)) {
              this.resolver.release(this.grammarSource);
              this.grammarSource = null;
          }
  
          this.manager = null;
      }
  
      /**
       * Set the SourceResolver, objectModel Map, the source and sitemap 
       * Parameters used to process the request.
       *
       * @param resolver Source resolver
       * @param objectmodel Object model
       * @param src Source
       * @param parameters Parameters
       */
      public void setup(SourceResolver resolver, Map objectmodel, String src,
                        Parameters parameters)
              throws ProcessingException, SAXException, IOException {
          this.resolver = resolver;
          Store store = null;
          try {
              this.includeIgnorableTokens = parameters.getParameterAsBoolean("includeignorabletokens", false);
              this.grammar = parameters.getParameter("grammar");
  
              this.grammarSource = resolver.resolveURI(this.grammar);
  
              // Retrieve the parser table from the transient store 
              store = (Store)this.manager.lookup(Store.TRANSIENT_STORE);
              ParserTableEntry entry = (ParserTableEntry)store.get(this.grammarSource.getSystemId());
  
              // If the parser table has changed, rebuild the parser table
              if ((entry==null) ||
                  (entry.getValidity()==null) ||
                  (!entry.getValidity().isValid(this.grammarSource.getValidity()))) {
                  getLogger().debug("(Re)building the parsertable from '"+this.grammarSource.getSystemId()+"'");
  
                  SAXGrammarGenerator grammargenerator = new SAXGrammarGenerator();
                  SourceUtil.toSAX(this.grammarSource, grammargenerator, this.manager);
  
                  Grammar grammar = grammargenerator.getGrammar();
                  SyntaxErrorException see = grammar.validate();
                  if (see!=null) { 
                      getLogger().error("Grammar is not correct", see);
                      throw new ProcessingException("Grammar is not correct", see);
                  }
  
                  ParserTableGenerator parsertablegenerator = new ParserTableGenerator(grammar);
                  this.parsertable = parsertablegenerator.getParserTable();
  
                  store.store(this.grammarSource.getSystemId(), new ParserTableEntry(this.parsertable,
                                                                    this.grammarSource.getValidity()));
              } else {
                  getLogger().debug("Getting parsertable from store for '"+this.grammarSource.getSystemId()+"'");
                  this.parsertable = entry.getParserTable();
              }
  
          } catch (ParameterException pe) {
              getLogger().error("Error during retrieving a parameter", pe);
              throw new ProcessingException("Error during retrieving a parameter", pe);
          } catch (SourceException se) {
              getLogger().error("Error during resolving of '" + src + "'.", se);
              throw new ProcessingException("Error during resolving of '" + src + "'.", se);
          } catch (ComponentException ce) {
              getLogger().error("Could not lookup for component", ce);
              throw new ProcessingException("Could not lookup for component", ce);
          } catch (SyntaxErrorException see) {
              getLogger().error("Grammar is not correct", see);
              throw new ProcessingException("Grammar is not correct", see);
          } finally {
              if (store!=null)
                  this.manager.release(store);
          }
      }
  
      /**
       * Generate the unique key.
       * This key must be unique inside the space of this component.
       *
       * @return The generated key hashes the src
       */
      public Serializable generateKey() {
          return this.grammarSource.getSystemId();
      }
  
      /**
       * Generate the validity object.
       *
       * @return The generated validity object or <code>null</code> if the
       *         component is currently not cacheable.
       */
      public SourceValidity generateValidity() {
          return this.grammarSource.getValidity();
      }
  
      /**
       * Receive notification of the beginning of an element.
       *
       * @param uri The Namespace URI, or the empty string if the element has no
       *            Namespace URI or if Namespace
       *            processing is not being performed.
       * @param loc The local name (without prefix), or the empty string if
       *            Namespace processing is not being performed.
       * @param raw The raw XML 1.0 name (with prefix), or the empty string if
       *            raw names are not available.
       * @param a The attributes attached to the element. If there are no
       *          attributes, it shall be an empty Attributes object.
       */
      public void startElement(String uri, String loc, String raw,
                               Attributes a) throws SAXException {
          if (this.EXTRACT_URI.equals(uri) && this.EXTRACT_ELEMENT.equals(loc)
              && (this.grammar != null)) {
  
              this.extractLevel++;
              this.text = new StringBuffer();
          } else
              super.startElement(uri, loc, raw, a);
      }
  
      /**
       * Receive notification of the end of an element.
       *
       * @param uri The Namespace URI, or the empty string if the element has no
       *            Namespace URI or if Namespace
       *            processing is not being performed.
       * @param loc The local name (without prefix), or the empty string if
       *            Namespace processing is not being performed.
       * @param raw The raw XML 1.0 name (with prefix), or the empty string if
       *            raw names are not available.
       */
      public void endElement(String uri, String loc,
                             String raw) throws SAXException {
          if (this.EXTRACT_URI.equals(uri) && this.EXTRACT_ELEMENT.equals(loc)
              && (this.grammar != null)) {
  
              this.extractLevel--;
    
              try {
                  if (parser==null) {
                      parser = new Parser();
                      parser.enableLogging(this.avalonlogger);
                  }
             
                  EventQueue queue = parser.parse(this.parsertable, 
                      new ByteArrayInputStream(this.text.toString().getBytes()));
  
                  SAXEventAdapter adapter = new SAXEventAdapter(super.contentHandler, 
                                                                this.includeIgnorableTokens, true);
                  //adapter.enableLogging(getLogger());
                  queue.fireEvents(adapter);
              } catch (ParserException pe) {
                  getLogger().error("Document ist not valid", pe);
                  EmbeddedXMLPipe pipe = new EmbeddedXMLPipe(super.contentHandler);
                  toSAX(pipe, pe);
              }  
  
              this.text = null;
          } else
              super.endElement(uri, loc, raw);
      }
  
      /**
       * Receive notification of character data.
       *
       * @param c The characters from the XML document.
       * @param start The start position in the array.
       * @param len The number of characters to read from the array.
       */
      public void characters(char c[], int start, int len) throws SAXException {
          if (this.extractLevel > 0)
              this.text.append(c, start, len);
          else
              super.characters(c, start, len);
      }
  
      /** 
       * Serialize the exception to a SAX stream
       *
       * @param handler The content handler, which receives the SAX events
       *
       * @throws SAXException
       */
      public void toSAX(ContentHandler handler, ParserException pe) throws SAXException {
          handler.startDocument();
  
          AttributesImpl attributes = new AttributesImpl();
  
          attributes.addAttribute(URI, MESSAGE_ATTRIBUTE, MESSAGE_ATTRIBUTE,
                                  "CDATA", pe.getMessage());
          attributes.addAttribute(URI, LINENUMBER_ATTRIBUTE, LINENUMBER_ATTRIBUTE,
                                  "CDATA", String.valueOf(pe.getLineNumber()));
          attributes.addAttribute(URI, COLUMNNUMBER_ATTRIBUTE, COLUMNNUMBER_ATTRIBUTE,
                                  "CDATA", String.valueOf(pe.getColumnNumber()));
  
          handler.startElement(URI, ELEMENT, ELEMENT, attributes);
  
          for(int i=0; i<pe.getAcceptedSymbols().length; i++) {
              handler.startElement(URI, ACCEPTEDSYMBOL_ELEMENT, ACCEPTEDSYMBOL_ELEMENT, new AttributesImpl());
              handler.characters(pe.getAcceptedSymbols()[i].toCharArray(), 0, 
                                 pe.getAcceptedSymbols()[i].length());
              handler.endElement(URI, ACCEPTEDSYMBOL_ELEMENT, ACCEPTEDSYMBOL_ELEMENT);
          }
  
          handler.endElement(URI, ELEMENT, ELEMENT);
  
          handler.endDocument();
      }
  
      /**
       * This class represent a entry in a store to cache the parsertable.
       */
      public class ParserTableEntry implements Serializable {
          private SourceValidity validity    = null;
          private ParserTable    parsertable = null;
  
          public ParserTableEntry(ParserTable parsertable, SourceValidity validity) {
              this.parsertable = parsertable;
              this.validity = validity;
          }
  
          public SourceValidity getValidity() {
              return this.validity;
          }
  
          public ParserTable getParserTable() {
              return this.parsertable;
          }
      }
  }
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/webapp/mount/chaperon/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  <?xml version="1.0"?>
  
  <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
  
  <!-- =========================== Components ================================ -->
  
   <map:components>
  
  <!-- =========================== Generators ================================= -->
  
    <map:generators default="file">
  
     <map:generator label="content,data" logger="sitemap.generator.file" name="file"
                    src="org.apache.cocoon.generation.FileGenerator"/>
  
     <map:generator name="serverpages" logger="sitemap.generator.serverpages" label="content,data"
                    src="org.apache.cocoon.generation.ServerPagesGenerator"/>
  
     <map:generator name="textparser" label="content,data"
                    src="org.apache.cocoon.generation.TextParserGenerator" 
                    logger="sitemap.generator.textparser"/>
  
    </map:generators>
  
  <!-- =========================== Transformers ================================= -->
  
    <map:transformers default="xslt">
     <map:transformer logger="sitemap.transformer.xslt" name="xslt"
                      src="org.apache.cocoon.transformation.TraxTransformer">
      <use-request-parameters>true</use-request-parameters>
      <use-browser-capabilities-db>false</use-browser-capabilities-db>
     </map:transformer>
  
     <map:transformer name="textparser" 
                      src="org.apache.cocoon.transformation.TextFragmentParserTransformer" 
                      logger="sitemap.transformer.textparser"/>
  
    </map:transformers>
  
  <!-- =========================== Readers ================================= -->
  
    <map:readers default="resource">
     <map:reader logger="sitemap.reader.resource" name="resource" 
                  src="org.apache.cocoon.reading.ResourceReader"/>
    </map:readers>
  
  <!-- =========================== Serializers ================================= -->
  
    <map:serializers default="html">
     <map:serializer logger="sitemap.serializer.xml" mime-type="text/xml" name="xml"
                     src="org.apache.cocoon.serialization.XMLSerializer"/>
  
     <map:serializer logger="sitemap.serializer.html" mime-type="text/html" name="html" 
                     src="org.apache.cocoon.serialization.HTMLSerializer">
      <buffer-size>1024</buffer-size>
     </map:serializer>
    </map:serializers>
  
  <!-- =========================== Matchers ================================= -->
  
    <map:matchers default="wildcard">
     <map:matcher logger="sitemap.matcher.wildcard" name="wildcard"
                  src="org.apache.cocoon.matching.WildcardURIMatcher"/>
    </map:matchers>
  
  <!-- ====================== Pipelines defintions ============================= -->
  
    <map:pipelines default="caching">
     <map:pipeline name="caching" src="org.apache.cocoon.components.pipeline.impl.CachingProcessingPipeline"/>
     <map:pipeline name="noncaching" src="org.apache.cocoon.components.pipeline.impl.NonCachingProcessingPipeline"/>
    </map:pipelines>
  
   </map:components>
  
  
  <!-- =========================== Pipelines ================================= -->
  
   <map:pipelines>
  
    <map:pipeline internal-only="true">
  
     <!-- IMPORTANT! This pipeline sould be cachable -->
     <map:match pattern="*.grm">
      <map:generate type="textparser" src="grammars/{1}.rgrm">
       <map:parameter name="grammar" value="context://mount/chaperon/grammars/rgrm.grm"/>
      </map:generate>
  
      <map:transform src="stylesheets/rgrm2grm.xsl"/>
      <map:serialize type="xml"/>
     </map:match>
    </map:pipeline>
  
    <map:pipeline>   
     <map:match pattern="">
      <map:redirect-to uri="index.html"/>
     </map:match>
  
     <!-- ========================= Chaperon ================================ -->
  
     <map:match pattern="index.html">
      <map:read src="misc/index.html"/>
     </map:match>
  
     <map:match pattern="mathexp.html">
      <map:generate type="serverpages" src="misc/mathexp.xsp"/>
  
      <map:transform src="stylesheets/parsefragment.xsl">
       <map:parameter name="parse_element" value="math"/>
      </map:transform>
  
      <map:transform type="textparser">
       <map:parameter name="grammar" value="context://mount/chaperon/grammars/mathexp.grm"/>
      </map:transform>
  
      <map:transform src="stylesheets/mathexp2html.xsl"/>
      <map:serialize/>
     </map:match>
  
     <map:match pattern="wiki.html">
      <map:generate type="serverpages" src="misc/wiki.xsp"/>
  
      <map:transform type="textparser">
       <!--<map:parameter name="grammar" value="cocoon:/wiki.grm"/>-->
       <map:parameter name="grammar" value="context://mount/chaperon/grammars/wiki.grm"/>
      </map:transform>
  
      <map:transform src="stylesheets/wiki2html.xsl"/>
      <map:serialize type="html"/>
     </map:match>
  
     <map:match pattern="java.html">
      <map:generate type="textparser" src="misc/test2.java">
       <parameter name="grammar" value="cocoon:/java.grm"/>
       <!--<map:parameter name="grammar" value="context:/grammars/java.grm"/>-->
       <map:parameter name="includeignorabletokens" value="true"/>
      </map:generate>
  
      <map:transform src="stylesheets/java2html.xsl"/>
      <map:serialize type="html"/>
     </map:match>
  
     <map:match pattern="java.css">
      <map:read src="misc/java.css"/>
     </map:match>
  
     <!-- ========================= Server ================================ -->
  
     <map:handle-errors>
      <map:transform src="context://stylesheets/system/error2html.xsl"/>
      <map:serialize status-code="500"/>
     </map:handle-errors>
  
    </map:pipeline>
   </map:pipelines>
  
  </map:sitemap>
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/webapp/mount/chaperon/grammars/java.rgrm
  
  Index: java.rgrm
  ===================================================================
  /*------------------------------------------------------------------
   * Copyright (C)
   *   1996, 1997, 1998 Dmitri Bronnikov, All rights reserved.
   *
   * THIS GRAMMAR IS PROVIDED "AS IS" WITHOUT  ANY  EXPRESS  OR
   * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
   * WARRANTIES  OF  MERCHANTABILITY  AND  FITNESS  FOR  A  PARTICULAR
   * PURPOSE, OR NON-INFRINGMENT.
   *
   * Bronikov@inreach.com
   *
   *------------------------------------------------------------------
   *
   * VERSION 1.06 DATE 20 AUG 1998
   *
   *------------------------------------------------------------------
   *
   * UPDATES
   *
   * 1.06 Correction of Java 1.1 syntax
   * 1.05 Yet more Java 1.1
   *      <qualified name>.<allocation expression>
   * 1.04 More Java 1.1 features:
   *      <class name>.this
   *      <type name>.class
   * 1.03 Added Java 1.1 features:
   *      inner classes,
   *      anonymous classes,
   *      non-static initializer blocks,
   *      array initialization by new operator
   * 1.02 Corrected cast expression syntax
   * 1.01 All shift/reduce conflicts, except dangling else, resolved
   *
   *------------------------------------------------------------------
   *
   * PARSING CONFLICTS RESOLVED
   *
   * Some Shift/Reduce conflicts have been resolved at the expense of
   * the grammar defines a superset of the language. The following
   * actions have to be performed to complete program syntax checking:
   *
   * 1) Check that modifiers applied to a class, interface, field,
   *    or constructor are allowed in respectively a class, inteface,
   *    field or constructor declaration. For example, a class
   *    declaration should not allow other modifiers than abstract,
   *    final and public.
   *
   * 2) For an expression statement, check it is either increment, or
   *    decrement, or assignment expression.
   *
   * 3) Check that type expression in a cast operator indicates a type.
   *    Some of the compilers that I have tested will allow simultaneous
   *    use of identically named type and variable in the same scope
   *    depending on context.
   *
   * 4) Change lexical definition to change '[' optionally followed by
   *    any number of white-space characters immediately followed by ']'
   *    to OP_DIM token. I defined this token as [\[]{white_space}*[\]]
   *    in the lexer.
   *
   *------------------------------------------------------------------
   *
   * UNRESOLVED SHIFT/REDUCE CONFLICTS
   *
   * Dangling else in if-then-else
   *
   *------------------------------------------------------------------
   */
  
  %uri "http://chaperon.sourceforge.net/grammar/java/1.0";
  
  %token DOPEN     \(;
  %token DCLOSE    \);
  %token COPEN     \{;
  %token CCLOSE    \};
  %token BOPEN     \[;
  %token BCLOSE    \];
  %token SEMICOLON \;;
  %token COMMA     \,;
  %token DOT       \.;
  
  %token OP_EQ    ==;
  %token OP_LE    \<=;
  %token OP_GE    \>=;
  %token OP_NE    !=;
  %token OP_LOR   \|\|;
  %token OP_LAND  &&;
  %token OP_INC   \+\+;
  %token OP_DEC   \-\-;
  %token OP_SHR   \>\>;
  %token OP_SHL   \<\<;
  %token OP_SHRR  \>\>\>;
  %token ASS_OP   \+= | \-= | \*= | /= | &= | \|= | \^= | \%= | \<\<= | \>\>= | \>\>\>=;
  
  %token EQ    \=;
  %token GT    \>;
  %token LT    \<;
  %token NOT   \!;
  %token TILDE \~;
  %token QM    \?;
  %token COLON \:;
  %token PLUS  \+;
  %token MINUS \-;
  %token MULT  \*;
  %token DIV   \/;
  %token AND   \&;
  %token OR    \|;
  %token XOR   \^;
  %token MOD   \%;
  
  %token BOOLLIT true|false;
  
  %token ABSTRACT     abstract;
  %token DO           do;
  %token IMPLEMENTS   implements;
  %token PACKAGE      package;
  %token THROW        throw;
  %token BOOLEAN      boolean;
  %token DOUBLE       double;
  %token IMPORT       import;
  %token PRIVATE      private;
  %token THROWS       throws;
  %token BREAK        break;
  
  %right ELSE         else;
  
  %token INNER        inner;
  %token PROTECTED    protected;
  %token TRANSIENT    transient;
  %token BYTE         byte;
  %token EXTENDS      extends;
  %token INSTANCEOF   instanceof;
  %token PUBLIC       public;
  %token TRY          try;
  %token CASE         case;
  %token FINAL        final;
  %token INT          int;
  %token REST         rest;
  %token VAR          var;
  %token CAST         cast;
  %token FINALLY      finally;
  %token INTERFACE    interface;
  %token RETURN       return;
  %token VOID         void;
  %token CATCH        catch;
  %token FLOAT        float;
  %token LONG         long;
  %token SHORT        short;
  %token VOLATILE     volatile;
  %token CHAR         char;
  %token FOR          for;
  %token NATIVE       native;
  %token STATIC       static;
  %token WHILE        while;
  %token CLASS        class;
  %token FUTURE       future;
  %token NEW          new;
  %token SUPER        super;
  %token CONST        const;
  %token GENERIC      generic;
  %token NULL         null;
  %token SWITCH       switch;
  %token CONTINUE     continue;
  %token GOTO         goto;
  %token OPERATOR     operator;
  %token SYNCHRONIZED synchronized;
  %token DEFAULT      default;
  %token IF           if;
  %token OUTER        outer;
  %token THIS         this;
  
  %ab HexDigit        [0-9a-fA-F];
  %ab Digit           [0-9];
  %ab OctalDigit      [0-7];
  %ab TetraDigit      [0-3];
  %ab NonZeroDigit    [1-9];
  %ab Letter          [a-zA-Z_];
  %ab AnyButSlash     [^\/];
  %ab AnyButAstr      [^\*];
  %ab UniEsc          [\1b];
  
  %ab OctEscape1      \\ <OctalDigit>;
  %ab OctEscape2      \\ <OctalDigit><OctalDigit>;
  %ab OctEscape3      \\ <TetraDigit><OctalDigit><OctalDigit>;
  %ab OctEscape       (<OctEscape1>|<OctEscape2>|<OctEscape3>);
  
  %ab Escape          [\\]([rnbft\\\'\"]);
  %ab ULetter         (<Letter>|<UniEsc>);
  %ab Identifier      <ULetter>(<ULetter>|<Digit>)*;
  
  %ab IntSuffix       (l|L);
  %ab DecimalNum      <NonZeroDigit><Digit>*<IntSuffix>?;
  %ab OctalNum        0 <OctalDigit>*<IntSuffix>?;
  %ab HexNum          0 (x|X) <HexDigit><HexDigit>*<IntSuffix>?;
  %ab IntegerLiteral  (<DecimalNum>|<OctalNum>|<HexNum>);
  
  %ab Sign            (\+ | \-);
  %ab FlSuffix        (f|F|d|D);
  %ab SignedInt       <Sign>?<Digit>+;
  %ab Expo            (e|E);
  %ab ExponentPart    <Expo><SignedInt>?;
  %ab Float1          <Digit>+ \. (<Digit>+)?<ExponentPart>?<FlSuffix>?;
  %ab Float2          \. <Digit>+<ExponentPart>?<FlSuffix>?;
  %ab Float3          <Digit>+<ExponentPart><FlSuffix>?;
  %ab Float4          <Digit>+<FlSuffix>;
  %ab FloatingPoint   (<Float1>|<Float2>|<Float3>|<Float4>);
  
  %ab AnyChrChr       [^\\'];
  %ab AnyStrChr       [^\\\"];
  %ab Character       \' (<Escape>|<OctEscape>|<AnyChrChr>)  \' ;
  %ab String          \" (<Escape>|<OctEscape>|<AnyStrChr>)* \" ;
  %ab Numeric         (<IntegerLiteral>|<FloatingPoint>);
  
  %token LITERAL         (<Numeric>|<Character>|<String>);
  
  %token IDENTIFIER   ([a-zA-Z_]|[\1b])(([a-zA-Z_]|[\1b])|[0-9])*;
  
  
  //%token OP_DIM \[ ([\r\n\f\t\b\ ]|( \/ \* ([^\*]| \* [^\/])* \*  \/ |
  //              \/ \/ (.*)))* \] ;
  
  //%whitespace [\r\n\f\t\b\ ];
  
  
  %token OP_DIM \[ ([\r\n\t\ ]|( \/ \* ([^\*]| \* [^\/])* \*  \/ |
                 \/ \/ (.*)))* \] ;
  
  %ignore whitespace [\t\ ];
  
  %ignore eol \r(\n)?|\n;
  
  %ab Comment1        \/ \* (<AnyButAstr>|[\*]<AnyButSlash>)* \* \/;
  %ab Comment2        \/ \/ (.*);
  %ignore comment         (<Comment1>|<Comment2>);
  
  %start CompilationUnit;
  
  %%
  
  TypeSpecifier
  	: TypeName
  	| TypeName Dims
  	;
  
  TypeName
  	: PrimitiveType
  	| QualifiedName
  	;
  
  ClassNameList
    : QualifiedName
    | ClassNameList COMMA QualifiedName
  	;
  
  PrimitiveType
  	: BOOLEAN
  	| CHAR
  	| BYTE
  	| SHORT
  	| INT
  	| LONG
  	| FLOAT
  	| DOUBLE
  	| VOID
  	;
  
  SemiColons
  	: SEMICOLON
    | SemiColons SEMICOLON
    ;
  
  CompilationUnit
  	: ProgramFile
    ;
  
  ProgramFile
  	: PackageStatement ImportStatements TypeDeclarations
  	| PackageStatement ImportStatements
  	| PackageStatement                  TypeDeclarations
  	|                  ImportStatements TypeDeclarations
  	| PackageStatement
  	|                  ImportStatements
  	|                                   TypeDeclarations
  	;
  
  PackageStatement
  	: PACKAGE QualifiedName SemiColons
  	;
  
  TypeDeclarations
  	: TypeDeclarationOptSemi
  	| TypeDeclarations TypeDeclarationOptSemi
  	;
  
  TypeDeclarationOptSemi
    : TypeDeclaration
    | TypeDeclaration SemiColons
    ;
  
  ImportStatements
  	: ImportStatement
  	| ImportStatements ImportStatement
  	;
  
  ImportStatement
  	: IMPORT QualifiedName SemiColons
  	| IMPORT QualifiedName DOT MULT SemiColons
  	;
  
  QualifiedName
  	: IDENTIFIER %append
  	| QualifiedName DOT IDENTIFIER %append
  	;
  
  TypeDeclaration
  	: ClassHeader COPEN FieldDeclarations CCLOSE
  	| ClassHeader COPEN CCLOSE
  	;
  
  ClassHeader
  	: Modifiers ClassWord IDENTIFIER Extends Interfaces
  	| Modifiers ClassWord IDENTIFIER Extends
  	| Modifiers ClassWord IDENTIFIER         Interfaces
  	|           ClassWord IDENTIFIER Extends Interfaces
  	| Modifiers ClassWord IDENTIFIER
  	|           ClassWord IDENTIFIER Extends
  	|           ClassWord IDENTIFIER         Interfaces
  	|           ClassWord IDENTIFIER
  	;
  
  Modifiers
  	: Modifier %append
  	| Modifiers Modifier %append
  	;
  
  Modifier
  	: ABSTRACT
  	| FINAL
  	| PUBLIC
  	| PROTECTED
  	| PRIVATE
  	| STATIC
  	| TRANSIENT
  	| VOLATILE
  	| NATIVE
  	| SYNCHRONIZED
  	;
  
  ClassWord
  	: CLASS
  	| INTERFACE
  	;
  
  Interfaces
  	: IMPLEMENTS ClassNameList
  	;
  
  FieldDeclarations
  	: FieldDeclarationOptSemi
    | FieldDeclarations FieldDeclarationOptSemi
  	;
  
  FieldDeclarationOptSemi
    : FieldDeclaration
    | FieldDeclaration SemiColons
    ;
  
  FieldDeclaration
  	: FieldVariableDeclaration SEMICOLON
  	| MethodDeclaration
  	| ConstructorDeclaration
  	| StaticInitializer
    | NonStaticInitializer
    | TypeDeclaration
  	;
  
  FieldVariableDeclaration
  	: Modifiers TypeSpecifier VariableDeclarators
  	|           TypeSpecifier VariableDeclarators
  	;
  
  VariableDeclarators
  	: VariableDeclarator
  	| VariableDeclarators COMMA VariableDeclarator
  	;
  
  VariableDeclarator
  	: DeclaratorName
  	| DeclaratorName EQ VariableInitializer
  	;
  
  VariableInitializer
  	: Expression
  	| COPEN CCLOSE
    | COPEN ArrayInitializers CCLOSE
    ;
  
  ArrayInitializers
  	: VariableInitializer
  	| ArrayInitializers COMMA VariableInitializer
  	| ArrayInitializers COMMA
  	;
  
  MethodDeclaration
  	: Modifiers TypeSpecifier MethodDeclarator Throws MethodBody
  	| Modifiers TypeSpecifier MethodDeclarator        MethodBody
  	|           TypeSpecifier MethodDeclarator Throws MethodBody
  	|           TypeSpecifier MethodDeclarator        MethodBody
  	;
  
  MethodDeclarator
  	: DeclaratorName DOPEN ParameterList DCLOSE
  	| DeclaratorName DOPEN DCLOSE
  	| MethodDeclarator OP_DIM
  	;
  
  ParameterList
  	: Parameter
  	| ParameterList COMMA Parameter
  	;
  
  Parameter
  	: TypeSpecifier DeclaratorName
    | FINAL TypeSpecifier DeclaratorName
  	;
  
  DeclaratorName
  	: IDENTIFIER
    | DeclaratorName OP_DIM
    ;
  
  Throws
  	: THROWS ClassNameList
  	;
  
  MethodBody
  	: Block
  	| SEMICOLON
  	;
  
  ConstructorDeclaration
  	: Modifiers ConstructorDeclarator Throws Block
  	| Modifiers ConstructorDeclarator        Block
  	|           ConstructorDeclarator Throws Block
  	|           ConstructorDeclarator        Block
  	;
  
  ConstructorDeclarator
  	: IDENTIFIER DOPEN ParameterList DCLOSE
  	| IDENTIFIER DOPEN DCLOSE
  	;
  
  StaticInitializer
  	: STATIC Block
  	;
  
  NonStaticInitializer
    : Block
    ;
  
  Extends
  	: EXTENDS TypeName
  	| Extends COMMA TypeName
  	;
  
  Block
  	: COPEN LocalVariableDeclarationsAndStatements CCLOSE
  	| COPEN CCLOSE
    ;
  
  LocalVariableDeclarationsAndStatements
  	: LocalVariableDeclarationOrStatement %append
  	| LocalVariableDeclarationsAndStatements LocalVariableDeclarationOrStatement %append
  	;
  
  LocalVariableDeclarationOrStatement
  	: LocalVariableDeclarationStatement
  	| Statement
  	;
  
  LocalVariableDeclarationStatement
  	: TypeSpecifier VariableDeclarators SEMICOLON
    | FINAL TypeSpecifier VariableDeclarators SEMICOLON
  	;
  
  Statement
  	: EmptyStatement
  	| LabelStatement
  	| ExpressionStatement SEMICOLON
    | SelectionStatement
    | IterationStatement
  	| JumpStatement
  	| GuardingStatement
  	| Block
  	;
  
  EmptyStatement
  	: SEMICOLON
    ;
  
  LabelStatement
  	: IDENTIFIER COLON
    | CASE ConstantExpression COLON
  	| DEFAULT COLON
    ;
  
  ExpressionStatement
  	: Expression
  	;
  
  SelectionStatement
  	: IF DOPEN Expression DCLOSE Statement %prec ELSE
    | IF DOPEN Expression DCLOSE Statement ELSE Statement %prec ELSE
    | SWITCH DOPEN Expression DCLOSE Block
    ;
  
  IterationStatement
  	: WHILE DOPEN Expression DCLOSE Statement
  	| DO Statement WHILE DOPEN Expression DCLOSE SEMICOLON
  	| FOR DOPEN ForInit ForExpr ForIncr DCLOSE Statement
  	| FOR DOPEN ForInit ForExpr         DCLOSE Statement
  	;
  
  ForInit
  	: ExpressionStatements SEMICOLON
  	| LocalVariableDeclarationStatement
  	| SEMICOLON
  	;
  
  ForExpr
  	: Expression SEMICOLON
  	| SEMICOLON
  	;
  
  ForIncr
  	: ExpressionStatements
  	;
  
  ExpressionStatements
  	: ExpressionStatement %resolve
  	| ExpressionStatements COMMA ExpressionStatement
  	;
  
  JumpStatement
  	: BREAK IDENTIFIER SEMICOLON
  	| BREAK            SEMICOLON
    | CONTINUE IDENTIFIER SEMICOLON
  	| CONTINUE            SEMICOLON
  	| RETURN Expression SEMICOLON
  	| RETURN            SEMICOLON
  	| THROW Expression SEMICOLON
  	;
  
  GuardingStatement
  	: SYNCHRONIZED DOPEN Expression DCLOSE Statement
  	| TRY Block Finally
  	| TRY Block Catches
  	| TRY Block Catches Finally
  	;
  
  Catches
  	: Catch
  	| Catches Catch
  	;
  
  Catch
  	: CatchHeader Block
  	;
  
  CatchHeader
  	: CATCH DOPEN TypeSpecifier IDENTIFIER DCLOSE
  	| CATCH DOPEN TypeSpecifier DCLOSE
  	;
  
  Finally
  	: FINALLY Block
  	;
  
  PrimaryExpression
  	: QualifiedName %resolve
  	| NotJustName %resolve
  	;
  
  NotJustName
  	: SpecialName %resolve
  	| NewAllocationExpression %resolve
  	| ComplexPrimary %resolve
  	;
  
  ComplexPrimary
  	: DOPEN Expression DCLOSE
  	| ComplexPrimaryNoParenthesis %resolve
  	;
  
  ComplexPrimaryNoParenthesis
  	: LITERAL
  	| BOOLLIT
  	| ArrayAccess
  	| FieldAccess
  	| MethodCall
  	;
  
  ArrayAccess
  	: QualifiedName  BOPEN Expression BCLOSE
  	| ComplexPrimary BOPEN Expression BCLOSE
  	;
  
  FieldAccess
  	: NotJustName DOT IDENTIFIER
  	| RealPostfixExpression DOT IDENTIFIER
    | QualifiedName DOT THIS
    | QualifiedName DOT CLASS
    | PrimitiveType DOT CLASS
  	;
  
  MethodCall
  	: MethodAccess DOPEN ArgumentList DCLOSE
  	| MethodAccess DOPEN DCLOSE
  	;
  
  MethodAccess
  	: ComplexPrimaryNoParenthesis
  	| SpecialName
  	| QualifiedName
  	;
  
  SpecialName
  	: THIS
  	| SUPER
  	| NULL
  	;
  
  ArgumentList
  	: Expression
  	| ArgumentList COMMA Expression
  	;
  
  NewAllocationExpression
    : PlainNewAllocationExpression
    | QualifiedName DOT PlainNewAllocationExpression
    ;
  
  PlainNewAllocationExpression
   	: ArrayAllocationExpression
   	| ClassAllocationExpression
   	| ArrayAllocationExpression COPEN CCLOSE
   	| ClassAllocationExpression COPEN CCLOSE
   	| ArrayAllocationExpression COPEN ArrayInitializers CCLOSE
   	| ClassAllocationExpression COPEN FieldDeclarations CCLOSE
   	;
  
  ClassAllocationExpression
  	: NEW TypeName DOPEN ArgumentList DCLOSE
  	| NEW TypeName DOPEN              DCLOSE
    ;
  
  ArrayAllocationExpression
  	: NEW TypeName DimExprs Dims
  	| NEW TypeName DimExprs
    | NEW TypeName Dims
  	;
  
  DimExprs
  	: DimExpr
  	| DimExprs DimExpr
  	;
  
  DimExpr
  	: BOPEN Expression BCLOSE
  	;
  
  Dims
  	: OP_DIM
  	| Dims OP_DIM
  	;
  
  PostfixExpression
  	: PrimaryExpression %resolve
  	| RealPostfixExpression %resolve
  	;
  
  RealPostfixExpression
  	: PostfixExpression OP_INC
  	| PostfixExpression OP_DEC
  	;
  
  UnaryExpression
  	: OP_INC UnaryExpression
  	| OP_DEC UnaryExpression
  	| ArithmeticUnaryOperator CastExpression
  	| LogicalUnaryExpression %resolve
  	;
  
  LogicalUnaryExpression
  	: PostfixExpression %resolve
  	| LogicalUnaryOperator UnaryExpression
  	;
  
  LogicalUnaryOperator
  	: TILDE
  	| NOT
  	;
  
  ArithmeticUnaryOperator
  	: PLUS
  	| MINUS
  	;
  
  CastExpression
  	: UnaryExpression %resolve
  	| DOPEN PrimitiveTypeExpression DCLOSE CastExpression
  	| DOPEN ClassTypeExpression DCLOSE CastExpression
  	| DOPEN Expression DCLOSE LogicalUnaryExpression
  	;
  
  PrimitiveTypeExpression
  	: PrimitiveType 
    | PrimitiveType Dims
    ;
  
  ClassTypeExpression
  	: QualifiedName Dims
    ;
  
  MultiplicativeExpression
  	: CastExpression %resolve
  	| MultiplicativeExpression MULT CastExpression
  	| MultiplicativeExpression DIV CastExpression
  	| MultiplicativeExpression MOD CastExpression
  	;
  
  AdditiveExpression
  	: MultiplicativeExpression %resolve
    | AdditiveExpression PLUS MultiplicativeExpression
  	| AdditiveExpression MINUS MultiplicativeExpression
    ;
  
  ShiftExpression 
  	: AdditiveExpression %resolve
    | ShiftExpression OP_SHL AdditiveExpression
    | ShiftExpression OP_SHR AdditiveExpression
    | ShiftExpression OP_SHRR AdditiveExpression
  	;
  
  RelationalExpression
  	: ShiftExpression %resolve
    | RelationalExpression LT ShiftExpression
  	| RelationalExpression GT ShiftExpression
  	| RelationalExpression OP_LE ShiftExpression
  	| RelationalExpression OP_GE ShiftExpression
  	| RelationalExpression INSTANCEOF TypeSpecifier
  	;
  
  EqualityExpression
  	: RelationalExpression %resolve
    | EqualityExpression OP_EQ RelationalExpression
    | EqualityExpression OP_NE RelationalExpression
    ;
  
  AndExpression
  	: EqualityExpression %resolve
    | AndExpression AND EqualityExpression
    ;
  
  ExclusiveOrExpression
  	: AndExpression %resolve
  	| ExclusiveOrExpression XOR AndExpression
  	;
  
  InclusiveOrExpression
  	: ExclusiveOrExpression %resolve
  	| InclusiveOrExpression OR ExclusiveOrExpression
  	;
  
  ConditionalAndExpression
  	: InclusiveOrExpression %resolve
  	| ConditionalAndExpression OP_LAND InclusiveOrExpression
  	;
  
  ConditionalOrExpression
  	: ConditionalAndExpression %resolve
  	| ConditionalOrExpression OP_LOR ConditionalAndExpression
  	;
  
  ConditionalExpression
  	: ConditionalOrExpression %resolve
  	| ConditionalOrExpression QM Expression COLON ConditionalExpression
  	;
  
  AssignmentExpression
  	: ConditionalExpression %resolve
  	| UnaryExpression AssignmentOperator AssignmentExpression
  	;
  
  AssignmentOperator
  	: EQ
  	| ASS_OP
  	;
  
  Expression
  	: AssignmentExpression
    ;
  
  ConstantExpression
  	: ConditionalExpression
  	;
  
  
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/webapp/mount/chaperon/grammars/mathexp.grm
  
  Index: mathexp.grm
  ===================================================================
  <?xml version="1.0"?>
  <!--<!DOCTYPE grammar PUBLIC "-//Chaperon//DTD grammar 1.0//EN" "grammar.dtd">-->
  
  <grammar uri="http://chaperon.sourceforge.net/grammar/mathexp/1.0">
   <tokens>
  
    <token tsymbol="plus">
     <cc><cs content="+-"/></cc>
    </token>
  
    <token tsymbol="mult">
     <cc><cs content="*/"/></cc>
    </token>
  
    <token tsymbol="dopen">
     <string content="("/>
    </token>
  
    <token tsymbol="dclose">
     <string content=")"/>
    </token>
  
    <token tsymbol="id">
     <concat>
      <cc><ci min="A" max="Z"/><ci min="a" max="z"/></cc>
      <cc minOccurs="0" maxOccurs="*"><ci min="A" max="Z"/><ci min="a" max="z"/><ci min="0" max="9"/><cs content="_"/></cc>
     </concat>
    </token>
  
    <token tsymbol="number">
     <alt>
      <concat>
       <cc minOccurs="1" maxOccurs="*"><ci min="0" max="9"/></cc>
       <concat minOccurs="0" maxOccurs="1">
        <string content="."/>
        <cc minOccurs="0" maxOccurs="*"><ci min="0" max="9"/></cc>
       </concat>
      </concat>
      <concat>
       <string content="."/>
       <cc minOccurs="1" maxOccurs="*"><ci min="0" max="9"/></cc>
      </concat>
     </alt>
    </token>
  
   </tokens>
  
   <ignorabletokens>
    <token tsymbol="whitespace">
     <cc maxOccurs="*"><cs content="&#10;&#13;&#9;&#32;"/></cc>
    </token>
   </ignorabletokens>
  
   <productions>
  
    <production ntsymbol="E">
     <ntsymbol name="E"/><tsymbol name="plus"/><ntsymbol name="T"/>
  	</production>
  
    <production ntsymbol="E">
     <ntsymbol name="T"/>
    </production>
  
    <production ntsymbol="T">
     <ntsymbol name="T"/><tsymbol name="mult"/><ntsymbol name="F"/>
    </production>
  
    <production ntsymbol="T">
     <ntsymbol name="F"/>
    </production>
  
    <production ntsymbol="F">
     <tsymbol name="dopen"/><ntsymbol name="E"/><tsymbol name="dclose"/>
    </production>
  
    <production ntsymbol="F">
     <tsymbol name="id"/>
    </production>
  
    <production ntsymbol="F">
     <tsymbol name="number"/>
    </production>
  
   </productions>
  
   <ssymbol ntsymbol="E"/>
  </grammar>
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/webapp/mount/chaperon/grammars/rgrm.grm
  
  Index: rgrm.grm
  ===================================================================
  <?xml version="1.0" standalone="no"?>
  <!--<!DOCTYPE grammar PUBLIC "-//Chaperon//DTD grammar 1.0//EN" "grammar.dtd">-->
  
  <grammar uri="http://chaperon.sourceforge.net/grammar/rgrm/1.0">
   <tokens>
  
    <token tsymbol="token_decl">
     <alt>
      <string content="%token"/>
      <string content="%left"/>
      <string content="%right"/>
     </alt>
    </token>
  
    <token tsymbol="ab_decl">
     <string content="%ab"/>
    </token>
  
    <token tsymbol="start_decl">
     <string content="%start"/>
    </token>
  
    <token tsymbol="ignorabletoken_decl">
     <string content="%ignore"/>
    </token>
  
    <token tsymbol="reducetype_decl">
     <alt>
      <string content="%normal"/>
      <string content="%append"/>
      <string content="%resolve"/>
      <string content="%neglect"/>
     </alt>
    </token>
  
    <token tsymbol="prec_decl">
     <string content="%prec"/>
    </token>
  
    <token tsymbol="uri_decl">
     <string content="%uri"/>
    </token>
  
    <token tsymbol="delimiter">
     <string content="%%"/>
    </token>
  
    <token tsymbol="colon">
     <string content=":"/>
    </token>
  
    <token tsymbol="alt">
     <string content="|"/>
    </token>
  
    <token tsymbol="semicolon">
     <string content=";"/>
    </token>
  
    <token tsymbol="comma">
     <string content=","/>
    </token>
  
    <token tsymbol="number">
     <cc minOccurs="1" maxOccurs="*"><ci min="0" max="9"/></cc>
    </token>
  
    <token tsymbol="copen">
     <string content="{"/>
    </token>
  
    <token tsymbol="cclose">
     <string content="}"/>
    </token>
  
    <token tsymbol="abopen">
     <string content="&lt;"/>
    </token>
  
    <token tsymbol="abclose">
     <string content=">"/>
    </token>
  
    <token tsymbol="string">
     <concat>
      <string content="&#34;"/>
      <alt minOccurs="1" maxOccurs="*">
       <ncc><cs content="&#92;&#34;"/></ncc>
       <concat><string content="&#92;"/><ncc><cs content="u"/></ncc></concat>
       <concat>
        <string content="&#92;u"/>
        <cc><ci min="0" max="9"/><ci min="a" max="f"/><ci min="A" max="F"/></cc>
        <cc><ci min="0" max="9"/><ci min="a" max="f"/><ci min="A" max="F"/></cc>
        <cc><ci min="0" max="9"/><ci min="a" max="f"/><ci min="A" max="F"/></cc>
        <cc><ci min="0" max="9"/><ci min="a" max="f"/><ci min="A" max="F"/></cc>
       </concat>
      </alt>
      <string content="&#34;"/>
     </concat>
    </token>
  
    <token tsymbol="id">
     <concat>
      <cc><ci min="A" max="Z"/><ci min="a" max="z"/></cc>
      <cc minOccurs="0" maxOccurs="*">
       <ci min="A" max="Z"/><ci min="a" max="z"/><ci min="0" max="9"/><cs content="_"/>
      </cc>
     </concat>
    </token>
  
  	<token tsymbol="character">
     <!--<alt>-->
      <ncc><cs content="&#92;[]-&#10;&#13;&#32;();%[]|+?*^$&lt;>&#34;"/></ncc>
      <!--<concat><string content="&#92;"/><dot/></concat>
      <concat><string content="&#92;"/><ncc><cs content="u"/></ncc></concat>
  		<concat>
       <string content="&#92;u"/>
       <cc><ci min="0" max="9"/><ci min="a" max="f"/><ci min="A" max="F"/></cc>
       <cc><ci min="0" max="9"/><ci min="a" max="f"/><ci min="A" max="F"/></cc>
       <cc><ci min="0" max="9"/><ci min="a" max="f"/><ci min="A" max="F"/></cc>
       <cc><ci min="0" max="9"/><ci min="a" max="f"/><ci min="A" max="F"/></cc>
      </concat>
  	 </alt>-->
  	</token>
  
    <token tsymbol="maskedcharacter">
      <concat><string content="&#92;"/><dot/></concat>
    </token>
  
    <token tsymbol="minus">
     <string content="-"/>
    </token>
  
    <token tsymbol="hat">
     <string content="^"/>
    </token>
  
    <token tsymbol="dollar">
     <string content="$"/>
    </token>
  
    <token tsymbol="ccbegin">
     <string content="["/>
    </token>
  
    <token tsymbol="ccend">
     <string content="]"/>
    </token>
  
    <token tsymbol="regexdot">
     <string content="."/>
    </token>
  
    <token tsymbol="dopen">
     <string content="("/>
    </token>
  
    <token tsymbol="dclose">
     <string content=")"/>
    </token>
  
    <token tsymbol="questionmark">
     <string content="?"/>
    </token>
  
    <token tsymbol="mult">
     <string content="*"/>
    </token>
  
    <token tsymbol="plus">
     <string content="+"/>
    </token>
  
   </tokens>
  
   <ignorabletokens>
    <token tsymbol="comment">
     <alt>
      <concat><string content="//"/><ncc minOccurs="0" maxOccurs="*"><cs content="&#10;"/></ncc></concat>
      <concat>
       <string content="/*"/>
       <alt minOccurs="0" maxOccurs="*">
        <ncc><cs content="*"/></ncc>
        <concat><string content="*"/><ncc><cs content="/"/></ncc></concat>
       </alt>
       <string content="*/"/>
      </concat>
     </alt>
    </token>
   
    <token tsymbol="whitespace"> 
     <cc maxOccurs="*"><cs content="&#10;&#13;&#9;&#32;"/></cc>
    </token>
   </ignorabletokens>
  
   <productions>
  
    <production ntsymbol="intervall">
     <tsymbol name="character"/><tsymbol name="minus"/><tsymbol name="character"/>
  	</production>
  
    <production ntsymbol="intervall">
     <tsymbol name="maskedcharacter"/><tsymbol name="minus"/><tsymbol name="character"/>
    </production>
  
    <production ntsymbol="intervall">
     <tsymbol name="character"/><tsymbol name="minus"/><tsymbol name="maskedcharacter"/>
    </production>
  
    <production ntsymbol="intervall">
     <tsymbol name="maskedcharacter"/><tsymbol name="minus"/><tsymbol name="maskedcharacter"/>
    </production>
  
    <production ntsymbol="sequence" reducetype="resolve">
  	 <ntsymbol name="sequence"/><ntsymbol name="intervall"/>
  	</production>
  
    <production ntsymbol="sequence" reducetype="resolve">
     <ntsymbol name="sequence"/><tsymbol name="character"/>
    </production>
  
    <production ntsymbol="sequence" reducetype="resolve">
     <ntsymbol name="sequence"/><tsymbol name="maskedcharacter"/>
    </production>
  
    <production ntsymbol="sequence" reducetype="resolve">
     <ntsymbol name="intervall"/>
    </production>
  
    <production ntsymbol="sequence" reducetype="resolve">
     <tsymbol name="character"/>
    </production>
  
    <production ntsymbol="sequence" reducetype="resolve">
     <tsymbol name="maskedcharacter"/>
    </production>
  
    <production ntsymbol="string" reducetype="append">
     <ntsymbol name="string"/><tsymbol name="character"/>
    </production>
  
    <production ntsymbol="string" reducetype="append">
     <ntsymbol name="string"/><tsymbol name="maskedcharacter"/>
    </production>
  
    <production ntsymbol="string" reducetype="append">
     <tsymbol name="character"/>
    </production>
  
    <production ntsymbol="string" reducetype="append">
     <tsymbol name="maskedcharacter"/>
    </production>
  
    <production ntsymbol="characterclass">
  	 <tsymbol name="ccbegin"/><ntsymbol name="sequence"/><tsymbol name="ccend"/>
    </production>
  
    <production ntsymbol="negatedcharacterclass">
     <tsymbol name="ccbegin"/><tsymbol name="hat"/><ntsymbol name="sequence"/><tsymbol name="ccend"/>
    </production>
  
  	<production ntsymbol="regexdot">
  	 <tsymbol name="regexdot"/>
  	</production>
  
    <production ntsymbol="regexbol">
     <tsymbol name="hat"/>
    </production>
  
    <production ntsymbol="regexeol">
     <tsymbol name="dollar"/>
    </production>
  
    <production ntsymbol="regexklammer">
  	 <tsymbol name="dopen"/><ntsymbol name="regexalternation"/><tsymbol name="dclose"/>
  	</production>
  
    <production ntsymbol="regexabref">
     <tsymbol name="abopen"/><tsymbol name="id"/><tsymbol name="abclose"/>
    </production>
  
    <production ntsymbol="regexterm" reducetype="resolve">
  	 <ntsymbol name="characterclass"/>
  	</production>
  
    <production ntsymbol="regexterm" reducetype="resolve">
     <ntsymbol name="negatedcharacterclass"/>
    </production>
  
    <production ntsymbol="regexterm" reducetype="resolve">
     <ntsymbol name="regexklammer"/>
    </production>
  
    <production ntsymbol="regexterm" reducetype="resolve">
     <ntsymbol name="string"/>
    </production>
  
    <production ntsymbol="regexterm" reducetype="resolve">
     <ntsymbol name="regexdot"/>
    </production>
  
    <production ntsymbol="regexterm" reducetype="resolve">
     <ntsymbol name="regexbol"/>
    </production>
  
    <production ntsymbol="regexterm" reducetype="resolve">
     <ntsymbol name="regexeol"/>
    </production>
  
    <production ntsymbol="regexterm" reducetype="resolve">
     <ntsymbol name="regexabref"/>
    </production>
  
    <production ntsymbol="regexoptional">
  	 <ntsymbol name="regexterm"/><tsymbol name="questionmark"/>
  	</production>
  
    <production ntsymbol="regexstar">
  	 <ntsymbol name="regexterm"/><tsymbol name="mult"/>
  	</production>
  
    <production ntsymbol="regexplus">
     <ntsymbol name="regexterm"/><tsymbol name="plus"/>
    </production>
  
    <production ntsymbol="regexmultiplicator">
     <tsymbol name="copen"/><tsymbol name="number"/><tsymbol name="cclose"/>
    </production>
  
    <production ntsymbol="regexmultiplicator">
     <tsymbol name="copen"/><tsymbol name="number"/>
     <tsymbol name="comma"/><tsymbol name="number"/><tsymbol name="cclose"/>
    </production>
  
    <production ntsymbol="regexvar">
     <ntsymbol name="regexterm"/><ntsymbol name="regexmultiplicator"/>
    </production>
  
  	<production ntsymbol="regexquantifier" reducetype="resolve">
  	 <ntsymbol name="regexoptional"/>
  	</production>
  
    <production ntsymbol="regexquantifier" reducetype="resolve">
     <ntsymbol name="regexstar"/>
    </production>
  
    <production ntsymbol="regexquantifier" reducetype="resolve">
     <ntsymbol name="regexplus"/>
    </production>
  
    <production ntsymbol="regexquantifier" reducetype="resolve">
     <ntsymbol name="regexterm"/>
    </production>
  
    <production ntsymbol="regexquantifier" reducetype="resolve">
     <ntsymbol name="regexvar"/>
    </production>
  
  	<production ntsymbol="regexconcatenation" reducetype="append">
  	 <ntsymbol name="regexconcatenation"/><ntsymbol name="regexquantifier"/>
  	</production>
  
    <production ntsymbol="regexconcatenation" reducetype="resolve">
     <ntsymbol name="regexquantifier"/>
    </production>
  
    <production ntsymbol="regexalternation" reducetype="append">
  	 <ntsymbol name="regexalternation"/><tsymbol name="alt"/><ntsymbol name="regexconcatenation"/>
  	</production>
  
    <production ntsymbol="regexalternation" reducetype="resolve">
     <ntsymbol name="regexconcatenation"/>
    </production>
  
    <production ntsymbol="regexexpression">
  	 <ntsymbol name="regexalternation"/>
    </production>
  
    <production ntsymbol="grammar">
     <ntsymbol name="token_decls"/><tsymbol name="delimiter"/>
     <ntsymbol name="production_decls"/>
  	</production>
  
    <production ntsymbol="token_decls" reducetype="append">
     <ntsymbol name="token_decls"/> <ntsymbol name="token_decl"/>
    </production>
  
    <production ntsymbol="token_decls" reducetype="append">
     <ntsymbol name="token_decl"/>
    </production>
  
    <production ntsymbol="token_decls" reducetype="append">
     <ntsymbol name="token_decls"/><ntsymbol name="start_decl"/>
    </production>
  
    <production ntsymbol="token_decls" reducetype="append">
     <ntsymbol name="start_decl"/>
    </production>
  
    <production ntsymbol="token_decls" reducetype="append">
     <ntsymbol name="token_decls"/><ntsymbol name="ignorabletoken_decl"/>
    </production>
  
    <production ntsymbol="token_decls" reducetype="append">
     <ntsymbol name="ignorabletoken_decl"/>
    </production>
  
    <production ntsymbol="token_decls" reducetype="append">
     <ntsymbol name="token_decls"/><ntsymbol name="uri_decl"/>
    </production>
    
    <production ntsymbol="token_decls" reducetype="append">
     <ntsymbol name="uri_decl"/>
    </production>
  
    <production ntsymbol="token_decls" reducetype="append">
     <ntsymbol name="token_decls"/><ntsymbol name="ab_decl"/>
    </production>
    
    <production ntsymbol="token_decls" reducetype="append">
     <ntsymbol name="ab_decl"/>
    </production>
  
    <production ntsymbol="token_decl">
     <tsymbol name="token_decl"/><tsymbol name="id"/><ntsymbol name="regexexpression"/><tsymbol name="semicolon"/>
    </production>
  
    <production ntsymbol="start_decl">
     <tsymbol name="start_decl"/><tsymbol name="id"/><tsymbol name="semicolon"/>
    </production>
  
    <production ntsymbol="ignorabletoken_decl">
     <tsymbol name="ignorabletoken_decl"/><tsymbol name="id"/><ntsymbol name="regexexpression"/>
     <tsymbol name="semicolon"/>
    </production>
  
    <production ntsymbol="uri_decl">
     <tsymbol name="uri_decl"/><tsymbol name="string"/><tsymbol name="semicolon"/>
    </production>
  
    <production ntsymbol="ab_decl">
     <tsymbol name="ab_decl"/><tsymbol name="id"/><ntsymbol name="regexexpression"/><tsymbol name="semicolon"/>
    </production>
  
    <production ntsymbol="production_decls" reducetype="append">
     <ntsymbol name="production_decls"/><ntsymbol name="production_decl"/>
    </production>
  
    <production ntsymbol="production_decls" reducetype="append">
     <ntsymbol name="production_decl"/>
    </production>
  
    <production ntsymbol="production_decl">
     <tsymbol name="id"/><tsymbol name="colon"/><ntsymbol name="production_defs"/><tsymbol name="semicolon"/>
    </production>
  
    <production ntsymbol="production_defs" reducetype="append">
     <ntsymbol name="production_defs"/><tsymbol name="alt"/><ntsymbol name="production_def"/>
    </production>
   
    <production ntsymbol="production_defs" reducetype="append">
     <ntsymbol name="production_def"/>
    </production>
  
    <production ntsymbol="prec_decl" reducetype="append">
     <tsymbol name="prec_decl"/><tsymbol name="id"/>
    </production>
  
    <production ntsymbol="production_def" reducetype="append">
     <ntsymbol name="ids"/>
    </production>
  
    <production ntsymbol="production_def" reducetype="append">
     <ntsymbol name="ids"/><ntsymbol name="prec_decl"/>
    </production>
  
    <production ntsymbol="production_def" reducetype="append">
     <ntsymbol name="ids"/><tsymbol name="reducetype_decl"/>
    </production>
  
    <production ntsymbol="production_def" reducetype="append">
     <ntsymbol name="ids"/><ntsymbol name="prec_decl"/><tsymbol name="reducetype_decl"/>
    </production>
  
    <production ntsymbol="ids" reducetype="append">
     <ntsymbol name="ids"/><tsymbol name="id"/>
    </production>
  
    <production ntsymbol="ids" reducetype="append">
     <tsymbol name="id"/>
    </production>
   </productions>
  
   <ssymbol ntsymbol="grammar"/>
  </grammar>
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/webapp/mount/chaperon/grammars/wiki.grm
  
  Index: wiki.grm
  ===================================================================
  <?xml version="1.0" encoding="US-ASCII"?>
  <!--<!DOCTYPE grammar PUBLIC "-//Chaperon//DTD grammar 1.0//EN" "grammar.dtd">-->
  <grammar uri="http://chaperon.sourceforge.net/grammar/wiki/1.0">
  <tokens>
  <token tsymbol="LINE">
  <concat>
  <string content="---"/>
  <concat maxOccurs="*" minOccurs="1">
  <string content="-"/>
  </concat>
  </concat>
  </token>
  <token tsymbol="QUOTE">
  <string content=":"/>
  </token>
  <token tsymbol="BULLETED">
  <concat maxOccurs="*" minOccurs="1">
  <string content="*"/>
  </concat>
  </token>
  <token tsymbol="NUMBERED3">
  <string content="###"/>
  </token>
  <token tsymbol="NUMBERED2">
  <string content="##"/>
  </token>
  <token tsymbol="NUMBERED1">
  <string content="#"/>
  </token>
  <token tsymbol="HEAD">
  <concat maxOccurs="*" minOccurs="1">
  <string content="!"/>
  </concat>
  </token>
  <token assoc="left" tsymbol="ITALIC">
  <string content="&quot;"/>
  </token>
  <token assoc="left" tsymbol="BOLD">
  <string content="__"/>
  </token>
  <token assoc="left" tsymbol="UNDERLINE">
  <string content="_"/>
  </token>
  <token tsymbol="LINK">
  <concat>
  <alt>
  <string content="http"/>
  <string content="ftp"/>
  <string content="mailto"/>
  <string content="news"/>
  </alt>
  <string content=":"/>
  <concat minOccurs="1" maxOccurs="3">
  <string content="/"/>
  </concat>
  <concat maxOccurs="*" minOccurs="0">
  <cc>
  <ci min="A" max="Z"/>
  <ci min="a" max="z"/>
  <ci min="0" max="9"/>
  <cs content="."/>
  <cs content="_"/>
  <cs content="-"/>
  </cc>
  </concat>
  </concat>
  </token>
  <token tsymbol="BOPEN">
  <string content="["/>
  </token>
  <token tsymbol="BCLOSE">
  <string content="]"/>
  </token>
  <token tsymbol="TEXT">
  <concat>
  <concat maxOccurs="*" minOccurs="1">
  <cc>
  <ci min="A" max="Z"/>
  <ci min="a" max="z"/>
  <ci min="0" max="9"/>
  <cs content=","/>
  <cs content="'"/>
  <cs content="."/>
  <cs content="?"/>
  <cs content=":"/>
  </cc>
  </concat>
  <concat maxOccurs="*" minOccurs="0">
  <cc>
  <ci min="A" max="Z"/>
  <ci min="a" max="z"/>
  <ci min="0" max="9"/>
  <cs content=" "/>
  <cs content="	"/>
  <cs content=","/>
  <cs content="'"/>
  <cs content="."/>
  <cs content="?"/>
  <cs content="!"/>
  <cs content=":"/>
  </cc>
  </concat>
  </concat>
  </token>
  <token assoc="left" tsymbol="EMPTY">
  <alt>
  <concat>
  <string content="&#10;"/>
  <concat maxOccurs="*" minOccurs="0">
  <cc>
  <cs content=" "/>
  <cs content="	"/>
  </cc>
  </concat>
  <string content="&#10;"/>
  </concat>
  <concat>
  <string content="&#13;"/>
  <concat maxOccurs="*" minOccurs="0">
  <cc>
  <cs content=" "/>
  <cs content="	"/>
  </cc>
  </concat>
  <string content="&#13;"/>
  </concat>
  <concat>
  <string content="&#10;"/>
  <concat maxOccurs="*" minOccurs="0">
  <cc>
  <cs content=" "/>
  <cs content="	"/>
  </cc>
  </concat>
  <string content="&#10;"/>
  </concat>
  </alt>
  </token>
  <token tsymbol="EOL">
  <alt>
  <concat>
  <string content="&#13;"/>
  <concat maxOccurs="1" minOccurs="0">
  <string content="&#10;"/>
  </concat>
  </concat>
  <string content="&#10;"/>
  </alt>
  </token>
  </tokens>
   <ignorabletokens>
    <token tsymbol="whitespace">
  <concat maxOccurs="*" minOccurs="1">
  <cc>
  <cs content=" "/>
  <cs content="&#13;"/>
  <cs content="&#10;"/>
  </cc>
  </concat>
    </token>
   </ignorabletokens>
  <productions>
  <production ntsymbol="wiki" reducetype="append">
  <ntsymbol name="wiki"/>
  <ntsymbol name="paragraphs"/>
  </production>
  <production ntsymbol="wiki" reducetype="append">
  <ntsymbol name="paragraphs"/>
  </production>
  <production ntsymbol="paragraphs" reducetype="append">
  <ntsymbol name="paragraphs"/>
  <ntsymbol name="paragraph"/>
  </production>
  <production ntsymbol="paragraphs" reducetype="append">
  <ntsymbol name="paragraph"/>
  </production>
  <production ntsymbol="paragraph">
  <ntsymbol name="bulletedlist"/>
  </production>
  <production ntsymbol="paragraph">
  <ntsymbol name="numberedlist1"/>
  </production>
  <production ntsymbol="paragraph">
  <ntsymbol name="textitem"/>
  </production>
  <production ntsymbol="paragraph">
  <ntsymbol name="headitem"/>
  </production>
  <production ntsymbol="paragraph">
  <ntsymbol name="footnote"/>
  </production>
  <production ntsymbol="paragraph">
  <tsymbol name="LINE"/>
  </production>
  <production ntsymbol="paragraph">
  <tsymbol name="EMPTY"/>
  </production>
  <production ntsymbol="bulletedlist" reducetype="append">
  <ntsymbol name="bulletedlist"/>
  <ntsymbol name="bulletedlistitem"/>
  </production>
  <production ntsymbol="bulletedlist" reducetype="append">
  <ntsymbol name="bulletedlistitem"/>
  </production>
  <production ntsymbol="bulletedlistitem">
  <tsymbol name="BULLETED"/>
  <ntsymbol name="textblock"/>
  <ntsymbol name="textsequence"/>
  </production>
  <production ntsymbol="bulletedlistitem">
  <tsymbol name="BULLETED"/>
  <ntsymbol name="textblock"/>
  </production>
  <production ntsymbol="numberedlist1" reducetype="append">
  <ntsymbol name="numberedlist1"/>
  <ntsymbol name="numberedlistitem1"/>
  </production>
  <production ntsymbol="numberedlist1" reducetype="append">
  <ntsymbol name="numberedlistitem1"/>
  </production>
  <production ntsymbol="numberedlist1" reducetype="append">
  <ntsymbol name="numberedlist1"/>
  <ntsymbol name="numberedlist2"/>
  </production>
  <production ntsymbol="numberedlist1" reducetype="append">
  <ntsymbol name="numberedlist2"/>
  </production>
  <production ntsymbol="numberedlistitem1">
  <tsymbol name="NUMBERED1"/>
  <ntsymbol name="textblock"/>
  <ntsymbol name="textsequence"/>
  </production>
  <production ntsymbol="numberedlistitem1">
  <tsymbol name="NUMBERED1"/>
  <ntsymbol name="textblock"/>
  </production>
  <production ntsymbol="numberedlist2" reducetype="append">
  <ntsymbol name="numberedlist2"/>
  <ntsymbol name="numberedlistitem2"/>
  </production>
  <production ntsymbol="numberedlist2" reducetype="append">
  <ntsymbol name="numberedlistitem2"/>
  </production>
  <production ntsymbol="numberedlist2" reducetype="append">
  <ntsymbol name="numberedlist2"/>
  <ntsymbol name="numberedlist3"/>
  </production>
  <production ntsymbol="numberedlist2" reducetype="append">
  <ntsymbol name="numberedlist3"/>
  </production>
  <production ntsymbol="numberedlistitem2">
  <tsymbol name="NUMBERED2"/>
  <ntsymbol name="textblock"/>
  <ntsymbol name="textsequence"/>
  </production>
  <production ntsymbol="numberedlistitem2">
  <tsymbol name="NUMBERED2"/>
  <ntsymbol name="textblock"/>
  </production>
  <production ntsymbol="numberedlist3" reducetype="append">
  <ntsymbol name="numberedlist3"/>
  <ntsymbol name="numberedlistitem3"/>
  </production>
  <production ntsymbol="numberedlist3" reducetype="append">
  <ntsymbol name="numberedlistitem3"/>
  </production>
  <production ntsymbol="numberedlistitem3">
  <tsymbol name="NUMBERED3"/>
  <ntsymbol name="textblock"/>
  <ntsymbol name="textsequence"/>
  </production>
  <production ntsymbol="numberedlistitem3">
  <tsymbol name="NUMBERED3"/>
  <ntsymbol name="textblock"/>
  </production>
  <production ntsymbol="textitem">
  <ntsymbol name="firstblock"/>
  <ntsymbol name="textblock"/>
  <ntsymbol name="textsequence"/>
  </production>
  <production ntsymbol="textitem">
  <ntsymbol name="firstblock"/>
  <ntsymbol name="textblock"/>
  </production>
  <production ntsymbol="textitem">
  <ntsymbol name="firstblock"/>
  </production>
  <production ntsymbol="headitem">
  <tsymbol name="HEAD"/>
  <ntsymbol name="textblock"/>
  <ntsymbol name="textsequence"/>
  </production>
  <production ntsymbol="headitem">
  <tsymbol name="HEAD"/>
  <ntsymbol name="textblock"/>
  </production>
  <production ntsymbol="footnote">
  <ntsymbol name="note"/>
  <ntsymbol name="textblock"/>
  <ntsymbol name="textsequence"/>
  </production>
  <production ntsymbol="footnote">
  <ntsymbol name="note"/>
  <ntsymbol name="textblock"/>
  </production>
  <production ntsymbol="textsequence" reducetype="resolve">
  <ntsymbol name="textsequence"/>
  <tsymbol name="EOL"/>
  </production>
  <production ntsymbol="textsequence" reducetype="resolve">
  <tsymbol name="EOL"/>
  </production>
  <production ntsymbol="textsequence" reducetype="resolve">
  <ntsymbol name="textsequence"/>
  <ntsymbol name="textblock"/>
  </production>
  <production ntsymbol="textsequence" reducetype="resolve">
  <ntsymbol name="textblock"/>
  </production>
  <production ntsymbol="textblock">
  <tsymbol name="LINK"/>
  </production>
  <production ntsymbol="textblock">
  <ntsymbol name="boldblock"/>
  </production>
  <production ntsymbol="textblock">
  <ntsymbol name="italicblock"/>
  </production>
  <production ntsymbol="textblock">
  <ntsymbol name="underlineblock"/>
  </production>
  <production ntsymbol="textblock">
  <tsymbol name="TEXT"/>
  </production>
  <production ntsymbol="textblock">
  <ntsymbol name="note"/>
  </production>
  <production ntsymbol="firstblock">
  <tsymbol name="LINK"/>
  </production>
  <production ntsymbol="firstblock">
  <ntsymbol name="boldblock"/>
  </production>
  <production ntsymbol="firstblock">
  <ntsymbol name="italicblock"/>
  </production>
  <production ntsymbol="firstblock">
  <ntsymbol name="underlineblock"/>
  </production>
  <production ntsymbol="firstblock">
  <tsymbol name="TEXT"/>
  </production>
  <production ntsymbol="italicblock">
  <tsymbol name="ITALIC"/>
  <tsymbol name="TEXT"/>
  <tsymbol name="ITALIC"/>
  </production>
  <production ntsymbol="boldblock">
  <tsymbol name="BOLD"/>
  <tsymbol name="TEXT"/>
  <tsymbol name="BOLD"/>
  </production>
  <production ntsymbol="underlineblock">
  <tsymbol name="UNDERLINE"/>
  <tsymbol name="TEXT"/>
  <tsymbol name="UNDERLINE"/>
  </production>
  <production ntsymbol="note">
  <tsymbol name="BOPEN"/>
  <tsymbol name="TEXT"/>
  <tsymbol name="BCLOSE"/>
  </production>
  <production ntsymbol="note">
  <tsymbol name="BOPEN"/>
  <tsymbol name="LINK"/>
  <tsymbol name="BCLOSE"/>
  </production>
  </productions>
  <ssymbol ntsymbol="wiki"/>
  </grammar>
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/webapp/mount/chaperon/grammars/wiki.rgrm
  
  Index: wiki.rgrm
  ===================================================================
  %uri "http://chaperon.sourceforge.net/grammar/wiki/1.0";
  
  %token LINE \-\-\-(\-)+;
  
  %token QUOTE  :;
  %token BULLETED (\*)+;
  
  %token NUMBERED3 \#\#\#;
  %token NUMBERED2 \#\#;
  %token NUMBERED1 \#;
  
  %token HEAD (\!)+;
  
  %left ITALIC \";
  %left BOLD __;
  %left UNDERLINE _;
  
  %token LINK (http|ftp|mailto|news):(/){1,3}[A-Za-z0-9\.\_\-]*;
  
  %token BOPEN \[;
  %token BCLOSE \];
  
  %token TEXT [A-Za-z0-9\,\'\.\?\:]+[A-Za-z0-9\ \t\,\'\.\?\!\:]*;
  
  %left EMPTY \r\n [\ \t]* \r\n |
              \r   [\ \t]* \r   |
              \n   [\ \t]* \n   ;
  
  %token EOL (\r(\n)?|\n);
  
  
  %start wiki;
  
  %ignore whitespace [\ \r\n]+;
  
  %%
  
  wiki : wiki paragraphs %append
       | paragraphs      %append
       ;
  
  paragraphs : paragraphs paragraph %append
             | paragraph            %append
             ;
  
  paragraph : bulletedlist
            | numberedlist1
            | textitem 
            | headitem 
            | footnote
            | LINE
            | EMPTY
            ;
  
  bulletedlist : bulletedlist bulletedlistitem %append
               | bulletedlistitem              %append
               ;
  
  bulletedlistitem : BULLETED textblock textsequence
                   | BULLETED textblock
                   ;
  
  numberedlist1 : numberedlist1 numberedlistitem1 %append
                | numberedlistitem1               %append
                | numberedlist1 numberedlist2     %append
                | numberedlist2                   %append
                ;
  
  numberedlistitem1 : NUMBERED1 textblock textsequence
                    | NUMBERED1 textblock
                    ;
  
  numberedlist2 : numberedlist2 numberedlistitem2 %append
                | numberedlistitem2               %append
                | numberedlist2 numberedlist3     %append
                | numberedlist3                   %append
                ; 
  
  numberedlistitem2 : NUMBERED2 textblock textsequence
                    | NUMBERED2 textblock 
                    ;
  
  numberedlist3 : numberedlist3 numberedlistitem3 %append
                | numberedlistitem3               %append
                ; 
  
  numberedlistitem3 : NUMBERED3 textblock textsequence
                    | NUMBERED3 textblock 
                    ;
  
  textitem : firstblock textblock textsequence
           | firstblock textblock
           | firstblock
           ;
  
  headitem : HEAD textblock textsequence
           | HEAD textblock
           ;
  
  footnote : note textblock textsequence
           | note textblock
           ;
  
  textsequence : textsequence EOL       %resolve
               | EOL                    %resolve
               | textsequence textblock %resolve
               | textblock              %resolve
               ; 
  
  textblock : LINK                           
            | boldblock                      
            | italicblock            
            | underlineblock                
            | TEXT                         
            | note                         
            ;
  
  firstblock : LINK                 
             | boldblock                
             | italicblock                
             | underlineblock          
             | TEXT               
             ;
  
  italicblock : ITALIC TEXT ITALIC
              ;
  
  boldblock : BOLD TEXT BOLD
            ;
  
  underlineblock : UNDERLINE TEXT UNDERLINE 
                 ;
  
  note : BOPEN TEXT BCLOSE
       | BOPEN LINK BCLOSE
       ;
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/webapp/mount/chaperon/misc/index.html
  
  Index: index.html
  ===================================================================
  <?xml version="1.0" encoding="ASCII"?>
  <html>
   <head>
    <title>Chaperon Examples</title>
   </head>
   <body>
  
    <h1>Chaperon Examples</h1>
  
    <p>
     <ul>
      <li><a href="mathexp.html">Mathexp example</a></li>
      <li><a href="wiki.html">Wiki Example</a></li>
      <li><a href="java.html">Java Example (Need once 2-3min, for the parser table generation process)</a></li>
     </ul>
    </p>
  
   </body>
  </html>
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/webapp/mount/chaperon/misc/java.css
  
  Index: java.css
  ===================================================================
  
  body { background-color: #FFFFFF; }
  
  body {  color: #000000}
  
  #Header  { color: #ffffff;  background-color:#8697a5 }
  
  #CharacerLiteral	{ color: #FF00FF; }
  #StringLiteral		{ color: #FF00FF; }
  #SingleLineComment	{ color: #008000; }
  #FormalComment		{ color: #008000; }
  #MultiLineComment	{ color: #008000; }
  #ABSTRACT		{ color: #0000FF ; font-weight: bold }
  #BOOLEAN		{ color: #0000FF ; font-weight: bold }
  #BREAK			{ color: #0000FF ; font-weight: bold }
  #BYTE			{ color: #0000FF ; font-weight: bold }
  #CASE			{ color: #0000FF ; font-weight: bold }
  #CATCH			{ color: #0000FF ; font-weight: bold }
  #CHAR			{ color: #0000FF ; font-weight: bold }
  #CLASS			{ color: #0000FF ; font-weight: bold }
  #CONST			{ color: #0000FF ; font-weight: bold }
  #CONTINUE		{ color: #0000FF ; font-weight: bold }
  #DEFAULT		{ color: #0000FF ; font-weight: bold }
  #DO			{ color: #0000FF ; font-weight: bold }
  #DOUBLE		{ color: #0000FF ; font-weight: bold }
  #ELSE			{ color: #0000FF ; font-weight: bold }
  #EXTENDS		{ color: #0000FF ; font-weight: bold }
  #FALSE			{ color: #0000FF ; font-weight: bold }
  #FINAL			{ color: #0000FF ; font-weight: bold }
  #FINALLY		{ color: #0000FF ; font-weight: bold }
  #FLOAT			{ color: #0000FF ; font-weight: bold }
  #FOR			{ color: #0000FF ; font-weight: bold }
  #GOTO			{ color: #0000FF ; font-weight: bold }
  #IF			{ color: #0000FF ; font-weight: bold }
  #IMPLEMENTS		{ color: #0000FF ; font-weight: bold }
  #IMPORT		{ color: #0000FF ; font-weight: bold }
  #INSTANCEOF		{ color: #0000FF ; font-weight: bold }
  #INT			{ color: #0000FF ; font-weight: bold }
  #INTERFACE		{ color: #0000FF ; font-weight: bold }
  #LONG			{ color: #0000FF ; font-weight: bold }
  #NATIVE		{ color: #0000FF ; font-weight: bold }
  #NEW			{ color: #0000FF ; font-weight: bold }
  #PACKAGE		{ color: #0000FF ; font-weight: bold }
  #PRIVATE		{ color: #0000FF ; font-weight: bold }
  #PROTECTED		{ color: #0000FF ; font-weight: bold }
  #PUBLIC		{ color: #0000FF ; font-weight: bold }
  #RETURN		{ color: #0000FF ; font-weight: bold }
  #SHORT			{ color: #0000FF ; font-weight: bold }
  #STATIC		{ color: #0000FF ; font-weight: bold }
  #SUPER			{ color: #0000FF ; font-weight: bold }
  #SWITCH		{ color: #0000FF ; font-weight: bold }
  #SYCHRONIZED		{ color: #0000FF ; font-weight: bold }
  #THIS			{ color: #0000FF ; font-weight: bold }
  #THROW			{ color: #0000FF ; font-weight: bold }
  #THROWS		{ color: #0000FF ; font-weight: bold }
  #TRANSIENT		{ color: #0000FF ; font-weight: bold }
  #TRUE			{ color: #0000FF ; font-weight: bold }
  #TRY			{ color: #0000FF ; font-weight: bold }
  #VOID			{ color: #0000FF ; font-weight: bold }
  #VOLATILE		{ color: #0000FF ; font-weight: bold }
  #WHILE			{ color: #0000FF ; font-weight: bold }
  #StrictFP			{ color: #0000FF ; font-weight: bold }
  #LITERAL	{ color: #b27b8c }
  #IDENTIFIER { color: #000000 }
  
  
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/webapp/mount/chaperon/misc/matex.xsp
  
  Index: matex.xsp
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  
  <xsp:page language="java"
            xmlns:xsp="http://apache.org/xsp"
            xmlns:xsp-request="http://apache.org/xsp/request/2.0">
  
  <html>
   <head>
    <title>Matex Exmaple</title>
   </head>
   <body>
  
    <h1>Matex Exmaple</h1>
  
    <p>
   <textfragment xmlns="http://chaperon.sourceforge.net/schema/textfragment/1.0"><xsp-request:get-parameter name="text" 
    default="M^+(t) = {i} M^{p_0}_1 \\left( P_3^4 - PQP^5_667 + \\frac{PQ}67.89PQP - \\right)"/></textfragment>
    </p>
  
    <p>
     <form action="matex.html" method="get">
  
      <xsp:element name="input">
       <xsp:attribute name="name">text</xsp:attribute>
       <xsp:attribute name="type">text</xsp:attribute>
       <xsp:attribute name="size">80</xsp:attribute>
       <xsp:attribute name="maxlength">110</xsp:attribute>
       <xsp:attribute name="value"><xsp-request:get-parameter name="text" 
         default="M^+(t) = {i} M^{p_0}_1 \\left( P_3^4 - PQP^5_667 + \\frac{PQ}67.89PQP - \\right)"/></xsp:attribute>
      </xsp:element>
     </form>
    </p>
  
   </body>
  </html>
  
  </xsp:page>
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/webapp/mount/chaperon/misc/mathexp.xsp
  
  Index: mathexp.xsp
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  
  <xsp:page language="java"
            xmlns:xsp="http://apache.org/xsp"
            xmlns:xsp-request="http://apache.org/xsp/request/2.0">
  
  <html>
   <head>
    <title>Mathexp Example</title>
   </head>
   <body>
  
    <h1>Mathexp Example</h1>
  
    <p>
     <textfragment xmlns="http://chaperon.sourceforge.net/schema/textfragment/1.0"><xsp-request:get-parameter name="text" 
      default="3*a-5*6/7 + ( b-c)*5- b"/></textfragment>
    </p>
  
    <p>
     <form action="mathexp.html" method="post">
  
      <xsp:element name="input">
       <xsp:attribute name="name">text</xsp:attribute>
       <xsp:attribute name="type">text</xsp:attribute>
       <xsp:attribute name="size">80</xsp:attribute>
       <xsp:attribute name="maxlength">110</xsp:attribute>
       <xsp:attribute name="value"><xsp-request:get-parameter name="text" 
         default="3*a-5*6/7 + ( b-c)*5- b"/></xsp:attribute>
      </xsp:element>
     </form>
    </p>
  
   </body>
  </html>
  
  </xsp:page>
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/webapp/mount/chaperon/misc/test2.java
  
  Index: test2.java
  ===================================================================
  /*
   *  Copyright (C) Chaperon. All rights reserved.                               
   *  ------------------------------------------------------------------------- 
   *  This software is published under the terms of the Apache Software License 
   *  version 1.1, a copy of which has been included  with this distribution in 
   *  the LICENSE file.                                                         
   */
  
  package net.sourceforge.chaperon.helpers;
  
  /**
   * The class maskes special characters
   *
   * @author Stephan Michels
   * @version %version%
   */
  public class Decoder
  {
  
    /**
     * Mask special characters
     *
     * @param string String
     *
     * @return Mask string
     */
    public static String decode(String string)
    {
      StringBuffer buffer = new StringBuffer();
  
      for (int i = 0; i < string.length(); i++)
      {
        if (string.charAt(i) == '\n')
          buffer.append("\\n");
        else if (string.charAt(i) == '\t')
          buffer.append("\\t");
        else if (string.charAt(i) == '\r')
          buffer.append("\\r");
        else if (string.charAt(i) == '\"')
          buffer.append("\"");
        else if (string.charAt(i) == '\\')
          buffer.append("\\");
        else if ((string.charAt(i) >= '!') && (string.charAt(i) <= '~'))
          buffer.append(string.charAt(i));
        else
        {
          String hexstring = Integer.toHexString((int) string.charAt(i));
          String zeros = "0000";
  
          buffer.append("\\u" + zeros.substring(4 - hexstring.length())
                        + hexstring);
        }
      }
      return buffer.toString();
    }
  }
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/webapp/mount/chaperon/misc/wiki.xsp
  
  Index: wiki.xsp
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  
  <xsp:page language="java"
            xmlns:xsp="http://apache.org/xsp"
            xmlns:xsp-request="http://apache.org/xsp/request/2.0">
  
  <html>
   <head>
    <title>Wiki example</title>
    <style>
   .title
        {
          text-align: center;
          font-size: 18px;
          font-weight: bold;
          font-family: sans-serif,Arial,Tahoma;
          color: black;
          background: white;
          border-color: black;
          border-width: 10px;
        }
        
        .main
        {
          border: 1px solid #0086B2;
          padding: 0px;
          margin: 6px;
          min-width: 630px;
        }
        
        .head
        {
          border-bottom: #0086B2;
          border-width: 0 0 1px 0;
          border-style: none none solid none;
          padding: 6px 6px 3px 6px;
        }
        
        .block { padding: 6px; }
        
        .confirm
        {
          width: 40%;
          margin-left: 50%;
          padding: 6px;
        }
        
        .content
        {
          border: 1px solid #0086B2; 
          padding: 6px;
          margin: 1px;
        }
   
        tr 
        {
          padding: 2px 6px 2px 6px;
        }
             
      
        .col1
        {
          font-weight: bold;
        }
  
         .error .col1
        {
          padding: 2px 20px 2px 6px;
        }
  
         .error .col2
        {
          color:#BB0000;
          padding: 2px 20px 2px 6px;
        }
       
        .field { }
        
        .notify
        {
          font-size: 15px;
          text-align: left;
        }
        
        .tools { text-align: right; }
        .tool { padding: 6px; }
        
        .notes
        {
          font-size: 12px;
          font-weight: bold;
          color: white;
          background: #0086B2;
          text-align: left;
          padding: 6px 6px 3px 6px;
        }
        
        .foot
        {
          text-align: center;
          font-size: 12px;
          margin-top: 50px;
        }
        
        .hspace { margin: 30px; }
        #left { float: left; }
        #right { float: right; }
        #center { text-align: center; }
        #row { background: #EEFFFF; }
        
        .failure
        {
          font-weight: bold;
          color: #BB0000;
        }
        
        .warning
        {
          font-weight: bold;
          color: #BB0000;
        }
        
        .success
        {
          font-weight: bold;
          color: green;
        }
        
        .tab
        {
          font-size: 12px;
          font-weight: bold;
          color: white;
          background: #0086B2;
          padding: 4px 4px 2px 4px;
          border: 0px solid #0086B2;
          margin: 1px;
        }
        
        .tab a
        {
          text-decoration: none;
          color: white;
        }
        
        .tab a:visited
        {
          text-decoration: none;
          color: white;
        }
        
        .tab a:link
        {
          text-decoration: none;
          color: white;
        }
        
        .tab a:hover
        {
          text-decoration: underline;
          color: red;
        }
        
        a { text-decoration: none; }
        
        a:hover
        {
          text-decoration: underline;
          color: red;
        }
        
        body
        {
          font-size: 12px;
          font-family: sans-serif,Arial,Tahoma;
          color: black;
          background: white;
        }
        
        form { font-size: 12px; }
        
        textarea
        {
          background-color: #EEFFFF;
          font-size: 12px;
          font-family: geneva,arial,sans-serif;
          border-color: #0086B2;
          border-width: 1px;
          padding-left: 2px;
        }
        
        textarea.hidden { display: none; }
        
        input
        {
          background-color: #EEFFFF;
          font-size: 12px;
          font-family: geneva,arial,sans-serif;
          border-color: #0086B2;
          border-width: 1px;
          padding-left: 2px;
        }
        
        input.submit
        {
          background-color: #0086B2;
          font-size: 12px;
          font-family: geneva,arial,sans-serif;
          border-color: black;
          border-width: 1px;
          padding: 2px 6px;
          font-weight: bold;
          color: white;
        }
        
        input.button
        {
          background-color: #BB0000;
          font-size: 12px;
          font-family: geneva,arial,sans-serif;
          border-color: black;
          border-width: 1px;
          padding: 2px 6px;
          font-weight: bold;
          color: white;
        }
   </style>
   </head>
   <body>
  
    <div class="title">Wiki example</div>
  
    <p>
     <div class="block"><span class="tab">Preview</span><div class="content">
   <textfragment xmlns="http://chaperon.sourceforge.net/schema/textfragment/1.0"><xsp-request:get-parameter name="text" default="No text"/></textfragment>
     </div></div>
    </p>
  
    <p>
  
     <form action="wiki.html" method="post">
  
     <div class="block"><span class="tab">Content</span><div class="field">
  
     <textarea name="text" type="textarea" cols="100" rows="23" style="width: 100%">!Example heading
    
  !!bold and italics stuff
  Here's some __bold text__ and now &quot;some italic text I hope &quot;. Not
  sure about italics though.
  
  !!bullets
  * first bulleted item
  * second bulleted item
  
  !!numbered lists
  # number list point 1
  ## is that 1.1?
  ### is that 1.1.1?
  # this is point 2
  # and point 3
  
  We _love_ horizontal rules [1]
  ------------
  Brought to you by [http://www.perdu.com].
  
  [1] and footnotes too.
     </textarea><br/>
     </div></div>
  
     <div style="text-align:right" class="block">
     <input value="Preview" type="submit" class="submit"/>
     </div>
  
     </form>
    </p>
  
   </body>
  </html>
  
  </xsp:page>
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/webapp/mount/chaperon/stylesheets/java2html.xsl
  
  Index: java2html.xsl
  ===================================================================
  <?xml version="1.0"?>
  <xsl:stylesheet version="1.0"
                  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
                  xmlns:java="http://chaperon.sourceforge.net/grammar/java/1.0"
                  xmlns="http://www.w3.org/1999/xhtml">
  
   <xsl:output indent="no"/>
  
   <!--<xsl:strip-space elements="*"/>-->
   <xsl:param name="selected">MethodDeclaration</xsl:param>
  
   <xsl:template match="java:CompilationUnit" >
    <html>
     <head>
      <link rel="stylesheet" type="text/css" href="java.css" title="Style"/>
      <title>java2html example</title>
     </head>
     <body>
      <table id="Header" border="0" cellpadding="0" cellspacing="0" width="100%">
       <tr>
        <td colspan="2" width="33%">&#160;</td>
        <td align="center" colspan="2" width="33%">
         <font size="4">java2html example</font>
        </td>
        <td align="right" colspan="2" width="33%"></td>
       </tr>
      </table>
  <!--    <p>
       <form>
        <select size="1" name="selected">
         <option value=""><xsl:if test="$selected=''"><xsl:attribute name="selected"/></xsl:if>Nothing selected</option>
         <option value="QualifiedName"><xsl:if test="$selected='QualifiedName'"><xsl:attribute name="selected"/></xsl:if>Qualified name</option>
         <option value="FieldVariableDeclaration"><xsl:if test="$selected='FieldVariableDeclaration'"><xsl:attribute name="selected"/></xsl:if>Field variable declaration</option>
         <option value="MethodDeclaration"><xsl:if test="$selected='MethodDeclaration'"><xsl:attribute name="selected"/></xsl:if>Method declaration</option>
         <option value="SelectionStatement"><xsl:if test="$selected='SelectionStatement'"><xsl:attribute name="selected"/></xsl:if>Selection statement</option>
         <option value="IterationStatement"><xsl:if test="$selected='IterationStatement'"><xsl:attribute name="selected"/></xsl:if>Iteration statement</option>
         <option value="GuardingStatement"><xsl:if test="$selected='GuardingStatement'"><xsl:attribute name="selected"/></xsl:if>Guarding statement</option>
        </select>
       </form>
      </p>-->
      <pre id="Classes">
       <xsl:apply-templates/>
      </pre>
     </body>
    </html>
   </xsl:template>
  
   <xsl:template match="java:ABSTRACT">
    <font id="ABSTRACT"><xsl:apply-templates/></font>
   </xsl:template>
  
   <xsl:template match="java:BOOLEAN">
    <font id="BOOLEAN"><xsl:apply-templates/></font>
   </xsl:template>
  
   <xsl:template match="java:BREAK">
    <font id="BREAK"><xsl:apply-templates/></font>
   </xsl:template>
  
   <xsl:template match="java:BYTE">
    <font id="BYTE"><xsl:apply-templates/></font>
   </xsl:template>
  
   <xsl:template match="java:CASE">
    <font id="CASE"><xsl:apply-templates/></font>
   </xsl:template>
  
   <xsl:template match="java:CATCH">
    <font id="CATCH"><xsl:apply-templates/></font>
   </xsl:template>
  
   <xsl:template match="java:CHAR">
    <font id="CHAR"><xsl:apply-templates/></font>
   </xsl:template>
  
   <xsl:template match="java:CLASS">
    <font id="CLASS"><xsl:apply-templates/></font>
   </xsl:template>
  
   <xsl:template match="java:CONST">
    <font id="CONST"><xsl:apply-templates/></font>
   </xsl:template>
  
   <xsl:template match="java:CONTINUE">
    <font id="CONTINUE"><xsl:apply-templates/></font>
   </xsl:template>
  
   <xsl:template match="java:DEFAULT">
    <font id="DEFAULT"><xsl:apply-templates/></font>
   </xsl:template>
  
   <xsl:template match="java:DO">
    <font id="DO"><xsl:apply-templates/></font>
   </xsl:template>
  
   <xsl:template match="java:DOUBLE">
    <font id="DOUBLE"><xsl:apply-templates/></font>
   </xsl:template>
  
   <xsl:template match="java:ELSE">
    <font id="ELSE"><xsl:apply-templates/></font>
   </xsl:template>
  
   <xsl:template match="java:EXTENDS">
    <font id="EXTENDS"><xsl:apply-templates/></font>
   </xsl:template>
  
   <xsl:template match="java:FALSE">
    <font id="FALSE"><xsl:apply-templates/></font>
   </xsl:template>
  
   <xsl:template match="java:FINAL">
    <font id="FINAL"><xsl:apply-templates/></font>
   </xsl:template>
  
   <xsl:template match="java:FINALLY">
    <font id="FINALLY"><xsl:apply-templates/></font>
   </xsl:template>
  
   <xsl:template match="java:FLOAT">
    <font id="FLOAT"><xsl:apply-templates/></font>
   </xsl:template>
  
   <xsl:template match="java:FOR">
    <font id="FOR"><xsl:apply-templates/></font>
   </xsl:template>
  
   <xsl:template match="java:GOTO">
    <font id="GOTO"><xsl:apply-templates/></font>
   </xsl:template>
  
   <xsl:template match="java:IF">
    <font id="IF"><xsl:apply-templates/></font>
   </xsl:template>
  
   <xsl:template match="java:IMPLEMENTS">
    <font id="IMPLEMENTS"><xsl:apply-templates/></font>
   </xsl:template>
  
   <xsl:template match="java:IMPORT">
    <font id="IMPORT"><xsl:apply-templates/></font>
   </xsl:template>
  
   <xsl:template match="java:INSTANCEOF">
    <font id="INSTANCEOF"><xsl:apply-templates/></font>
   </xsl:template>
  
   <xsl:template match="java:INT">
    <font id="INT"><xsl:apply-templates/></font>
   </xsl:template>
  
   <xsl:template match="java:INTERFACE">
    <font id="INTERFACE"><xsl:apply-templates/></font>
   </xsl:template>
  
   <xsl:template match="java:LONG">
    <font id="LONG"><xsl:apply-templates/></font>
   </xsl:template>
  
   <xsl:template match="java:NATIVE">
    <font id="NATIVE"><xsl:apply-templates/></font>
   </xsl:template>
  
   <xsl:template match="java:NEW">
    <font id="NEW"><xsl:apply-templates/></font>
   </xsl:template>
  
   <xsl:template match="java:PACKAGE">
    <font id="PACKAGE"><xsl:apply-templates/></font>
   </xsl:template>
  
   <xsl:template match="java:PRIVATE">
    <font id="PRIVATE"><xsl:apply-templates/></font>
   </xsl:template>
  
   <xsl:template match="java:PROTECTED">
    <font id="PROTECTED"><xsl:apply-templates/></font>
   </xsl:template>
  
   <xsl:template match="java:PUBLIC">
    <font id="PUBLIC"><xsl:apply-templates/></font>
   </xsl:template>
  
   <xsl:template match="java:RETURN">
    <font id="RETURN"><xsl:apply-templates/></font>
   </xsl:template>
  
   <xsl:template match="java:SHORT">
    <font id="SHORT"><xsl:apply-templates/></font>
   </xsl:template>
  
   <xsl:template match="java:STATIC">
    <font id="STATIC"><xsl:apply-templates/></font>
   </xsl:template>
  
   <xsl:template match="java:SUPER">
    <font id="SUPER"><xsl:apply-templates/></font>
   </xsl:template>
  
   <xsl:template match="java:SWITCH">
    <font id="SWITCH"><xsl:apply-templates/></font>
   </xsl:template>
  
   <xsl:template match="java:SYCHRONIZED">
    <font id="SYCHRONIZED"><xsl:apply-templates/></font>
   </xsl:template>
  
   <xsl:template match="java:THIS">
    <font id="THIS"><xsl:apply-templates/></font>
   </xsl:template>
  
   <xsl:template match="java:THROW">
    <font id="THROW"><xsl:apply-templates/></font>
   </xsl:template>
  
   <xsl:template match="java:THROWS">
    <font id="THROWS"><xsl:apply-templates/></font>
   </xsl:template>
  
   <xsl:template match="java:TRANSIENT">
    <font id="TRANSIENT"><xsl:apply-templates/></font>
   </xsl:template>
  
   <xsl:template match="java:TRUE">
    <font id="TRUE"><xsl:apply-templates/></font>
   </xsl:template>
  
   <xsl:template match="java:TRY">
    <font id="TRY"><xsl:apply-templates/></font>
   </xsl:template>
  
   <xsl:template match="java:VOID">
    <font id="VOID"><xsl:apply-templates/></font>
   </xsl:template>
  
   <xsl:template match="java:VOLATILE">
    <font id="VOLATILE"><xsl:apply-templates/></font>
   </xsl:template>
  
   <xsl:template match="java:WHILE">
    <font id="WHILE"><xsl:apply-templates/></font>
   </xsl:template>
  
   <xsl:template match="java:LITERAL">
    <font id="LITERAL"><xsl:apply-templates/></font>
   </xsl:template>
  
   <xsl:template match="java:IDENTIFIER">
    <font id="IDENTIFIER"><xsl:apply-templates/></font> 
   </xsl:template>
  
   <xsl:template match="java:DOPEN">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:DCLOSE">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:COPEN">
    <xsl:apply-templates/>
   </xsl:template>
    
   <xsl:template match="java:CCLOSE">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:BOPEN">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:BCLOSE">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:SEMICOLON">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:COMMA">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:DOT">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:OP_EQ">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:OP_LE">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:OP_GE">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:OP_NE">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:OP_LOR">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:OP_LAND">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:OP_INC">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:OP_DEC">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:OP_SHR">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:OP_SHL">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:OP_SHRR">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:ASS_OP">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:EQ">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:GT">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:LT">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:NOT">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:TILDE">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:QM">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:COLON">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:PLUS">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:MINUS">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:MULT">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:DIV">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:AND">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:OR">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:XOR">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:MOD">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:BOOLLIT">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:eol">
    <xsl:text>
  </xsl:text>
   </xsl:template>
  
   <xsl:template match="java:whitespace">
    <!--<xsl:text><xsl:value-of select="."/></xsl:text>-->
    <xsl:value-of select="."/>
   </xsl:template>
  
   <xsl:template match="java:comment">
    <font id="MultiLineComment"><xsl:value-of select="."/></font>
   </xsl:template>
  
   <xsl:template match="java:TypeSpecifier">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:TypeName">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:ClassNameList">
    <xsl:apply-templates/>
   </xsl:template>
    
   <xsl:template match="java:PrimitiveType">
    <xsl:apply-templates/>
   </xsl:template>
    
   <xsl:template match="java:SemiColons">
    <xsl:apply-templates/>
   </xsl:template>
    
   <xsl:template match="java:ProgramFile">
    <xsl:apply-templates/>
   </xsl:template>
    
   <xsl:template match="java:PackageStatement">
    <xsl:apply-templates/>
   </xsl:template>
    
   <xsl:template match="java:TypeDeclarations">
    <xsl:apply-templates/>
   </xsl:template>
    
   <xsl:template match="java:TypeDeclarationOptSemi">
    <xsl:apply-templates/>
   </xsl:template>
    
   <xsl:template match="java:ImportStatements">
    <xsl:apply-templates/>
   </xsl:template>
    
   <xsl:template match="java:ImportStatement">
    <xsl:apply-templates/>
   </xsl:template>
    
   <xsl:template match="java:QualifiedName">
    <xsl:choose>
     <xsl:when test="$selected=local-name(.)">
      <span class="selected"><xsl:apply-templates/></span>
     </xsl:when>
     <xsl:otherwise>
      <xsl:apply-templates/>
     </xsl:otherwise>
    </xsl:choose>
   </xsl:template>
    
   <xsl:template match="java:TypeDeclaration">
    <xsl:apply-templates/>
   </xsl:template>
    
   <xsl:template match="java:ClassHeader">
    <xsl:apply-templates/>
   </xsl:template>
    
   <xsl:template match="java:Modifiers">
    <xsl:apply-templates/>
   </xsl:template>
    
   <xsl:template match="java:Modifier">
    <xsl:apply-templates/>
   </xsl:template>
    
   <xsl:template match="java:ClassWord">
    <xsl:apply-templates/>
   </xsl:template>
    
   <xsl:template match="java:Interfaces">
    <xsl:apply-templates/>
   </xsl:template>
    
   <xsl:template match="java:FieldDeclarations">
    <xsl:apply-templates/>
   </xsl:template>
    
   <xsl:template match="java:FieldDeclarationOptSemi">
    <xsl:apply-templates/>
   </xsl:template>
    
   <xsl:template match="java:FieldDeclaration">
    <xsl:apply-templates/>
   </xsl:template>
    
   <xsl:template match="java:FieldVariableDeclaration">
    <xsl:choose>
     <xsl:when test="$selected=local-name(.)">
      <span class="selected"><xsl:apply-templates/></span>
     </xsl:when>
     <xsl:otherwise>
      <xsl:apply-templates/>
     </xsl:otherwise>
    </xsl:choose>
   </xsl:template>
    
   <xsl:template match="java:VariableDeclarators">
    <xsl:apply-templates/>
   </xsl:template>
    
   <xsl:template match="java:VariableDeclarator">
    <xsl:apply-templates/>
   </xsl:template>
    
   <xsl:template match="java:VariableInitializer">
    <xsl:apply-templates/>
   </xsl:template>
    
   <xsl:template match="java:ArrayInitializers">
    <xsl:apply-templates/>
   </xsl:template>
    
   <xsl:template match="java:MethodDeclaration">
    <xsl:choose>
     <xsl:when test="$selected=local-name(.)">
      <span class="selected"><xsl:apply-templates/></span>
     </xsl:when>
     <xsl:otherwise>
      <xsl:apply-templates/>
     </xsl:otherwise>
    </xsl:choose>
   </xsl:template>
    
   <xsl:template match="java:MethodDeclarator">
    <xsl:apply-templates/>
   </xsl:template>
    
   <xsl:template match="java:ParameterList">
    <xsl:apply-templates/>
   </xsl:template>
    
   <xsl:template match="java:Parameter">
    <xsl:apply-templates/>
   </xsl:template>
    
   <xsl:template match="java:DeclaratorName">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:Throws">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:MethodBody">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:ConstructorDeclaration">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:ConstructorDeclarator">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:StaticInitializer">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:NonStaticInitializer">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:Extends">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:Block">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:LocalVariableDeclarationsAndStatements">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:LocalVariableDeclarationOrStatement">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:LocalVariableDeclarationStatement">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:Statement">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:EmptyStatement">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:LabelStatement">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:ExpressionStatement">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:SelectionStatement">
    <xsl:choose>
     <xsl:when test="$selected=local-name(.)">
      <span class="selected"><xsl:apply-templates/></span>
     </xsl:when>
     <xsl:otherwise>
      <xsl:apply-templates/>
     </xsl:otherwise>
    </xsl:choose>
   </xsl:template>
  
   <xsl:template match="java:IterationStatement">
    <xsl:choose>
     <xsl:when test="$selected=local-name(.)">
      <span class="selected"><xsl:apply-templates/></span>
     </xsl:when>
     <xsl:otherwise>
      <xsl:apply-templates/>
     </xsl:otherwise>
    </xsl:choose>
   </xsl:template>
  
   <xsl:template match="java:ForInit">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:ForExpr">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:ForIncr">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:ExpressionStatements">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:JumpStatement">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:GuardingStatement">
    <xsl:choose>
     <xsl:when test="$selected=local-name(.)">
      <span class="selected"><xsl:apply-templates/></span>
     </xsl:when>
     <xsl:otherwise>
      <xsl:apply-templates/>
     </xsl:otherwise>
    </xsl:choose>
   </xsl:template>
  
   <xsl:template match="java:Catches">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:Catch">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:CatchHeader">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:Finally">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:PrimaryExpression">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:NotJustName">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:ComplexPrimary">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:ComplexPrimaryNoParenthesis">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:ArrayAccess">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:FieldAccess">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:MethodCall">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:MethodAccess">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:SpecialName">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:ArgumentList">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:NewAllocationExpression">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:PlainNewAllocationExpression">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:ClassAllocationExpression">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:ArrayAllocationExpression">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:DimExprs">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:DimExpr">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:Dims">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:PostfixExpression">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:RealPostfixExpression">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:UnaryExpression">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:LogicalUnaryExpression">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:LogicalUnaryOperator">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:ArithmeticUnaryOperator">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:CastExpression">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:PrimitiveTypeExpression">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:ClassTypeExpression">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:MultiplicativeExpression">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:AdditiveExpression">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:ShiftExpression">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:RelationalExpression">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:EqualityExpression">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:AndExpression">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:ExclusiveOrExpression">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:InclusiveOrExpression">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:ConditionalAndExpression">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:ConditionalOrExpression">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:ConditionalExpression">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:AssignmentExpression">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:AssignmentOperator">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:Expression">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="java:ConstantExpression">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="@*|*|text()|processing-instruction()" priority="-1">
    <xsl:copy>
     <xsl:apply-templates select="@*|*|text()|processing-instruction()"/>
    </xsl:copy>
   </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/webapp/mount/chaperon/stylesheets/mathexp2html.xsl
  
  Index: mathexp2html.xsl
  ===================================================================
  <?xml version="1.0"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
                  xmlns:m="http://chaperon.sourceforge.net/grammar/mathexp/1.0"
                  xmlns="http://www.w3.org/1999/xhtml" version="1.0">
  
  
   <xsl:template match="m:E">
    <table bgcolor="#a0ffff" cellspacing="1">
     <tr>
      <xsl:for-each select="child::node()">
       <td>
        <xsl:apply-templates select="."/>
       </td>
      </xsl:for-each>
     </tr>
    </table>
   </xsl:template>
  
   <xsl:template match="m:F">
    <table bgcolor="#ffffa0" cellspacing="1">
     <tr>
      <xsl:for-each select="child::node()">
       <td>
        <xsl:apply-templates select="."/>
       </td>
      </xsl:for-each>
     </tr>
    </table>
   </xsl:template>
  
   <xsl:template match="m:T">
    <table bgcolor="#ffa0ff" cellspacing="1">
     <tr>
      <xsl:for-each select="child::node()">
       <td>
        <xsl:apply-templates select="."/>
       </td>
      </xsl:for-each>
     </tr>
    </table>
   </xsl:template>
  
   <xsl:template match="@*|*|text()|processing-instruction()" priority="-1">
    <xsl:copy>
     <xsl:apply-templates select="@*|*|text()|processing-instruction()"/>
    </xsl:copy>
   </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/webapp/mount/chaperon/stylesheets/parsefragment.xsl
  
  Index: parsefragment.xsl
  ===================================================================
  <?xml version="1.0"?>
  
  <xsl:stylesheet version="1.0" 
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:tf="http://chaperon.sourceforge.net/schema/textfragment/1.0">
  
   <xsl:param name="parse_element">math</xsl:param>
  
   <xsl:template match="*[name()=$parse_element]">
    <xsl:element name="{$parse_element}">
     <tf:textfragment>
      <xsl:value-of select="."/>
     </tf:textfragment>
    </xsl:element>
   </xsl:template>
  
    <xsl:template match="@*|*|text()|processing-instruction()" priority="-1">
      <xsl:copy>
        <xsl:apply-templates select="@*|*|text()|processing-instruction()"/>
      </xsl:copy>
    </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/webapp/mount/chaperon/stylesheets/rgrm2grm.xsl
  
  Index: rgrm2grm.xsl
  ===================================================================
  <?xml version="1.0"?>
  <xsl:stylesheet version="1.0"
                  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
                  xmlns:rgrm="http://chaperon.sourceforge.net/grammar/rgrm/1.0"
                  xmlns="http://chaperon.sourceforge.net/schema/grammar/1.0">
  
   <xsl:output indent="yes" method="xml" encoding="US-ASCII"/>
  
  <!-- <xsl:template match="/">
   </xsl:template>-->
  
   <xsl:template match="rgrm:grammar" >
    <grammar>
     <xsl:attribute name="uri"><xsl:value-of select="substring(rgrm:token_decls/rgrm:uri_decl/rgrm:string,2,
                           string-length(rgrm:token_decls/rgrm:uri_decl/rgrm:string)-2)"/></xsl:attribute>
     <tokens>
      <xsl:apply-templates select="rgrm:token_decls/rgrm:token_decl"/>
     </tokens>
  
     <ignorabletokens>
      <xsl:apply-templates select="rgrm:token_decls/rgrm:ignorabletoken_decl"/>
     </ignorabletokens>
  
     <xsl:apply-templates select="rgrm:production_decls"/>
  
     <xsl:apply-templates select="rgrm:token_decls/rgrm:start_decl"/>
    </grammar>
   </xsl:template>
  
   <xsl:template match="rgrm:token_decl" >
    <token>
     <xsl:if test="rgrm:token_decl = '%left'">
      <xsl:attribute name="assoc">left</xsl:attribute>
     </xsl:if>
     <xsl:if test="rgrm:token_decl = '%right'">
      <xsl:attribute name="assoc">right</xsl:attribute>
     </xsl:if>
     <xsl:attribute name="tsymbol"><xsl:value-of select="rgrm:id"/></xsl:attribute>
     <xsl:apply-templates select="rgrm:regexexpression"/>
    </token>
   </xsl:template>
  
   <xsl:template match="rgrm:ignorabletoken_decl" >
    <token>
     <xsl:attribute name="tsymbol"><xsl:value-of select="rgrm:id"/></xsl:attribute>
     <xsl:apply-templates select="rgrm:regexexpression"/>
    </token>
   </xsl:template>
  
   <xsl:template match="rgrm:regexexpression" >
    <xsl:apply-templates
      select="rgrm:regexalternation|rgrm:regexconcatenation|rgrm:regexklammer|rgrm:regexoptional|rgrm:regexstar|
              rgrm:regexplus|rgrm:regexvar|rgrm:string|rgrm:characterclass|rgrm:negatedcharacterclass|
              rgrm:regexdot|rgrm:regexbol|rgrm:regexeol|rgrm:regexabref"/>
   </xsl:template>
  
   <xsl:template match="rgrm:regexalternation" >
    <alt>
     <xsl:apply-templates
       select="rgrm:regexalternation|rgrm:regexconcatenation|rgrm:regexklammer|rgrm:regexoptional|rgrm:regexstar|
               rgrm:regexplus|rgrm:regexvar|rgrm:string|rgrm:characterclass|rgrm:negatedcharacterclass|rgrm:regexdot|rgrm:regexbol|rgrm:regexeol|rgrm:regexabref"/>
    </alt>
   </xsl:template>
  
   <xsl:template match="rgrm:regexconcatenation" >
    <concat>
     <xsl:apply-templates
       select="rgrm:regexalternation|rgrm:regexconcatenation|rgrm:regexklammer|rgrm:regexoptional|rgrm:regexstar|
               rgrm:regexplus|rgrm:regexvar|rgrm:string|rgrm:characterclass|rgrm:negatedcharacterclass|rgrm:regexdot|rgrm:regexbol|rgrm:regexeol|rgrm:regexabref"/>
    </concat>
   </xsl:template>
  
   <xsl:template match="rgrm:regexquantifier" >
    <xsl:apply-templates
      select="rgrm:regexalternation|rgrm:regexconcatenation|rgrm:regexklammer|rgrm:regexoptional|rgrm:regexstar|
              rgrm:regexplus|rgrm:regexvar|rgrm:string|rgrm:characterclass|rgrm:negatedcharacterclass|rgrm:regexdot|rgrm:regexbol|rgrm:regexeol|rgrm:regexabref"/>
   </xsl:template>
  
   <xsl:template match="rgrm:regexoptional" >
    <concat minOccurs="0" maxOccurs="1">
     <xsl:apply-templates
       select="rgrm:regexalternation|rgrm:regexconcatenation|rgrm:regexklammer|rgrm:regexoptional|rgrm:regexstar|
               rgrm:regexplus|rgrm:regexvar|rgrm:string|rgrm:characterclass|rgrm:negatedcharacterclass|rgrm:regexdot|rgrm:regexbol|rgrm:regexeol|rgrm:regexabref"/>
    </concat>
   </xsl:template>
  
   <xsl:template match="rgrm:regexstar" >
    <concat minOccurs="0" maxOccurs="*">
     <xsl:apply-templates
       select="rgrm:regexalternation|rgrm:regexconcatenation|rgrm:regexklammer|rgrm:regexoptional|rgrm:regexstar|
               rgrm:regexplus|rgrm:regexvar|rgrm:string|rgrm:characterclass|rgrm:negatedcharacterclass|rgrm:regexdot|rgrm:regexbol|rgrm:regexeol|rgrm:regexabref"/>
    </concat>
   </xsl:template>
  
   <xsl:template match="rgrm:regexplus" >
    <concat minOccurs="1" maxOccurs="*">
     <xsl:apply-templates
       select="rgrm:regexalternation|rgrm:regexconcatenation|rgrm:regexklammer|rgrm:regexoptional|rgrm:regexstar|
               rgrm:regexplus|rgrm:regexvar|rgrm:string|rgrm:characterclass|rgrm:negatedcharacterclass|rgrm:regexdot|rgrm:regexbol|rgrm:regexeol|rgrm:regexabref"/>
    </concat>
   </xsl:template>
  
   <xsl:template match="rgrm:regexvar" >
    <xsl:choose>
     <xsl:when test="count(rgrm:regexmultiplicator/rgrm:number)=2">
      <concat>
       <xsl:attribute name="minOccurs"><xsl:value-of select="rgrm:regexmultiplicator/rgrm:number[1]"/></xsl:attribute>
       <xsl:attribute name="maxOccurs"><xsl:value-of select="rgrm:regexmultiplicator/rgrm:number[2]"/></xsl:attribute>
       <xsl:apply-templates
         select="rgrm:regexalternation|rgrm:regexconcatenation|rgrm:regexklammer|rgrm:regexoptional|rgrm:regexstar|
                 rgrm:regexplus|rgrm:regexvar|rgrm:string|rgrm:characterclass|rgrm:negatedcharacterclass|rgrm:regexdot|rgrm:regexbol|rgrm:regexeol|rgrm:regexabref"/>
      </concat>
     </xsl:when>
     <xsl:otherwise>
      <concat>
       <xsl:attribute name="minOccurs"><xsl:value-of select="rgrm:regexmultiplicator/rgrm:number"/></xsl:attribute>
       <xsl:attribute name="maxOccurs"><xsl:value-of select="rgrm:regexmultiplicator/rgrm:number"/></xsl:attribute>
       <xsl:apply-templates
         select="rgrm:regexalternation|rgrm:regexconcatenation|rgrm:regexklammer|rgrm:regexoptional|rgrm:regexstar|
                 rgrm:regexplus|rgrm:regexvar|rgrm:string|rgrm:characterclass|rgrm:negatedcharacterclass|rgrm:regexdot|rgrm:regexbol|rgrm:regexeol|rgrm:regexabref"/>
      </concat>
     </xsl:otherwise>
    </xsl:choose>
   </xsl:template>
  
   <xsl:template match="rgrm:regexterm" >
    <xsl:apply-templates
      select="rgrm:regexalternation|rgrm:regexconcatenation|rgrm:regexklammer|rgrm:regexoptional|rgrm:regexstar|
              rgrm:regexplus|rgrm:regexvar|rgrm:string|rgrm:characterclass|rgrm:negatedcharacterclass|rgrm:regexabref"/>
   </xsl:template>
  
   <xsl:template match="rgrm:regexklammer" >
    <xsl:apply-templates
      select="rgrm:regexalternation|rgrm:regexconcatenation|rgrm:regexklammer|rgrm:regexoptional|rgrm:regexstar|
              rgrm:regexplus|rgrm:regexvar|rgrm:string|rgrm:characterclass|rgrm:negatedcharacterclass|rgrm:regexabref"/>
   </xsl:template>
  
   <xsl:template match="rgrm:regexdot" >
    <dot/>
   </xsl:template>
  
   <xsl:template match="rgrm:regexbol" >
    <bol/>
   </xsl:template>
  
   <xsl:template match="rgrm:regexeol" >
    <eol/>
   </xsl:template>
  
   <xsl:template match="rgrm:regexabref" >
    <xsl:variable name="ref" select="rgrm:id"/>
    <xsl:apply-templates select="/rgrm:grammar/rgrm:token_decls/rgrm:ab_decl[rgrm:id=$ref]/rgrm:regexexpression"/>
   </xsl:template>
  
   <!--<xsl:template match="string" >
    <string>
     <xsl:attribute name="content"><xsl:value-of select="translate(normalize-space(substring(., 2, string-length(.)-2)),' ', '')"/></xsl:attribute>
    </string>
   </xsl:template>-->
  
   <xsl:template match="rgrm:string" >
    <string>
     <xsl:attribute name="content"><xsl:apply-templates select="rgrm:character|rgrm:maskedcharacter" mode="string"/></xsl:attribute>
    </string>
   </xsl:template>
  
   <xsl:template match="rgrm:characterclass" >
    <cc>
     <xsl:apply-templates select="rgrm:character|rgrm:maskedcharacter|rgrm:intervall"/>
    </cc>
   </xsl:template>
  
   <xsl:template match="rgrm:negatedcharacterclass" >
    <ncc>
     <xsl:apply-templates select="rgrm:character|rgrm:maskedcharacter|rgrm:intervall"/>
    </ncc>
   </xsl:template>
  
   <xsl:template match="rgrm:character" >
    <cs>
     <xsl:attribute name="content"><xsl:value-of select="translate(normalize-space(.), ' ', '')"/></xsl:attribute>
    </cs>
   </xsl:template>
  
   <xsl:template match="rgrm:maskedcharacter" >
    <cs>
     <xsl:choose>
      <xsl:when test="substring(translate(normalize-space(.), ' ', ''), 2,1) = 'n'">
       <xsl:attribute name="content"><xsl:text disable-output-escaping="yes">&#10;</xsl:text></xsl:attribute>
      </xsl:when>
      <xsl:when test="substring(translate(normalize-space(.), ' ', ''), 2,1) = 'r'">
       <xsl:attribute name="content"><xsl:text disable-output-escaping="yes">&#13;</xsl:text></xsl:attribute>
      </xsl:when>
      <xsl:when test="substring(translate(normalize-space(.), ' ', ''), 2,1) = 't'">
       <xsl:attribute name="content"><xsl:text disable-output-escaping="yes">&#9;</xsl:text></xsl:attribute>
      </xsl:when>
      <xsl:when test="contains(.,'\ ')">
       <xsl:attribute name="content"><xsl:text disable-output-escaping="yes">&#32;</xsl:text></xsl:attribute>
      </xsl:when>
      <xsl:otherwise>
       <xsl:attribute name="content"><xsl:value-of select="substring(translate(normalize-space(.), ' ', ''), 2,1)"/></xsl:attribute>
      </xsl:otherwise>
     </xsl:choose>
    </cs>
   </xsl:template>
  
   <xsl:template match="rgrm:character" mode="string">
    <xsl:value-of select="translate(normalize-space(.), ' ', '')"/>
   </xsl:template>
   
   <xsl:template match="rgrm:maskedcharacter" mode="string">
    <xsl:choose>
      <xsl:when test="substring(translate(normalize-space(.), ' ', ''), 2,1) = 'n'">
       <xsl:text disable-output-escaping="yes">&#10;</xsl:text>
      </xsl:when>
      <xsl:when test="substring(translate(normalize-space(.), ' ', ''), 2,1) = 'r'">
       <xsl:text disable-output-escaping="yes">&#13;</xsl:text>
      </xsl:when>
      <xsl:when test="substring(translate(normalize-space(.), ' ', ''), 2,1) = 't'">
       <xsl:text disable-output-escaping="yes">&#9;</xsl:text>
      </xsl:when>
      <xsl:when test="contains(.,'\ ')">
       <xsl:text disable-output-escaping="yes">&#32;</xsl:text>
      </xsl:when>
      <xsl:otherwise>
       <xsl:value-of select="substring(translate(normalize-space(.), ' ', ''),2,1)"/>
      </xsl:otherwise>
     </xsl:choose>
   </xsl:template>
  
   <xsl:template match="rgrm:intervall" >
    <ci>
     <xsl:attribute name="min"><xsl:value-of select="rgrm:character[1]"/></xsl:attribute>
     <xsl:attribute name="max"><xsl:value-of select="rgrm:character[2]"/></xsl:attribute>
    </ci>
   </xsl:template>
  
   <xsl:template match="rgrm:comment_decl" >
    <comment>
     <xsl:apply-templates select="rgrm:regexexpression"/>
    </comment>
   </xsl:template>
  
   <xsl:template match="rgrm:whitespace_decl" >
    <whitespace>
     <xsl:apply-templates select="rgrm:regexexpression"/>
    </whitespace>
   </xsl:template>
  
   <xsl:template match="rgrm:production_decls" >
    <productions>
     <xsl:for-each select="rgrm:production_decl/rgrm:production_defs/rgrm:production_def">
      <production>
       <xsl:attribute name="ntsymbol"><xsl:value-of select="../../rgrm:id"/></xsl:attribute>
       
       <xsl:choose>
        <xsl:when test="rgrm:reducetype_decl[.='%append']">
         <xsl:attribute name="reducetype">append</xsl:attribute>
        </xsl:when>
        <xsl:when test="rgrm:reducetype_decl[.='%resolve']">
         <xsl:attribute name="reducetype">resolve</xsl:attribute>
        </xsl:when>
        <xsl:when test="rgrm:reducetype_decl[.='%neglect']">
         <xsl:attribute name="reducetype">neglect</xsl:attribute>
        </xsl:when>
       </xsl:choose>
  
       <xsl:if test="rgrm:prec_decl">
        <xsl:attribute name="prec"><xsl:value-of select="rgrm:prec_decl/rgrm:id"/></xsl:attribute>
       </xsl:if>
  
       <xsl:apply-templates select="rgrm:ids/rgrm:id"/>
      </production>
     </xsl:for-each>
    </productions>
   </xsl:template>
  
   <xsl:template match="rgrm:id" >
    <xsl:variable name="symbol" select="text()"/>
    <xsl:choose>
     <xsl:when test="/rgrm:grammar/rgrm:token_decls/rgrm:token_decl/rgrm:id[.=$symbol]">
      <tsymbol>
       <xsl:attribute name="name"><xsl:value-of select="."/></xsl:attribute>
      </tsymbol>
     </xsl:when>
     <xsl:otherwise>
      <ntsymbol>
        <xsl:attribute name="name"><xsl:value-of select="."/></xsl:attribute>
      </ntsymbol>
     </xsl:otherwise>
    </xsl:choose>
   </xsl:template>
  
   <xsl:template match="rgrm:start_decl" >
    <ssymbol>
     <xsl:attribute name="ntsymbol"><xsl:value-of select="rgrm:id"/></xsl:attribute>
    </ssymbol>
   </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/webapp/mount/chaperon/stylesheets/wiki2html.xsl
  
  Index: wiki2html.xsl
  ===================================================================
  <?xml version="1.0"?>
  <xsl:stylesheet version="1.0"
                  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
                  xmlns:wiki="http://chaperon.sourceforge.net/grammar/wiki/1.0"
                  xmlns="http://www.w3.org/1999/xhtml">
  
   <xsl:output indent="yes" method="html"/>
  
   <xsl:template match="/">
    <xsl:choose>
     <xsl:when test="wiki:wiki">
      <html>
       <head>
        <title>Wiki example</title>
       </head>
       <body>
        <xsl:apply-templates select="wiki:wiki/wiki:paragraphs/wiki:paragraph"/>
       </body>
      </html>   
     </xsl:when>
     <xsl:otherwise>
      <xsl:apply-templates/>
     </xsl:otherwise>
    </xsl:choose>
   </xsl:template>
  
   <xsl:template match="//wiki">
    <div style="background: #b9d3ee; border: thin; border-color: black; border-style: solid; padding-left: 0.8em; 
                 padding-right: 0.8em; padding-top: 0px; padding-bottom: 0px; margin: 0.5ex 0px; clear: both;">
     <xsl:apply-templates select="paragraphs/paragraph"/>
    </div>
   </xsl:template>
  
   <xsl:template match="wiki:paragraph" >
    <xsl:apply-templates select="wiki:bulletedlist|wiki:numberedlist1|wiki:numberedlist2|wiki:numberedlist3|wiki:headitem|wiki:footnote|wiki:textitem|wiki:LINE"/>
   </xsl:template>
  
   <xsl:template match="wiki:textitem" >
    <p>
     <xsl:apply-templates select="wiki:firstblock|wiki:textblock"/>
    </p>
   </xsl:template>
  
   <xsl:template match="wiki:textblock" >
    <xsl:apply-templates select="wiki:LINK|wiki:boldblock|wiki:italicblock|wiki:underlineblock|wiki:TEXT|wiki:note"/>
   </xsl:template>
  
   <xsl:template match="wiki:firstblock" >
    <xsl:apply-templates select="wiki:LINK|wiki:boldblock|wiki:italicblock|wiki:underlineblock|wiki:TEXT"/>
   </xsl:template>
  
   <xsl:template match="wiki:LINE" >
    <hr/>
   </xsl:template>
  
   <xsl:template match="wiki:bulletedlist" >
    <ul>
     <xsl:apply-templates select="wiki:bulletedlistitem"/>
    </ul>
   </xsl:template>
  
   <xsl:template match="wiki:bulletedlistitem" >
    <li>
     <xsl:apply-templates select="wiki:textblock"/>
    </li>
   </xsl:template>
  
   <xsl:template match="wiki:numberedlist1" >
    <ol>
     <xsl:apply-templates select="wiki:numberedlistitem1|wiki:numberedlist2"/>
    </ol>
   </xsl:template>
  
   <xsl:template match="wiki:numberedlistitem1" >
    <li>
     <xsl:apply-templates select="wiki:textblock"/>
    </li>
   </xsl:template>
  
   <xsl:template match="wiki:numberedlist2" >
    <ol>
     <xsl:apply-templates select="wiki:numberedlistitem2|wiki:numberedlist3"/>
    </ol>
   </xsl:template>
      
   <xsl:template match="wiki:numberedlistitem2" >
    <li>
     <xsl:apply-templates select="wiki:textblock"/>
    </li>
   </xsl:template>
  
   <xsl:template match="wiki:numberedlist3" >
    <ol>
     <xsl:apply-templates select="wiki:numberedlistitem3"/>
    </ol>
   </xsl:template>
      
   <xsl:template match="wiki:numberedlistitem3" >
    <li>
     <xsl:apply-templates select="wiki:textblock"/>
    </li>
   </xsl:template>
  
   <xsl:template match="wiki:headitem" >
    <xsl:choose>
     <xsl:when test="string-length(wiki:HEAD)=2">
      <h2>
       <xsl:apply-templates select="wiki:textblock"/>
      </h2>
     </xsl:when>
     <xsl:when test="string-length(wiki:HEAD)=3">
      <h3>
       <xsl:apply-templates select="wiki:textblock"/>
      </h3>
     </xsl:when>
     <xsl:otherwise>
      <h1>
       <xsl:apply-templates select="wiki:textblock"/>
      </h1>
     </xsl:otherwise>
    </xsl:choose>
   </xsl:template>
  
   <xsl:template match="wiki:footnote" >
    <a name="{normalize-space(wiki:note/wiki:TEXT|wiki:note/wiki:LINK)}">
     [<xsl:apply-templates select="wiki:note/wiki:TEXT|wiki:note/wiki:LINK"/>]
     <xsl:apply-templates select="wiki:textblock"/>
    </a>
   </xsl:template>
  
   <xsl:template match="wiki:LINK" >
    <a href="{normalize-space(.)}">
     <xsl:value-of select="."/>
    </a>
   </xsl:template>
  
   <xsl:template match="wiki:boldblock" >
    <b>
     <xsl:value-of select="wiki:TEXT"/>
    </b>
   </xsl:template>
  
   <xsl:template match="wiki:italicblock" >
    <i>
     <xsl:value-of select="wiki:TEXT"/>
    </i>
   </xsl:template>
  
   <xsl:template match="wiki:underlineblock" >
    <u>
     <xsl:value-of select="wiki:TEXT"/>
    </u><xsl:text> </xsl:text>
   </xsl:template>
  
   <xsl:template match="wiki:note" >
    <a href="#{normalize-space(wiki:TEXT|wiki:LINK)}">
     [<xsl:apply-templates select="wiki:TEXT|wiki:LINK"/>]
    </a>
   </xsl:template>
  
   <xsl:template match="wiki:TEXT" >
    <xsl:value-of select="."/>
   </xsl:template>
  
   <xsl:template match="@*|*|text()|processing-instruction()" priority="-1">
    <xsl:copy>
     <xsl:apply-templates select="@*|*|text()|processing-instruction()"/>
    </xsl:copy>
   </xsl:template>
  
  </xsl:stylesheet>
  
  
  

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


Mime
View raw message