<?xml version="1.0"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->

<!--+ 
    | This sitemap is written specifically for rendering Cocoon's docs.  When the
    | Ant 'docs' target is invoked, it will be renamed to sitemap.xmap in a temporary
    | context.  The sitemap.xmap file here is an override of Forrest's.
    |
    | CVS $Id: sitemap-localdocs.xmap 433543 2006-08-22 06:22:54Z crossley $
    +-->

<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">

<!-- =========================== Components ================================ -->

 <map:components>

  <map:generators default="file">
   <map:generator  name="file"        src="org.apache.cocoon.generation.FileGenerator" label="content"/>
   <!-- FIXME: Change this once better view handling is implemented -->
   <map:generator  name="file-nolabel" src="org.apache.cocoon.generation.FileGenerator"/>
  </map:generators>

  <map:transformers default="xslt">
   <map:transformer name="xslt" src="org.apache.cocoon.transformation.TraxTransformer">
    <use-request-parameters>false</use-request-parameters>
    <use-browser-capabilities-db>false</use-browser-capabilities-db>
   </map:transformer>
  </map:transformers>

  <map:readers default="resource">
   <map:reader name="resource"       src="org.apache.cocoon.reading.ResourceReader"/>
  </map:readers>

  <map:serializers default="html">
   <map:serializer name="html"   mime-type="text/html"        src="org.apache.cocoon.serialization.HTMLSerializer">
     <encoding>ISO-8859-1</encoding>
   </map:serializer>
   <map:serializer name="xml"    mime-type="text/xml"         src="org.apache.cocoon.serialization.XMLSerializer"/>
   <map:serializer name="links"                               src="org.apache.cocoon.serialization.LinkSerializer"/>
  </map:serializers>

  <map:matchers default="wildcard">
   <map:matcher name="wildcard" src="org.apache.cocoon.matching.WildcardURIMatcher"/>
  </map:matchers>

  <map:pipes default="caching">
     <map:pipe name="caching" src="org.apache.cocoon.components.pipeline.impl.CachingProcessingPipeline"
                   logger="core.processing-pipeline" pool-max="32"/>
  </map:pipes>

 </map:components>

<!-- =========================== Views =================================== -->

 <map:views>
  <map:view name="content" from-label="content">
   <map:serialize type="xml"/>
  </map:view>

  <map:view name="links" from-position="last">
   <map:transform src="stylesheets/filterlinks.xsl"/>
   <map:serialize type="links"/>
  </map:view>

 </map:views>

<!-- =========================== Resources ================================= -->
  
  <map:resources>
    <map:resource name="book">
      <map:generate src="xdocs/{../1}book.xml"/>
        <map:transform src="stylesheets/book2menu.xsl">
          <map:parameter name="use-request-parameters" value="true"/>
          <map:parameter name="resource" value="{resource}.html"/>
        </map:transform>
        <map:serialize type="xml"/>        
    </map:resource>
  </map:resources>

<!-- =========================== Pipelines ================================= -->

 <map:pipelines>

  <!-- Cocoon documentation pipeline -->
  <map:pipeline>
   <map:match pattern="">
    <map:redirect-to uri="index.html"/>
   </map:match>

   <map:match pattern="apidocs/**">
    <map:read src="../api/java/{1}"/>
   </map:match>

  <!-- Process book.xml for nested levels -->
  <map:match pattern="**book-**/*.xml">
    <map:call resource="book">
      <map:parameter name="resource" value="{3}" />
    </map:call>
  </map:match>

  <!-- Process book.xml -->  
  <map:match pattern="**book-**.xml">
    <map:call resource="book">
      <map:parameter name="resource" value="{2}" />                
    </map:call>
  </map:match>            

   <!-- the main ToDo doc -->
   <map:match pattern="body-todo.xml">
     <map:generate type="file-nolabel" src="xdocs/status.xml"/>
     <map:transform src="stylesheets/statustodo2document.xsl" label="content"/>
     <map:transform src="stylesheets/document2html.xsl"/>
     <map:serialize/>
   </map:match>

   <!-- other ToDo docs -->
   <map:match pattern="body-**/todo-*.xml">
     <map:generate type="file-nolabel" src="xdocs/{1}/todo-{2}.xml"/>
     <map:transform src="stylesheets/todo2document.xsl" label="content"/>
     <map:transform src="stylesheets/document2html.xsl"/>
     <map:serialize/>
   </map:match>

   <!-- the main Changes doc -->
   <map:match pattern="body-changes.xml">
     <map:generate type="file-nolabel" src="xdocs/status.xml"/>
     <map:transform src="stylesheets/statuschanges2document.xsl"
       label="content"/>
     <map:transform src="stylesheets/document2html.xsl"/>
     <map:serialize/>
   </map:match>
   
   <!-- other Changes docs -->
   <map:match pattern="body-**/changes-*.xml">
     <map:generate type="file-nolabel" src="xdocs/{1}/changes-{2}.xml"/>
     <map:transform src="stylesheets/changes2document.xsl" label="content"/>
     <map:transform src="stylesheets/document2html.xsl"/>
     <map:serialize/>
   </map:match>
      
   <!-- FAQ docs -->
   <map:match pattern="body-**/faq-*.xml">
     <map:generate type="file-nolabel" src="xdocs/{1}/faq-{2}.xml"/>
     <map:transform src="stylesheets/faqcommon.xsl" label="content"/>
     <map:transform src="stylesheets/faq2document.xsl" label="content"/>
     <map:transform src="stylesheets/document2html.xsl"/>
     <map:serialize/>
   </map:match>

   <!-- 
     Generate the "doclist" - list of all documentation
     The first match generates each book.xml and adds a new attribute "uri".
     The second match aggregates each book.xml into a doclist and
     then converts it to a document.
   -->
   <map:match pattern="doclist/xdocs/**book.xml">
     <map:generate src="xdocs/{1}book.xml"/>
     <map:transform src="stylesheets/doclist.xsl">
       <map:parameter name="uri" value="{1}"/>
     </map:transform>
     <map:serialize type="xml"/>
   </map:match>
   
   <map:match pattern="body-doclist.xml">
     <map:aggregate element="doclist">
       <map:part src="cocoon:/doclist/xdocs/book.xml"/>
       <map:part src="cocoon:/doclist/xdocs/installing/book.xml"/>
       <map:part src="cocoon:/doclist/xdocs/userdocs/book.xml"/>
       <map:part src="cocoon:/doclist/xdocs/userdocs/concepts/book.xml"/>
       <map:part src="cocoon:/doclist/xdocs/userdocs/generators/book.xml"/>
       <map:part src="cocoon:/doclist/xdocs/userdocs/transformers/book.xml"/>
       <map:part src="cocoon:/doclist/xdocs/userdocs/serializers/book.xml"/>
       <map:part src="cocoon:/doclist/xdocs/userdocs/matchers/book.xml"/>
       <map:part src="cocoon:/doclist/xdocs/userdocs/selectors/book.xml"/>
       <map:part src="cocoon:/doclist/xdocs/userdocs/actions/book.xml"/>
       <map:part src="cocoon:/doclist/xdocs/userdocs/readers/book.xml"/>
       <map:part src="cocoon:/doclist/xdocs/userdocs/xsp/book.xml"/>
       <map:part src="cocoon:/doclist/xdocs/developing/book.xml"/>
       <map:part src="cocoon:/doclist/xdocs/developing/webapps/book.xml"/>
       <map:part src="cocoon:/doclist/xdocs/tutorial/book.xml"/>
       <map:part src="cocoon:/doclist/xdocs/howto/book.xml"/>
       <map:part src="cocoon:/doclist/xdocs/faq/book.xml"/>
       <map:part src="cocoon:/doclist/xdocs/snippet/book.xml"/>
       <map:part src="cocoon:/doclist/xdocs/plan/book.xml"/>
       <map:part src="cocoon:/doclist/xdocs/link/book.xml"/>
     </map:aggregate>
     <map:transform src="stylesheets/doclist2document.xsl"/>
     <map:transform src="stylesheets/document2html.xsl"/>
     <map:serialize type="html"/>
   </map:match>

   <map:match pattern="body-**.xml">
     <map:generate src="xdocs/{1}.xml"/>
     <map:transform src="stylesheets/document2html.xsl"/>
     <map:serialize/>
   </map:match>

   <map:match pattern="*.html">
    <map:aggregate element="site">
     <map:part src="cocoon:/book-{1}.xml"/>
     <map:part src="cocoon:/body-{1}.xml" label="content"/>
    </map:aggregate>
    <map:transform src="stylesheets/site2xhtml.xsl">
     <map:parameter name="use-request-parameters" value="true"/>
     <map:parameter name="header" value="graphics/{1}-header.jpg"/>
    </map:transform>
    <map:serialize/>
   </map:match>

   <map:match pattern="**/*.html">
    <map:aggregate element="site">
     <map:part src="cocoon:/{1}/book-{1}/{2}.xml"/>
     <map:part src="cocoon:/body-{1}/{2}.xml" label="content"/>
    </map:aggregate>
    <map:transform src="stylesheets/site2xhtml.xsl">
     <map:parameter name="use-request-parameters" value="true"/>
     <map:parameter name="header" value="graphics/{2}-header.jpg"/>
    </map:transform>
    <map:serialize/>
   </map:match>

   <!-- ================  Static  =========================== -->

   <map:match pattern="**sample/**">
    <map:read src="xdocs/{1}sample/{2}" mime-type="text/plain"/>
   </map:match>

   <map:match pattern="**.txt">
    <map:read src="xdocs/{1}.txt" mime-type="text/plain"/>
   </map:match>

   <map:match pattern="**resources/script.js">
     <map:read src="stylesheets/script-cli.js" mime-type="application/javascript"/>
   </map:match>

   <map:match pattern="**resources/**.js">
     <map:read src="stylesheets/{2}.js" mime-type="application/javascript"/>
   </map:match>

   <map:match pattern="**.css">
    <map:read src="{1}.css" mime-type="text/css"/>
   </map:match>

   <map:match pattern="favicon.ico">
    <map:read src="images/cocoon.ico"/>
   </map:match>
   
   <map:match pattern="**images/*.png">
    <map:read src="images/{2}.png" mime-type="image/png"/>
   </map:match>

   <map:match pattern="**images/*.jpg">
    <map:read src="images/{2}.jpg" mime-type="image/jpeg"/>
   </map:match>

   <map:match pattern="**images/*.gif">
    <map:read src="images/{2}.gif" mime-type="image/gif"/>
   </map:match>

  </map:pipeline>
 </map:pipelines>
</map:sitemap>
