<?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.
-->

<!--+
    | Apples block samples sitemap
    |
    | CVS $Id: sitemap.xmap 474829 2006-11-14 15:54:40Z vgritsenko $
    +-->

<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
  
  <map:components>
    <map:transformers default="xslt">
      <map:transformer name="i18n" src="org.apache.cocoon.transformation.I18nTransformer">
        <catalogues default="forms">
          <catalogue id="other" name="OtherMessages" location="messages"/>
          <catalogue id="forms" name="FormsMessages" location="messages"/>
        </catalogues>
      </map:transformer>
    </map:transformers>
  </map:components>
  
<!-- =========================== Views =================================== -->

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

    <map:view from-label="content" name="pretty-content">
      <map:transform src="context://stylesheets/system/xml2html.xslt"/>
      <map:serialize type="html"/>
    </map:view>

    <map:view from-position="last" name="links">
      <map:serialize type="links"/>
    </map:view>
  </map:views>


  <map:resources>
    <map:resource name="serialize-jx-screen" >
      <map:transform src="context://samples/common/style/xsl/html/simple-page2html.xsl">
        <map:parameter name="servletPath" value="{request:servletPath}"/>
        <map:parameter name="sitemapURI" value="{request:sitemapURI}"/>
        <map:parameter name="contextPath" value="{request:contextPath}"/>
        <map:parameter name="file" value="/samples/apples/{screen-src}"/>
        <map:parameter name="remove" value="{0}"/>
      </map:transform>
      <map:serialize type="html" />    
    </map:resource>
  </map:resources>


  <map:flow language="apples"/>


  <map:pipelines>
    <map:pipeline>

      <map:match pattern="">
        <map:generate src="welcome.xml"/>
        <map:transform src="context://samples/common/style/xsl/html/simple-samples2html.xsl">
          <map:parameter name="contextPath" value="{request:contextPath}"/>
        </map:transform>
        <map:serialize/>
      </map:match>

      <map:match pattern="*.continue">
        <map:call continuation="{1}"/>
      </map:match>

      <map:match pattern="continue.*">
        <map:call continuation="{1}"/>
      </map:match>     

      <!--+
          |   Binding form sample, reuses pipelines stolen from Cocoon Forms
          +-->

      <map:match pattern="form2xml.flow">
        <map:call function="org.apache.cocoon.components.flow.apples.samples.BindingWoodyApple">
          <map:parameter name="form-src" value="context://samples/blocks/forms/forms/form2_model.xml"/>
          <map:parameter name="binding-src" value="context://samples/blocks/forms/forms/form2_bind_xml.xml"/>
          <map:parameter name="documentURI" value="context://samples/blocks/forms/forms/form2_data.xml"/>
          <map:parameter name="form-pipe" value="/samples/blocks/forms/form2-display-pipeline"/>
          <map:parameter name="valid-pipe" value="/samples/blocks/forms/form2-success-pipeline"/>
        </map:call>
      </map:match>


      <!--+ 
          |  Calculator sample, uses stolen and modified xsp's from flowscript sample
          +-->

      <map:match pattern="calc.flow">
        <map:call function="org.apache.cocoon.components.flow.apples.samples.CalculationApple"/>
      </map:match>

      <map:match pattern="calc/*">
        <map:generate type="jx" src="context://samples/flow/jxcalc/screens/{1}.xml"/>
        <map:transform src="context://samples/common/style/xsl/html/simple-page2html.xsl">
          <map:parameter name="servletPath" value="{request:servletPath}"/>
          <map:parameter name="sitemapURI" value="{request:sitemapURI}"/>
          <map:parameter name="contextPath" value="{request:contextPath}"/>
          <map:parameter name="file" value="samples/flow/jxcalc/screens/{1}.xml"/>
          <map:parameter name="remove" value="{0}"/>
        </map:transform>
        <map:serialize/>
      </map:match>


      <!--+ 
          |  Guess Game sample, borrowed setup from the uses stolen and modified xsp's from flowscript
          +-->

      <map:match pattern="guess.flow">
        <map:call function="org.apache.cocoon.components.flow.apples.samples.GuessGameApple"/>
      </map:match>


      <!--+ 
          |  Tower of Hanoi Puzzle sample.
          +-->

      <map:match pattern="hanoi.flow">
        <map:call function="org.apache.cocoon.components.flow.apples.samples.HanoiApple"/>
      </map:match>


      <!--+ 
          |  JX screen pipes 
          +-->    

      <map:match pattern="hanoi/hanoi.jx">
        <map:generate type="jx" src="hanoi/hanoi.jx"/>
        <map:transform src="hanoi/hanoi.xsl" />
        <map:call resource="serialize-jx-screen">
          <map:parameter name="screen-src" value="hanoi/hanoi.jx"/>
        </map:call>
      </map:match>

      <map:match pattern="*/*.jx">
        <map:generate type="jx" src="{1}/{2}.jx"/>
        <map:call resource="serialize-jx-screen">
          <map:parameter name="screen-src" value="{1}/{2}.jx"/>
        </map:call>
      </map:match>

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