<?xml version="1.0"?>
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
    <!-- =========================== Components ================================ -->
    <map:components>
        <map:generators default="xsp">
            <map:generator name="xsp" src="org.apache.cocoon.generation.ServerPagesGenerator" logger="sitemap.generator.serverpages" pool-max="32" pool-min="4" pool-grow="2"/>
            <map:generator name="directory" src="org.apache.cocoon.generation.DirectoryGenerator" logger="sitemap.generator.directory" label="content,data" pool-max="16" pool-min="2" pool-grow="2"/>
        </map:generators>
        <map:transformers default="xsl">
            <map:transformer name="xsl" src="org.apache.cocoon.transformation.TraxTransformer" logger="sitemap.transformer.xslt" pool-max="32" pool-min="8" pool-grow="2">
                <use-request-parameters>true</use-request-parameters>
                <xslt-processor-role>saxon</xslt-processor-role>
            </map:transformer>
        </map:transformers>
        <map:readers default="resource">
            <map:reader name="resource" src="org.apache.cocoon.reading.ResourceReader" logger="sitemap.reader.resource" pool-max="32"/>
            <map:reader name="getatt" logger="sdx.sitemap.DocumentReader" src="fr.gouv.culture.sdx.sitemap.DocumentReader"/>
        </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" pool-max="32" pool-min="16" pool-grow="4"/>
        </map:serializers>
        <map:actions default="superuser">
            <map:action name="superuser" logger="sdx.sitemap.SuperuserAction" src="fr.gouv.culture.sdx.sitemap.SuperuserAction"/>
            <map:action name="request" src="org.apache.cocoon.acting.RequestParamAction"/>
        </map:actions>
        <map:matchers default="wildcard">
            <map:matcher name="wildcard" src="org.apache.cocoon.matching.WildcardURIMatcher"/>
            <map:matcher name="request" logger="sitemap.matcher.request-parameter" src="org.apache.cocoon.matching.RequestParameterMatcher"/>
        </map:matchers>
    </map:components>
    <!-- =========================== Pipelines ================================= -->
    <map:pipelines>
        <map:pipeline id="normal">
			<!-- needed to set superuser before all -->
			<map:match pattern="superuser.xsp">
				<map:generate type="xsp" src="superuser.xsp"/>
				<map:transform src="xsl/superuser.xsl">
					<use-request-parameters>true</use-request-parameters>
				</map:transform>
				<map:serialize/>
			</map:match>
            <!-- handle all request except to set superuser at first -->
            <map:act type="superuser">
                <map:match pattern="*.xml">
                    <map:generate type="xsp" src="{1}.xsp"/>
                    <map:serialize type="xml"/>
                </map:match>
                <map:match pattern="*.xsp">
                    <map:generate type="xsp" src="{1}.xsp"/>
                    <map:transform src="xsl/{1}.xsl">
                        <use-request-parameters>true</use-request-parameters>
                    </map:transform>
                    <map:serialize/>
                </map:match>
                <map:match pattern="index.xsp">
                    <map:generate type="xsp" src="welcome.xsp"/>
                    <map:transform src="xsl/welcome.xsl"/>
                    <map:serialize/>
                </map:match>
                <map:match pattern="*">
                    <map:redirect-to uri="index.xsp"/>
                </map:match>
            </map:act>
        </map:pipeline>
        <!-- pipeline for first visit -->
        <map:pipeline id="first">
            <!-- When here, if nothing have match, perhaps a problem of superuser not set -->
            <map:match pattern="**">
                <map:redirect-to uri="cocoon:/superuser.xsp"/>
            </map:match>
        </map:pipeline>
    </map:pipelines>
</map:sitemap>
