cziegeler    2002/07/01 03:04:18

  Modified:    src/webapp sitemap.xmap
               src/webapp/docs/samples samples.xml
               src/webapp/samples samples.xml sitemap.xmap
               src/webapp/welcome welcome.xhtml
  Added:       src/webapp/samples/search create-index.xsp search-index.xsp
                        sitemap.xmap statistic-index.xsp welcome-index.xsp
               src/webapp/samples/search/images lucene_green_300.gif
               src/webapp/samples/search/stylesheets search2html.xsl
               src/webapp/samples/sub sitemap.xmap
               src/webapp/samples/sub/docs dynamic.xsp
                        error-giving-page.xml samples.xml simple.xml
                        simple.xsp
  Removed:     src/webapp/search create-index.xsp search-index.xsp
                        sitemap.xmap statistic-index.xsp welcome-index.xsp
               src/webapp/search/images lucene_green_300.gif
               src/webapp/search/stylesheets search2html.xsl
               src/webapp/sub sitemap.xmap
               src/webapp/sub/docs dynamic.xsp error-giving-page.xml
                        samples.xml simple.xml simple.xsp
               src/webapp/sub/stylesheets dynamic-xsp2xsp.xsl
                        error2html.xsl simple-page2html.xsl
                        simple-page2html.xsp simple-samples2html.xsl
  Log:
  Moved sub and search samples
  
  Revision  Changes    Path
  1.64      +0 -50     xml-cocoon2/src/webapp/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/webapp/sitemap.xmap,v
  retrieving revision 1.63
  retrieving revision 1.64
  diff -u -r1.63 -r1.64
  --- sitemap.xmap      30 Jun 2002 17:00:44 -0000      1.63
  +++ sitemap.xmap      1 Jul 2002 10:04:16 -0000       1.64
  @@ -474,56 +474,6 @@
       </map:match>
     </map:pipeline>
   
  -  <!-- sub-sitemap example pipeline -->
  -  <map:pipeline>
  -    <!-- Matcher: -->
  -    <map:match pattern="sub/**">
  -      <!--
  -        matches all URIs starting with "sub". Have a look at
  -        the docs for this matcher component. 
  -        
  -        "*" means, anything that does not contain a path separator,
  -        i.e. slash "/", "**" means anything including path
  -        separators. What is matched by the wildcard is put into sitemap
  -        variables.
  -        
  -        Sitemap variables are organized like a stack, a new set is placed
  -        on top of the already present ones. Any existing variable can be
  -        accessed through a simplified path expression. These simplified
  -        path expression may only use any number of "../" to refer to the
  -        previous levels.
  -        
  -        If a component completes successfully, it sets some sitemap
  -        variables. Their scope is only within the element of that
  -        component. Thus they can only be accessed by nested components.
  -      -->
  -        
  -      <!-- Mount: -->
  -      <map:mount check-reload="yes" src="sub/sitemap.xmap" uri-prefix="sub"/>
  -      <!--
  -        Sitemaps may be organized hierarchically. Here such a subsitemap
  -        is "mounted" (think: unix filesystems) to be responsible for all
  -        URIs starting with "sub/". The file itself is by
  -        coincidence located in a subdirectory named "sub/" as
  -        well. There's no need to do that but it is good practice. The
  -        check-reload attributes specifies, if changed to the subsitemap
  -        should result in cocoon rereading the subsitemap or if they are to
  -        be ignored. See docs for suggestions on this.
  -      
  -        Note here, that all component declarations are inherited to a
  -        subsitemap.
  -      -->
  -    </map:match>
  -
  -    <map:handle-errors>
  -      <!-- 
  -        This pipeline specifies a different error handler.
  -      -->
  -      <map:transform src="stylesheets/system/error2html.xsl"/>
  -      <map:serialize status-code="500"/>
  -    </map:handle-errors>
  -  </map:pipeline>
  -
     <!-- Cocoon documentation pipeline -->
     <map:pipeline>
       <map:match pattern="documents/index">
  
  
  
  1.15      +3 -3      xml-cocoon2/src/webapp/docs/samples/samples.xml
  
  Index: samples.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/webapp/docs/samples/samples.xml,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- samples.xml       13 Jun 2002 10:31:23 -0000      1.14
  +++ samples.xml       1 Jul 2002 10:04:17 -0000       1.15
  @@ -39,7 +39,7 @@
      <sample name="Slides" href="slides/slides">
       Presentation of Cocoon 1 shown at ApacheCon 2000. (Example of complex XSLT 
usage)
      </sample>
  -   <sample name="Search the docs" href="search/welcome">
  +   <sample name="Search the docs" href="samples/search/welcome">
       Search into the cocoon documentation using Apache Lucene.
      </sample>
     </group>
  @@ -65,7 +65,7 @@
       This is a demo of the portal framework integrated into Cocoon.
      </sample>
   
  -   <sample name="Sources" href="sub/">
  +   <sample name="Sources" href="samples/sub/">
       Samples showing possible ways how to use Cocoon sources in sitemap.
       (These samples are served by sub-sitemap)
      </sample>
  
  
  
  1.13      +2 -2      xml-cocoon2/src/webapp/samples/samples.xml
  
  Index: samples.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/webapp/samples/samples.xml,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- samples.xml       17 Jun 2002 09:11:07 -0000      1.12
  +++ samples.xml       1 Jul 2002 10:04:17 -0000       1.13
  @@ -101,7 +101,7 @@
      <sample name="Slides" href="slides/slides">
       Presentation of Cocoon 1 shown at ApacheCon 2000. (Example of complex XSLT 
usage)
      </sample>
  -   <sample name="Search the docs" href="../search/welcome">
  +   <sample name="Search the docs" href="search/welcome">
       Search into the cocoon documentation using Apache Lucene.
      </sample>
      <sample name="Check links" href="linkstatus/">
  
  
  
  1.6       +50 -0     xml-cocoon2/src/webapp/samples/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/webapp/samples/sitemap.xmap,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- sitemap.xmap      19 May 2002 19:22:43 -0000      1.5
  +++ sitemap.xmap      1 Jul 2002 10:04:17 -0000       1.6
  @@ -41,6 +41,56 @@
   <!-- =========================== Pipelines ================================= -->
   
    <map:pipelines>
  +  <!-- sub-sitemap example pipeline -->
  +  <map:pipeline>
  +    <!-- Matcher: -->
  +    <map:match pattern="sub/**">
  +      <!--
  +        matches all URIs starting with "sub". Have a look at
  +        the docs for this matcher component. 
  +        
  +        "*" means, anything that does not contain a path separator,
  +        i.e. slash "/", "**" means anything including path
  +        separators. What is matched by the wildcard is put into sitemap
  +        variables.
  +        
  +        Sitemap variables are organized like a stack, a new set is placed
  +        on top of the already present ones. Any existing variable can be
  +        accessed through a simplified path expression. These simplified
  +        path expression may only use any number of "../" to refer to the
  +        previous levels.
  +        
  +        If a component completes successfully, it sets some sitemap
  +        variables. Their scope is only within the element of that
  +        component. Thus they can only be accessed by nested components.
  +      -->
  +        
  +      <!-- Mount: -->
  +      <map:mount check-reload="yes" src="sub/sitemap.xmap" uri-prefix="sub"/>
  +      <!--
  +        Sitemaps may be organized hierarchically. Here such a subsitemap
  +        is "mounted" (think: unix filesystems) to be responsible for all
  +        URIs starting with "sub/". The file itself is by
  +        coincidence located in a subdirectory named "sub/" as
  +        well. There's no need to do that but it is good practice. The
  +        check-reload attributes specifies, if changed to the subsitemap
  +        should result in cocoon rereading the subsitemap or if they are to
  +        be ignored. See docs for suggestions on this.
  +      
  +        Note here, that all component declarations are inherited to a
  +        subsitemap.
  +      -->
  +    </map:match>
  +
  +    <map:handle-errors>
  +      <!-- 
  +        This pipeline specifies a different error handler.
  +      -->
  +      <map:transform src="../stylesheets/system/error2html.xsl"/>
  +      <map:serialize status-code="500"/>
  +    </map:handle-errors>
  +  </map:pipeline>
  +
     <map:pipeline>
   
      <map:match pattern="">
  
  
  
  1.1                  xml-cocoon2/src/webapp/samples/search/create-index.xsp
  
  Index: create-index.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";>
  
    <xsp:structure>
     <xsp:include>org.apache.avalon.framework.context.ContextException</xsp:include>
     
<xsp:include>org.apache.avalon.framework.component.ComponentException</xsp:include>
     <xsp:include>org.apache.cocoon.ProcessingException</xsp:include>
     <xsp:include>java.net.URL</xsp:include>
     <xsp:include>java.net.MalformedURLException</xsp:include>
     
<xsp:include>org.apache.cocoon.components.language.markup.xsp.XSPUtil</xsp:include>
     <xsp:include>org.apache.avalon.framework.context.ContextException</xsp:include>
     <xsp:include>org.apache.cocoon.components.search.*</xsp:include>
     <xsp:include>org.apache.lucene.store.Directory</xsp:include>
     <xsp:include>org.apache.lucene.analysis.Analyzer</xsp:include>
    </xsp:structure>
  
    <xsp:logic>
    File workDir = null;
    /** Contextualize this class */
    public void contextualize(Context context) throws ContextException {
      super.contextualize( context );
      workDir = (File) context.get(Constants.CONTEXT_WORK_DIR);
    }
    
    LuceneCocoonIndexer lcii;
    Analyzer analyzer = LuceneCocoonHelper.getAnalyzer( 
"org.apache.lucene.analysis.standard.StandardAnalyzer" );
    
    void createIndex(String baseURL, boolean create) throws ProcessingException {
      try {
        
        lcii = (LuceneCocoonIndexer)this.manager.lookup( LuceneCocoonIndexer.ROLE );
        Directory directory = LuceneCocoonHelper.getDirectory( new File( workDir, 
"index" ), create );
        lcii.setAnalyzer( analyzer );
        // "http://localhost:8080/cocoon/documents/index.html";
        URL base_url = new URL( baseURL );
        lcii.index( directory, create, base_url );
      } catch (MalformedURLException mue) {
        throw new ProcessingException( "MalformedURLException in createIndex()!", mue 
);
      } catch (IOException ioe) {
        // ignore ??
        throw new ProcessingException( "IOException in createIndex()!", ioe );
      } catch (ComponentException ce) {
        // ignore ??
        throw new ProcessingException( "ComponentException in createIndex()!", ce );
      } finally {
        if (lcii != null) {
          this.manager.release( lcii );
        }
        lcii = null;
      }
    }
  
    </xsp:logic>
  
    <page>
      <xsp:logic>
        boolean create;
        String createParam = <xsp-request:get-parameter name="create" />;
        if (createParam == null) {
          create = false;
        } else {
          create = true;
        }
        
        String baseURL = <xsp-request:get-parameter name="baseURL" />;
        if (baseURL != null &amp;&amp; baseURL.length() > 0) {
          createIndex(baseURL, create );
        }
        if (baseURL == null || baseURL.length() &lt; 1) {
          baseURL = 
            "http://"; + 
            <xsp-request:get-server-name/> +
            ":" + <xsp-request:get-server-port/> +
            <xsp-request:get-context-path/> + "/" + "documents/index.html";
        }
      </xsp:logic>
      <content>
        <h1>Create a Lucene search index</h1>
        <para>
          This process might take some time (follow the tail of your logfiles
          to see the indexer in progress).
          <ul>
            <li>LuceneCocoonIndexer.ROLE <xsp:expr>LuceneCocoonIndexer.ROLE</xsp:expr>
            </li>
            <li>context-path <xsp-request:get-context-path/>
            </li>
            <li>baseURL <xsp:expr>baseURL</xsp:expr>
            </li>
            <li>create <xsp:expr>String.valueOf(createParam)</xsp:expr>,
              <xsp:expr>String.valueOf( create )</xsp:expr>
            </li>
            <li>get-uri <xsp-request:get-uri/>
            </li>
            <li>get-sitemap-uri <xsp-request:get-sitemap-uri/>
            </li>
          </ul>
  
          <form action="create">
          <table>
            <tr>
              <td>BaseURL</td>
              <td>
                <input type="text" name="baseURL" size="60">
                  <xsp:attribute 
name="value"><xsp:expr>baseURL</xsp:expr></xsp:attribute>
                </input>
              </td>
            </tr>
            <tr>
              <td colspan="2">
                <input type="radio" name="create" value="true" checked="checked"/>
                Create/Overwrite the Index, or
                <input type="radio" name="create" value="false"/>
                Update the existing Index
              </td>
            </tr>
            <tr>
              <td colspan="2">
                <input type="submit" name="find" value="Create"/>
              </td>
            </tr>
          </table>
          </form>
  
        </para>
      </content>
    </page>
  
  </xsp:page>
  
  
  
  
  1.1                  xml-cocoon2/src/webapp/samples/search/search-index.xsp
  
  Index: search-index.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";>
  
    <xsp:structure>
      <xsp:include>org.apache.avalon.framework.context.ContextException</xsp:include>
      
<xsp:include>org.apache.avalon.framework.component.ComponentException</xsp:include>
      
      <xsp:include>org.apache.cocoon.ProcessingException</xsp:include>
      
<xsp:include>org.apache.cocoon.components.language.markup.xsp.XSPUtil</xsp:include>
      
      <xsp:include>org.apache.cocoon.components.search.*</xsp:include>
      
      <xsp:include>org.apache.lucene.analysis.Analyzer</xsp:include>
      <xsp:include>org.apache.lucene.store.*</xsp:include>
      <xsp:include>org.apache.lucene.document.*</xsp:include>
      <xsp:include>org.apache.lucene.search.Hits</xsp:include>
      
      <xsp:include>java.util.*</xsp:include>
      
    </xsp:structure>
  
    <xsp:logic>
      File workDir = null;
      /** Contextualize this class */
      public void contextualize(Context context) throws ContextException {
        super.contextualize( context );
        workDir = (File) context.get(Constants.CONTEXT_WORK_DIR);
      }
      
      LuceneCocoonSearcher lcs;
      Directory directory;
      Analyzer analyzer = LuceneCocoonHelper.getAnalyzer( 
"org.apache.lucene.analysis.standard.StandardAnalyzer" );
    
      Hits search( String query_string ) throws ProcessingException {
        Hits hits = null;
        try {
          lcs = (LuceneCocoonSearcher)this.manager.lookup( LuceneCocoonSearcher.ROLE );
          lcs.setAnalyzer( analyzer );
          if (directory == null) {
            directory = LuceneCocoonHelper.getDirectory( new File( workDir, "index" ), 
false );
          }
          lcs.setDirectory( directory );
          hits = lcs.search( query_string, LuceneXMLIndexer.BODY_FIELD );
          start = 0;
          end = Math.min(hits.length(), start + hitsPerPage);
        } catch (IOException ioe) {
          // ignore ??
          throw new ProcessingException( "IOException in search", ioe );
        } catch (ProcessingException pe) {
          // ignore ??
          Throwable t = pe.getCause();
          if (t instanceof org.apache.lucene.queryParser.ParseException) {
            // ignore it or write info about reason
          } else {
            throw new ProcessingException( "ProcessingException in search", pe );
          }
        } catch (ComponentException ce) {
          // ignore ??
          throw new ProcessingException( "ComponentException in search", ce );
        } finally {
          if (lcs != null) {
            this.manager.release( lcs );
          }
          lcs = null;
        }
        
        return hits;
      }
      int hitsPerPage = 10;
      int start = 0;
      int end = 0; 
      Hits hits;
      LuceneCocoonPager luceneCocoonPager;
    </xsp:logic>
  
    <page>
      <xsp:logic>
        String queryString = <xsp-request:get-parameter name="queryString" 
default=""/>;
        boolean findIt = "Find!".equals( <xsp-request:get-parameter name="find"/> );
        Integer startIndex = null;
        Integer pageLength = null;
        try {
          if (<xsp-request:get-parameter name="previous"/> != null) {
            startIndex = new Integer( <xsp-request:get-parameter 
name="startPreviousIndex" default="0"/> );
          } else if (<xsp-request:get-parameter name="next"/> != null) {
            startIndex = new Integer( <xsp-request:get-parameter 
name="startNextIndex"/> );
          } else {
            startIndex = new Integer( 0 );
          }
          pageLength = new Integer( <xsp-request:get-parameter name="pageLength" 
default="10"/> );
        } catch (NumberFormatException nfe) {
          // ignore it
        }
      </xsp:logic>
      
      <title>Cocoon XML Search Interface</title>
      <content>
        <a href="http://jakarta.apache.org/lucene/";><img border="0" alt="Lucene Logo" 
src="images/lucene_green_300.gif"/></a>
        <para>
          <font size="-1">
            <a target="_blank" href="statistic">Index Statistics</a> |
            <a href="welcome">Welcome</a>
          </font>
        </para>
        <para>
          <form action="search">
            <input type="text" name="queryString" size="60">
              <xsp:attribute 
name="value"><xsp:expr>queryString</xsp:expr></xsp:attribute>
            </input>
            <input type="submit" name="find" value="Find!"/>
          </form>
        </para>
        <para>
          Help by example (see also the
          <a href="http://www.lucene.com/cgi-bin/faq/faqmanager.cgi";>Lucene FAQ</a>)
          <table cellspacing="2" cellpadding="2">
            <tr bgcolor="#dddedd" valign="top">
            <td width="50%"><font size="-2" >
              <ul>
                <li>free AND "text search"
                  Search for documents which contain the word "free" and the 
                  phrase "text search"
                </li>
                <li>+text search
                  Search for documents which must contain the word "text" and 
                  optionally contain the word "search".
                </li>
                <li>giants -football
                  Search for "giants" but omit documents containing "football"
                </li>
              </ul>
            </font></td>
            
            <td><font size="-2">
              <ul>
                <li>body:john
                  Search for documents containing "john" in the  body field.
                  The field "body" is used by default.
                  Thus query "body:john" is equivalent to query "john".
                </li>
                <li>s1@title:cocoon
                  Search for documents containing "cocoon" in the
                  using field s1@title, ie searching in
                  title attribute of s1 element of xml document.
                </li>
              </ul>
            </font></td>
            </tr>
          </table>
        </para>
        <para>
          SearchResult:
          <xsp:logic>
            if (queryString != null &amp;&amp; queryString.length() != 0) {
              
              // do the search, search results are available in hits
              hits = search( queryString );
              luceneCocoonPager = new LuceneCocoonPager( hits );
              if (startIndex != null &amp;&amp; pageLength != null) {
                luceneCocoonPager.setStartIndex( startIndex.intValue() );
                luceneCocoonPager.setCountOfHitsPerPage( pageLength.intValue() );
              }
              <xsp:content>
                Total Hits: <xsp:expr>hits.length()</xsp:expr>
              </xsp:content>
            }
          </xsp:logic>
        </para>
        <para>
          <table width="90%" cellpadding="4" border="1">
            <tr>
              <td>Score</td><td>Count</td><td>URL</td>
            </tr>
            <xsp:logic>
              if (luceneCocoonPager!= null &amp;&amp; luceneCocoonPager.hasNext()) {
                int counter = luceneCocoonPager.getStartIndex();
                List l = (List)luceneCocoonPager.next();
                Iterator i = l.iterator();
                for (; i.hasNext(); counter++) {
                  LuceneCocoonPager.HitWrapper hw = 
(LuceneCocoonPager.HitWrapper)i.next();
                  Document doc = hw.getDocument();
                  float score = hw.getScore();
                  String url = doc.get( LuceneXMLIndexer.URL_FIELD );
                  
                  <xsp:content>
                    <tr>
                      <td> <xsp:expr>String.valueOf((int)(score * 100.0f))</xsp:expr>% 
</td> 
                      <td> <xsp:expr>String.valueOf(counter + 1)</xsp:expr> </td>
                      <td>
                        <a target="_blank">
                          <xsp:attribute 
name="href"><xsp:expr>url</xsp:expr></xsp:attribute>
                          <xsp:expr>url</xsp:expr>
                        </a>
                      </td>
                    </tr>
                  </xsp:content>
                }
              }
            </xsp:logic>
          </table>
        </para>
        <para>
          <xsp:logic>
            if (luceneCocoonPager!= null &amp;&amp; luceneCocoonPager != null 
&amp;&amp; 
              (luceneCocoonPager.hasNext() || luceneCocoonPager.hasPrevious())) {
              <xsp:content>
                <form action="search">
                  <input type="hidden" name="queryString">
                    <xsp:attribute 
name="value"><xsp:expr>String.valueOf(queryString)</xsp:expr></xsp:attribute>
                  </input>
                  <input type="hidden" name="pageLength">
                    <xsp:attribute 
name="value"><xsp:expr>String.valueOf(luceneCocoonPager.getCountOfHitsPerPage())</xsp:expr></xsp:attribute>
                  </input>
                  <xsp:logic>
                    if (luceneCocoonPager.hasPrevious()) {
                      <input type="hidden" name="startPreviousIndex">
                        <xsp:attribute 
name="value"><xsp:expr>String.valueOf(luceneCocoonPager.previousIndex())</xsp:expr></xsp:attribute>
                      </input>
                      <input type="submit" name="previous" value="previous"/>
                    }
                  </xsp:logic>
                  &#160;
                  <xsp:logic>
                    if (luceneCocoonPager.hasNext()) {
                      <input type="hidden" name="startNextIndex">
                        <xsp:attribute 
name="value"><xsp:expr>String.valueOf(luceneCocoonPager.nextIndex())</xsp:expr></xsp:attribute>
                      </input>
                      <input type="submit" name="next" value="next"/>
                    }
                  </xsp:logic>
                </form>
              </xsp:content>
            }
          </xsp:logic>
        </para>
      </content>
    </page>
  
  </xsp:page>
  
  
  
  
  1.1                  xml-cocoon2/src/webapp/samples/search/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  <?xml version="1.0"?>
  
  <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0";>
  <!-- 
     This is the 'heart' of Cocoon. The sitemap maps URI space to 
     resources. It consists basicly of two parts: components and
     pipelines. Pipelines are made out of components. There is such a
     vast number of components available that it would be impossible to
     describe them here, please refer to the accompanying
     documentation. For specific components, have a look also at the
     javadocs for them. Most pipelines are present to demonstrate some
     feature or technique, often they are explained in more detail in 
     the accompanying documentation.
     
     There are some other, less important parts that deal with
     resources, views and action sets. For now, ignore them.
  -->
  
  
  
  <!-- =========================== Components ================================ -->
  
   <map:components>
  
  <!--
    All pipelines consist at least of two components: a generator, that
    produces the content and a serialiser, that delivers the content to
    the client.
  
    More precisely: a generator generates SAX events and a serializer
    consumes these events and produces a character stream.
  
    Some things to note here: each generator has a unique name, this
    name is mapped to a java class, one name is declared as default
    generator. In addition each generator may have additional
    configurations as child elements. Additional attributes are targeted
    at the component manager. The optional "label" attribute is relevant
    for the view concept below.
  
    It is possible to have the same java class declared as different
    generators by using different names. No configuration options are
    shared between these instances, however.
  
    All components follow this schema.
  -->
  
  <map:generators default="file">
    <map:generator name="search"
      src="org.apache.cocoon.generation.SearchGenerator"
      label="content"/>
  </map:generators>
  
  
  <!--
    Transformers can be placed inside the pipeline between the generator
    and the serializer. You may have as many transformers as you
    like. Transformers consume SAX events and emmit SAX events.
  
    The "xslt" transformer is an example of a component with additional
    configuration.
  -->
  
  <map:transformers default="xslt">
    <map:transformer name="log"
      src="org.apache.cocoon.transformation.LogTransformer"/>
  </map:transformers>
  
  <!--
    Readers are an exception to the above rule that a pipline need to
    have exactly one generator and exactly one serializer. Readers
    circumvent the XML oriented SAX pipeline model, think of a reader
    being a generator and a serializer at once thus a pipeline may not
    contain any generator, transformer or serializer in addition to a
    reader. They are useful for delivering binary content like images.
  -->
  
  <map:readers default="resource"/>
  
  <!--
    Serializers consume SAX events and produce a character stream. Every
    pipeline needs to be terminated by a serializer.
  -->
  
  <map:serializers default="html"/>
  
  
  <!--
    Matchers are executed during pipeline setup. They decide if a
    pipeline fragment is used within a pipeline. Usually, the decision
    is based on a match on the requested URI but matchers exist, that
    match different things as well. Most often the fragment contained in
    a matcher has a generator as well as a serializer. This is not a
    necessity, matchers can be nested while chaining does not work.
    Related concepts are selectors and actions. 
  
    Since this is important, let me repeat it: Matchers are executed
    during pipeline setup.
  -->
  
    <map:matchers default="wildcard"/>
  
  
  <!--
    Selectors are executed during pipeline setup. They can be used to
    determine which pipeline fragments should be combined. They are best
    compared with a switch statement in java. Matchers and actions are
    related concepts.
  
    Since this is important, let me repeat it: Selectors are executed
    during pipeline setup.
  -->
  
  <map:selectors default="browser"/>
  
  <!--
    Actions are executed during pipeline setup. Their purpose is to
    execute some arbitrary complex code. They are the work horses of
    pipelines. Use them to update databases, check external resources
    etc. The execution may fail or complete successfully. Only if the
    execution was successful, the pipeline fragment contained inside is
    used within the pipeline. Related concepts are matchers and
    selectors.
  
    Since this is important, let me repeat it: Actions are executed
    during pipeline setup.
  -->
  
    <map:actions>
      <map:action name="lang-select" src="org.apache.cocoon.acting.LangSelect"/>
      <map:action name="locale" src="org.apache.cocoon.acting.LocaleAction"/>
      <map:action name="request" src="org.apache.cocoon.acting.RequestParamAction"/>
      <map:action name="form-validator" 
src="org.apache.cocoon.acting.FormValidatorAction"/>
      <map:action name="resource-exists" 
src="org.apache.cocoon.acting.ResourceExistsAction"/>
    </map:actions>
  
  </map:components>
  
  <!-- =========================== Views =================================== -->
  
  <!--
    Views provide diffent, well, views to resources. Views are
    orthogonal to pipelines. Please refer to the docs.
  -->
  
  <map:views>
    <map:view name="content" from-label="content">
     <map:serialize type="xml"/>
    </map:view>
  
    <map:view name="links" from-position="last">
     <map:serialize type="links"/>
    </map:view>
  
  </map:views>
  
  
  <!-- =========================== Pipelines ================================= -->
  
  <!--
    Pipelines. The beef. Pipelines specify, how the processing of your
    content is done. Usually, a pipeline consists of several fragments
    that specify the generation, transformation, and serialization of
    SAX events.
  
    Processing is done in two steps:
  
    1) The top level elements are executed in order of appearance until
       one signals success. These top level elements are usually
       matchers. AFAIK other components are not supported for this.
  
       Other components are called depth-first to determine what
       fragments make up the processing pipeline. When a component
       fails, no nested components are called but the next component on
       the same level.
  
    2) Once it is determined which generator, which transformers and
       wich serializer is used, these components are executed. During
       this, the pipeline may not be changed.
  
  
    You may have as many pipelines in your sitemap as you like. However,
    it seems that the only purposes would be to specify different error
    handlers.
  -->
  
  <map:pipelines>
    
    <!-- sub-sitemap example pipeline -->
    <map:pipeline>
      <map:match pattern="images/*.gif">
        <map:read src="images/{1}.gif" mime-type="image/gif">
          <map:parameter name="expires" value="60000"/>
        </map:read>
      </map:match>
  
      <map:match pattern="findIt">
        <map:generate type="search"/>
        <map:transform type="log"/>
        <map:transform src="stylesheets/search2html.xsl"/>
        <map:serialize/>
      </map:match>
      
      <map:match pattern="**">
        <map:generate type="serverpages" src="{1}-index.xsp"/>
        <!--
          Run-time configuration is done through these
          <map:parameter/> elements. Again, let's have a look at the
          javadocs:
          "[...] All <map:parameter> declarations will be made
          available in the XSLT stylesheet as xsl:variables. [...]" 
        -->
        <map:transform src="context://stylesheets/dynamic-page2html.xsl">
          <map:parameter name="view-source" value="search/{1}-index.xsp"/>
        </map:transform>
        <map:serialize/>
      </map:match>
  
    </map:pipeline>
  </map:pipelines>
  
  </map:sitemap>
  
  <!-- end of file -->
  
  
  
  
  1.1                  xml-cocoon2/src/webapp/samples/search/statistic-index.xsp
  
  Index: statistic-index.xsp
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  
  <xsp:page language="java" xmlns:xsp="http://apache.org/xsp";>
  
    <xsp:structure>
      <xsp:include>org.apache.avalon.framework.context.ContextException</xsp:include>
      <xsp:include>org.apache.cocoon.components.search.*</xsp:include>
      
      <xsp:include>org.apache.lucene.document.Document</xsp:include>
      <xsp:include>org.apache.lucene.index.*</xsp:include>
      <xsp:include>org.apache.lucene.document.*</xsp:include>
      <xsp:include>org.apache.lucene.store.*</xsp:include>
      
      <xsp:include>java.io.*</xsp:include>
      <xsp:include>java.util.*</xsp:include>
      <xsp:include>java.net.*</xsp:include>
    </xsp:structure>
    
    <xsp:logic>
      File workDir = null;
      /** Contextualize this class */
      public void contextualize(Context context) throws ContextException {
        super.contextualize( context );
        workDir = (File) context.get(Constants.CONTEXT_WORK_DIR);
      }
      
      Directory directory;
      
      void init() throws ProcessingException {
        try {
          directory = LuceneCocoonHelper.getDirectory( new File( workDir, "index" ), 
false );
        } catch (Exception e) {
          throw new ProcessingException( "Exception in init()!", e );
        }
      }
      
      int numDocs() throws ProcessingException {
        try {
          IndexReader reader = IndexReader.open( directory );
          int num_docs;
          num_docs = reader.numDocs();
          return num_docs;
        } catch (Exception e) {
          throw new ProcessingException( "Exception in numDocs()!", e );
        }
      }
      
      Map allDocuments() throws ProcessingException {
        try {
          IndexReader reader = IndexReader.open( directory );
          
          HashMap fieldsStatistic = new HashMap();
          
          for (int i = 0; i &lt; reader.maxDoc(); i++ ) {
            if (!reader.isDeleted(i)) {
              Document document = reader.document(i);
              Enumeration fields = document.fields();
              while (fields.hasMoreElements()) {
                Field f = (Field)fields.nextElement();
                String name = f.name();
                String value = f.stringValue();
                if (value == null) value = "--void--";
                
                String fieldStatistic = name + "/" + value;
                if (fieldsStatistic.get( fieldStatistic ) == null) {
                  fieldsStatistic.put( fieldStatistic, new Integer(1) );
                } else {
                  Integer sum = (Integer)fieldsStatistic.get( fieldStatistic );
                  int sum_plus = sum.intValue() + 1;
                  fieldsStatistic.put( fieldStatistic, new Integer( sum_plus ) );
                }
              }
            }
          }
          return fieldsStatistic;
          //map.keySet();
        } catch (Exception e) {
          throw new ProcessingException( "Exception allDocuments()!", e );
        }
      }
  
      Map allTerms() throws ProcessingException {
        try {
          IndexReader reader = IndexReader.open( directory );
          
          TermEnum te = reader.terms();
          HashMap all_fields = new HashMap();
          while (te.next()) {
            Term term = te.term();
            int docfreq = te.docFreq();
            String field = term.field();
            if (field != null) {
              if (all_fields.containsKey( field )) {
                Integer sum = (Integer)all_fields.get( field );
                int sum_plus = sum.intValue() + docfreq;
                all_fields.put( field, new Integer( sum_plus ) );
              } else {
                all_fields.put( field, new Integer( docfreq ) );
              }
            }
          }
          te.close();
          return all_fields;
        } catch (Exception e) {
          throw new ProcessingException( "Exception allDocuments()!", e );
        }
      }
      Map sort( Map map ) {
        TreeMap treeMap = new TreeMap( map );
        return treeMap;
      }
    </xsp:logic>
    
    <page>
      <xsp:logic>
        init();
      </xsp:logic>
      <title>Index Statistics</title>
      <content>
        <para>
          Statistics:
        </para>
        <para>
          Total Count Of Documents
          <xsp:expr>String.valueOf(numDocs())</xsp:expr>
        </para>
        <para>
          <table>
            <tr>
              <td>Count Of Terms</td><td>Fieldname/Fieldvalue</td>
            </tr>
            <xsp:logic>
              Map all_docs = sort(allDocuments());
              Iterator it1 = all_docs.keySet().iterator();
              while (it1.hasNext()) {
                String k = (String)it1.next();
                Integer v = (Integer)all_docs.get( k );
                <xsp:content>
                  <tr>
                    <td> <xsp:expr>v.toString()</xsp:expr> </td>
                    <td> <xsp:expr>k</xsp:expr> </td>
                  </tr>
                </xsp:content>
              }
            </xsp:logic>
          </table>
        </para>
        <para>
          All Terms
        </para>
        <para>
          <table>
            <tr>
              <td>Count Of Terms</td><td>Term</td>
            </tr>
            <xsp:logic>
              Map all_terms = sort(allTerms());
              Iterator it2 = all_terms.keySet().iterator();
              while (it2.hasNext()) {
                String k = (String)it2.next();
                Integer v = (Integer)all_terms.get( k );
                <xsp:content>
                  <tr>
                    <td> <xsp:expr>v.toString()</xsp:expr> </td>
                    <td> <xsp:expr>k</xsp:expr> </td> 
                  </tr>
                </xsp:content>
              }
            </xsp:logic>
          </table>
        </para>
      </content>
    </page>
  
  </xsp:page>
  
  
  
  
  1.1                  xml-cocoon2/src/webapp/samples/search/welcome-index.xsp
  
  Index: welcome-index.xsp
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  
  <xsp:page language="java" xmlns:xsp="http://apache.org/xsp";>
  
    <page>
      <title>Welcome to Cocoon XML Search using Lucene</title>
      <content>
        <a href="http://jakarta.apache.org/lucene/";><img border="0" alt="Lucene Logo" 
src="images/lucene_green_300.gif"/></a>
        
        <h1>XML Search</h1>
        
        <p>
          Welcome to Cocoon XML Search. This page introduces Cocoon searching
          and offers the following samples:
        </p>
        <ul>
          <li>Creating a Lucene index to enable searching
          </li>
          <li>Searching through a once created Lucene index using various means:
          </li>
          <li>Searching a Lucene index using <em>XSP</em>
          </li>
          <li>Searching a Lucene index using <em>SearchGenerator</em>
          </li>
        </ul>
        
        <h2>Creating an Index</h2>
        <p>
          You must create a Lucene index first, before you can do the searching.
          Create an index by specifying a base url from which to start
          crawling (the indexer will follow the links to build its content).
          The base url should be 
          <a href="../documents/userdocs/concepts/views.html">cocoon-view</a>
          aware of content-labels
          <strong>links</strong>, and <strong>content</strong>.
          For example you might use the base URL 
          <code>http://localhost:8080/cocoon/documents/index.html</code>
        </p>
        <p>
          This following page allows you to <a href="create">create</a> an
          index.
        </p>
        
        <h2>Searching</h2>
        <p>
          Enter a query and search the Lucene index that you have created
          - using <a href="search?queryString=lucene">XSP</a>.
        </p>
        <p>
          Enter a query and search the Lucene index that you have created
          - using <a href="findIt?queryString=lucene">Cocoon Generators</a>.
        </p>
        
        
        <h2>Internals</h2>
        <p>
          Cocoon XML search uses the
          <a href="http://jakarta.apache.org/lucene/";>Jakarta Lucene</a>
          indexing and search engine.
          The Cocoon documentation
          <a href="/cocoon/documents/userdocs/concepts/xmlsearching.html">explains</a> 
how it is implemented within Cocoon. Look behind the scenes of this
          example to find out more.
        </p>
  
        <!--center>
          <form name="search" action="search" method="get">
            <table>
              <tr><td></td>
                <td>
                  <input name="queryString" size="44"/>&#160;<input type="submit" 
value="Search"/>
                </td>
              </tr>
              <tr>
                <td>Index</td>
                <td>
                  <select name="index">
                    <option value="index">index</option>
                    <option value="index-1">index-1</option>
                    <option value="index-2">index-2</option>
                    <option value="index-3">index-3</option>
                  </select>
                </td>
              </tr>
              <tr>
                <td>Analyzer Class</td>
                <td>
                  <select name="analyzerClassName">
                    <option 
value="org.apache.lucene.analysis.StopAnalyzer">StopAnalyzer</option>
                    <option 
value="org.apache.lucene.analysis.standard.StandardAnalyzer">StandardAnalyzer</option>
                    <option 
value="org.apache.lucene.analysis.de.GermanAnalyzer">GermanAnalyzer</option>
                    <option 
value="org.apache.lucene.analysis.SimpleAnalyzer">SimpleAnalyzer</option>
                  </select>
                </td>
              </tr>
            </table>
          </form>
        </center-->
      </content>
    </page>
  </xsp:page>
  
  
  
  
  1.1                  
xml-cocoon2/src/webapp/samples/search/images/lucene_green_300.gif
  
        <<Binary file>>
  
  
  1.1                  
xml-cocoon2/src/webapp/samples/search/stylesheets/search2html.xsl
  
  Index: search2html.xsl
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  
  <xsl:stylesheet
    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
    xmlns:search="http://apache.org/cocoon/search/1.0";
  >
  
    <xsl:template match="search:results">
      <html>
        <head>
          <title>Index Search</title>
        </head>
        <body bgcolor="white" alink="red" link="blue" vlink="blue">
          <a href="http://jakarta.apache.org/lucene";>
            <img border="0" alt="Lucene Logo" src="images/lucene_green_300.gif"/>
          </a>
          <h1>IndexSearch</h1>
          
          <p>
            <font size="-1">
              <a target="_blank" href="statistic">Index Statistic</a> |
              <a href="welcome">Welcome</a>
            </font>
          </p>
          
          <form action="findIt">
            <input type="text" name="queryString" size="60" 
value="{@search:query-string}"/>
            &#160;
            <input type="submit" name="Search" value="Search"/>
          </form>
          Search Help
          <table cellspacing="2" cellpadding="2">
            <tr bgcolor="#dddedd" valign="top">
            <td width="50%"><font size="-2" >
              <ul>
                <li>free AND "text search"
                  Search for documents containing "free" and the 
                  phrase "text search"
                </li>
                <li>+text search
                  Search for documents containing "text" and 
                  preferentially containing "search".
                </li>
                <li>giants -football
                  Search for "giants" but omit documents containing "football"
                </li>
              </ul>
            </font></td>
            
            <td><font size="-2">
              <ul>
                <li>body:john
                  Search for documents containing "john" in the  body field.
                  The field "body" is used by default.
                  Thus query "body:john" is equivalent to query "john".
                </li>
                <li>s1@title:cocoon
                  Search for documents containing "cocoon" in the
                  using field s1@title, ie searching in
                  title attribute of s1 element of xml document.
                </li>
              </ul>
            </font></td>
            </tr>
          </table>
          
          <xsl:apply-templates/>
        </body>
      </html>
    </xsl:template>
  
    <xsl:template match="search:hits">
      <p>
        Total Hits <xsl:value-of select="@search:total-count"/>
        Pages <xsl:value-of select="@search:count-of-pages"/>
      </p>
      <p>
        Page:
        <xsl:for-each 
select="/search:results/search:navigation/search:navigation-page">
          <xsl:call-template name="navigation-link"> 
            <xsl:with-param name="query-string" 
select="/search:results/@search:query-string"/>
            <xsl:with-param name="page-length" 
select="/search:results/@search:page-length"/>
            <xsl:with-param name="start-index" select="@search:start-index"/>
            <xsl:with-param name="link-text" select="position()"/>
          </xsl:call-template>
        </xsl:for-each>
      </p>
      
      <p>
      <xsl:call-template name="navigation-paging-link">
        <xsl:with-param name="query-string" 
select="/search:results/@search:query-string"/>
        <xsl:with-param name="page-length" 
select="/search:results/@search:page-length"/>
        <xsl:with-param name="has-previous" 
select="/search:results/search:navigation/@search:has-previous"/>
        <xsl:with-param name="has-next" 
select="/search:results/search:navigation/@search:has-next"/>
        <xsl:with-param name="previous-index" 
select="/search:results/search:navigation/@search:previous-index"/>
        <xsl:with-param name="next-index" 
select="/search:results/search:navigation/@search:next-index"/>
      </xsl:call-template>
      </p>
      <hr/>
      
      <table border="1" width="90%" cellpadding="4">
        <tr>
          <td>Score</td><td>Rank</td><td>URI</td>
        </tr>
        <xsl:apply-templates/>
      </table>
    </xsl:template>
  
    <xsl:template match="search:navigation">
      <p>
      <xsl:call-template name="navigation-paging-form">
        <xsl:with-param name="query-string"><xsl:value-of 
select="/search:results/@search:query-string"/></xsl:with-param>
        <xsl:with-param name="page-length"><xsl:value-of 
select="/search:results/@search:page-length"/></xsl:with-param>
        <xsl:with-param name="has-previous"><xsl:value-of 
select="@search:has-previous"/></xsl:with-param>
        <xsl:with-param name="has-next"><xsl:value-of 
select="@search:has-next"/></xsl:with-param>
        <xsl:with-param name="previous-index"><xsl:value-of 
select="@search:previous-index"/></xsl:with-param>
        <xsl:with-param name="next-index"><xsl:value-of 
select="@search:next-index"/></xsl:with-param>
      </xsl:call-template>
      </p>
    </xsl:template>
    
    <xsl:template match="search:hit">
      <tr>
        <td>
          <xsl:value-of select="format-number( @search:score, '### %' )"/>
        </td>
        <td>
          <xsl:value-of select="@search:rank"/>
        </td>
        <td>
          <a target="_blank" href="{@search:uri}">
            <xsl:value-of select="@search:uri"/>
          </a>
        </td>
      </tr>
    </xsl:template>
  
    <xsl:template name="navigation-paging-form">
      <xsl:param name="query-string"/>
      <xsl:param name="page-length"/>
      <xsl:param name="has-previous"/>
      <xsl:param name="has-next"/>
      <xsl:param name="previous-index"/>
      <xsl:param name="next-index"/>
  
      <xsl:if test="$has-previous = 'true'">
        <form action="findIt">
          <input type="hidden" name="startIndex" value="{$previous-index}"/>
          <input type="hidden" name="queryString" value="{$query-string}"/>
          <input type="hidden" name="pageLength" value="{$page-length}"/>
          <input type="submit" name="previous" value="previous"/>
        </form>
      </xsl:if>
      
      <xsl:if test="$has-next = 'true'">
        <form action="findIt">
          <input type="hidden" name="startIndex" value="{$next-index}"/>
          <input type="hidden" name="queryString" value="{$query-string}"/>
          <input type="hidden" name="pageLength" value="{$page-length}"/>
          <input type="submit" name="next" value="next"/>
        </form>
      </xsl:if>
      
    </xsl:template>
  
    <xsl:template name="navigation-paging-link">
      <xsl:param name="query-string"/>
      <xsl:param name="page-length"/>
      <xsl:param name="has-previous"/>
      <xsl:param name="has-next"/>
      <xsl:param name="previous-index"/>
      <xsl:param name="next-index"/>
  
      <xsl:if test="$has-previous = 'true'">
        
        <xsl:call-template name="navigation-link">
          <xsl:with-param name="query-string"><xsl:value-of 
select="$query-string"/></xsl:with-param>
          <xsl:with-param name="page-length"><xsl:value-of 
select="$page-length"/></xsl:with-param>
          <xsl:with-param name="start-index"><xsl:value-of 
select="$previous-index"/></xsl:with-param>
          <xsl:with-param name="link-text">Previous Page Of Hits</xsl:with-param>
        </xsl:call-template>
      </xsl:if>
      &#160;
      <xsl:if test="$has-next = 'true'">
        <a 
href="findIt?startIndex={$next-index}&amp;queryString={$query-string}&amp;pageLength={$page-length}">
          Next Page Of Hits
        </a>
      </xsl:if>
    </xsl:template>
    
    <xsl:template name="navigation-link">
      <xsl:param name="query-string"/>
      <xsl:param name="page-length"/>
      <xsl:param name="start-index"/>
      <xsl:param name="link-text"/>
  
      <a 
href="findIt?startIndex={$start-index}&amp;queryString={$query-string}&amp;pageLength={$page-length}">
        <xsl:value-of select="$link-text"/>
      </a>
      &#160;
    </xsl:template>
  
    <xsl:template match="@*|node()" priority="-2"><xsl:copy><xsl:apply-templates 
select="@*|node()"/></xsl:copy></xsl:template>
    <xsl:template match="text()" priority="-1"><xsl:value-of 
select="."/></xsl:template>
  
  </xsl:stylesheet>
  
  
  
  
  1.1                  xml-cocoon2/src/webapp/samples/sub/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  <?xml version="1.0"?>
  
  <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0";>
  
  <!-- =========================== Components ================================ -->
  
   <map:components>
    <map:generators default="file"/>
    <map:transformers default="xslt"/>
    <map:readers default="resource"/>
    <map:serializers default="html"/>
    <map:selectors default="browser"/>
    <map:matchers default="wildcard"/>
   </map:components>
  
  <!-- =========================== Pipelines ================================= -->
  
   <map:pipelines>
    <map:pipeline>
  
     <map:match pattern="">
      <map:redirect-to uri="welcome"/>
     </map:match>
  
     <map:match pattern="welcome">
      <map:generate src="docs/samples.xml"/>
      <map:transform src="stylesheets/simple-samples2html.xsl"/>
      <map:serialize/>
     </map:match>
  
     <!-- All Static. -->
     <map:match pattern="all-static">
      <map:generate src="docs/simple.xml"/>
      <map:transform src="stylesheets/simple-page2html.xsl"/>
      <map:serialize/>
     </map:match>
  
     <!-- This shows ways how XSL could be obtained -->
     <map:match pattern="xsl-source">
      <map:generate src="stylesheets/simple-page2html.xsl"/>
      <map:serialize type="xml"/>
     </map:match>
     <map:match pattern="xsl">
      <map:generate src="docs/simple.xml"/>
      <map:transform src="stylesheets/simple-page2html.xsl"/>
      <map:serialize/>
     </map:match>
     <map:match pattern="xsl-cocoon">
      <map:generate src="docs/simple.xml"/>
      <map:transform src="cocoon:/xsl-source"/>
      <map:serialize/>
     </map:match>
     <map:match pattern="xsl-cocoon-root">
      <map:generate src="docs/simple.xml"/>
      <map:transform src="cocoon://samples/sub/xsl-source"/>
      <map:serialize/>
     </map:match>
     <map:match pattern="xsl-http">
      <map:generate src="docs/simple.xml"/>
      <map:transform src="http://localhost:8080/cocoon/samples/sub/xsl-source"/>
      <map:serialize/>
     </map:match>
  
     <!-- Dynamic XSL -->
     <map:match pattern="xsl-dynamic-source">
      <map:generate type="serverpages" src="stylesheets/simple-page2html.xsp"/>
      <map:serialize type="xml"/>
     </map:match>
     <map:match pattern="xsl-dynamic">
      <map:generate src="docs/simple.xml"/>
      <map:transform src="cocoon:/xsl-dynamic-source"/>
      <map:serialize/>
     </map:match>
  
     <!-- This shows ways how XSP could be obtained -->
     <map:match pattern="xsp-source">
      <map:generate src="docs/simple.xsp"/>
      <map:serialize type="xml"/>
     </map:match>
     <map:match pattern="xsp">
      <map:generate type="serverpages" src="docs/simple.xsp"/>
      <map:transform src="stylesheets/simple-page2html.xsl"/>
      <map:serialize/>
     </map:match>
     <map:match pattern="xsp-cocoon">
      <map:generate type="serverpages" src="cocoon:/xsp-source"/>
      <map:transform src="stylesheets/simple-page2html.xsl"/>
      <map:serialize/>
     </map:match>
     <map:match pattern="xsp-cocoon-root">
      <map:generate type="serverpages" src="cocoon://samples/sub/xsp-source"/>
      <map:transform src="stylesheets/simple-page2html.xsl"/>
      <map:serialize/>
     </map:match>
     <map:match pattern="xsp-http">
      <map:generate type="serverpages" 
src="http://localhost:8080/cocoon/samples/sub/xsp-source"/>
      <map:transform src="stylesheets/simple-page2html.xsl"/>
      <map:serialize/>
     </map:match>
  
     <!-- Dynamic XSP. Beware: Very slow! -->
     <map:match pattern="xsp-dynamic-source">
      <map:generate type="serverpages" src="docs/dynamic.xsp"/>
      <map:transform src="stylesheets/dynamic-xsp2xsp.xsl"/>
      <map:serialize type="xml"/>
     </map:match>
     <map:match pattern="xsp-dynamic">
      <map:generate type="serverpages" src="cocoon:/xsp-dynamic-source"/>
      <map:transform src="stylesheets/simple-page2html.xsl"/>
      <map:serialize/>
     </map:match>
  
     <!-- All Dynamic. Beware: Very slow! -->
     <map:match pattern="all-dynamic">
      <map:generate type="serverpages" src="cocoon:/xsp-dynamic-source"/>
      <map:transform src="cocoon:/xsl-dynamic-source"/>
      <map:serialize/>
     </map:match>
  
     <!-- Test error handler in parent sitemap -->
     <map:match pattern="generror">
      <map:generate src="docs/error-giving-page.xml"/>
      <map:transform src="stylesheets/simple-samples2html.xsl"/>
      <map:serialize/>
     </map:match>
  
     <!-- Test customized error handler -->
     <map:match pattern="test404">
      <map:aggregate element="page">
        <map:part src="cocoon://samples/sub/get/simple.xsp"/>
        <map:part src="cocoon://samples/sub1z/get/simple.xsp"/>
      </map:aggregate>
      <map:transform src="stylesheets/simple-page2html.xsl"/>
      <map:serialize/>
     </map:match>
  
     <!-- this is used to show the content of any XML file. -->
     <map:match pattern="view-source">
      <!-- this XSP page takes one request parameter: filename -->
      <map:generate type="serverpages" 
src="context://docs/samples/slides/view-source.xsp"/>
      <map:serialize/>
     </map:match>
  
     <!-- This erorr handler customizes ResourceNotFound errors -->
     <map:handle-errors type="404">
      <map:transform src="stylesheets/error2html.xsl"/>
      <map:serialize/>
     </map:handle-errors>
    </map:pipeline>
   </map:pipelines>
  
  </map:sitemap>
  
  <!-- end of file -->
  
  
  
  1.1                  xml-cocoon2/src/webapp/samples/sub/docs/dynamic.xsp
  
  Index: dynamic.xsp
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  
  <!-- CVS: $Id: dynamic.xsp,v 1.1 2002/07/01 10:04:17 cziegeler Exp $ -->
  
  <xsp:page language="java"
            xmlns:xsp="http://apache.org/xsp";
            xmlns:an-xsp="urn:xsp"
            xmlns:an-xsp-request="urn:xsp-request">
  
  <an-xsp:page language="java">
  
    <page>
      <title>Dynamic XSP page, served by sub-sitemap</title>
  
      <content>
        <para>Hi there! I'm a very complex dynamic page generated by XSP
          (eXtensible Server Pages), with source dynamically generated by XSP.
          Nobody should use such complex constructs while in good health :)</para>
        <para>
          My source resides in the file <b>cocoon/sub/docs/dynamic.xsp</b>.</para>
        <para>
          My source was generated by XSP at <b><xsp:expr>new 
Date()</xsp:expr></b>.</para>
        <para>I know that I was requested as the URI <b>
          <an-xsp-request:get-uri as="xml"/></b>,
          and executed at <b><an-xsp:expr>new Date()</an-xsp:expr></b>
          by <b><an-xsp:expr>Constants.COMPLETE_NAME</an-xsp:expr></b>.
        </para>
      </content>
    </page>
  </an-xsp:page>
  
  </xsp:page>
  
  
  
  1.1                  xml-cocoon2/src/webapp/samples/sub/docs/error-giving-page.xml
  
  Index: error-giving-page.xml
  ===================================================================
  <?xml version="1.0"?>
  
  <!-- CVS: $Id: error-giving-page.xml,v 1.1 2002/07/01 10:04:17 cziegeler Exp $ -->
  
  <!DOCTYPE page [
   <!ELEMENT page (title?, content)>
   <!ELEMENT title (#PCDATA)>
   <!ELEMENT content (para+)>
   <!ELEMENT para (#PCDATA)>
  ]>
  
  <page>
   <title>Hello</title>
   <content>
    </para>This is my first Cocoon2 page!</para>
   </content>
  </page>
  
  
  
  1.1                  xml-cocoon2/src/webapp/samples/sub/docs/samples.xml
  
  Index: samples.xml
  ===================================================================
  <?xml version="1.0" encoding="iso-8859-1"?>
  
  <!-- CVS: $Id: samples.xml,v 1.1 2002/07/01 10:04:17 cziegeler Exp $ -->
  
  <samples xmlns:xlink="http://www.w3.org/1999/xlink";>
  
    <group name="This page is served by sub-sitemap!">
     <sample name="Back" href="..">
      to the samples main page
     </sample>
    </group>
  
    <group name="Static XML With Static XSL">
     <sample name="All Static" href="all-static">
      This is the simpliest sample, similar to "hello world" on the main page.
     </sample>
    </group>
  
    <group name="Obtaining XSP Source">
     <sample name="Plain XSP" href="xsp">
      Source is obtained from local file
     </sample>
  
     <sample name="This sitemap XSP" href="xsp-cocoon">
      Source is obtained via cocoon:/xsp-source
     </sample>
  
     <sample name="Root sitemap XSP" href="xsp-cocoon-root">
      Source is obtained via cocoon://sub/xsp-source
     </sample>
  
     <sample name="External XSP" href="xsp-http">
      Source is obtained via http://localhost:8080/cocoon/sub/xsp-source
      (Note: if you run Cocoon on another host/port, you have to edit sub-sitemap)
     </sample>
  
     <sample name="Dynamic XSP" href="xsp-dynamic">
      Source is generated dynamically and obtained as Cocoon source 
cocoon:/xsp-dynamic-source
     </sample>
    </group>
  
    <group name="Obtaining XSL Source">
     <sample name="Plain XSL" href="xsl">
      XSL is obtained from local file
     </sample>
  
     <sample name="This sitemap XSL" href="xsl-cocoon">
      XSL is obtained via cocoon:/xsl-source, processed by this sitemap directly.
     </sample>
  
     <sample name="Root sitemap XSL" href="xsl-cocoon-root">
      XSL is obtained via cocoon://sub/xsp-source, processed by root sitemap.
     </sample>
  
     <sample name="External XSL" href="xsl-http">
      XSL is obtained via http://localhost:8080/cocoon/sub/xsl-source
      (Note: if you run Cocoon on another host/port, you have to edit sub-sitemap)
     </sample>
  
     <sample name="Dynamic XSL" href="xsl-dynamic">
      XSL is dynamically generated and obtained as Cocoon source 
cocoon:/xsl-dynamic-source.
     </sample>
    </group>
  
    <group name="Dynamic XSP With Dynamic XSL">
     <sample name="All Dynamic" href="all-dynamic">
      Combines last XSP sample with last XSL sample: XSP is obtained via Cocoon 
      source cocoon:/xsp-dynamic-source, and processed by XSL obtained via Cocoon
      source cocoon:/xsl-dynamic-source.
     </sample>
    </group>
  
    <group name="System pages">
     <sample name="Sitemap" href="view-source?filename=/sub/sitemap.xmap">
      shows the source file of this sitemap. Located in the file sub/sitemap.xmap
     </sample>
  
     <sample name="Error" href="generror">
      Error is generated in sub-sitemap and processed in main sitemap
     </sample>
  
     <sample name="Not Found" href="does-not-exist">
      Customized Resource Not Found page
     </sample>
    </group>
  </samples>
  
  
  
  1.1                  xml-cocoon2/src/webapp/samples/sub/docs/simple.xml
  
  Index: simple.xml
  ===================================================================
  <?xml version="1.0"?>
  
  <!-- CVS: $Id: simple.xml,v 1.1 2002/07/01 10:04:17 cziegeler Exp $ -->
  
  <page>
    <title>Simple static page, served by sub-sitemap</title>
    <content>
      <para>
        Hi there! I'm a simple static page read from the file.</para>
      <para>
        My source resides in the file <b>cocoon/sub/docs/simple.xml</b></para>
      <para>
        I know nothing about the environment which is using me.</para>
    </content>
  </page>
  
  
  
  1.1                  xml-cocoon2/src/webapp/samples/sub/docs/simple.xsp
  
  Index: simple.xsp
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  
  <!-- CVS: $Id: simple.xsp,v 1.1 2002/07/01 10:04:17 cziegeler Exp $ -->
  
  <xsp:page language="java"
            xmlns:xsp="http://apache.org/xsp";
            xmlns:xsp-request="http://apache.org/xsp/request/2.0";>
  
    <page>
      <title>Simple XSP page, served by sub-sitemap</title>
  
      <content>
        <para>Hi there! I'm a simple dynamic page generated by XSP
          (eXtensible Server Pages).</para>
        <para>
          My source resides in the file <b>cocoon/sub/docs/simple.xsp</b>.</para>
        <para>I know that I was requested as the URI 
          <b><xsp-request:get-uri as="xml"/></b>,
          and executed at <b><xsp:expr>new Date()</xsp:expr></b>
          by <b><xsp:expr>Constants.COMPLETE_NAME</xsp:expr></b>.
        </para>
      </content>
    </page>
  </xsp:page>
  
  
  
  1.9       +2 -2      xml-cocoon2/src/webapp/welcome/welcome.xhtml
  
  Index: welcome.xhtml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/webapp/welcome/welcome.xhtml,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- welcome.xhtml     14 Jun 2002 16:19:14 -0000      1.8
  +++ welcome.xhtml     1 Jul 2002 10:04:18 -0000       1.9
  @@ -87,9 +87,9 @@
                           <tr>
                              <td align="left" bgcolor="#ffffff" width="100%">
                                 <font color="#000000" face="arial,helvetica,sanserif" 
size="+0">
  -                              <a href="search/welcome">Search</a>
  +                              <a href="samples/search/welcome">Search</a>
   
  -                              - Need to <a href="search/welcome">search</a> for a 
specific 
  +                              - Need to <a href="samples/search/welcome">search</a> 
for a specific 
                                   thing about me? Let me do the work for you.</font>
                              </td>
                           </tr>
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     [EMAIL PROTECTED]
To unsubscribe, e-mail:          [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to