<?xml version="1.0" encoding="UTF-8"?>

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

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

	<map:components>
		<map:generators default="file">
			<map:generator name="xquery" 
                logger="sitemap.generator.xquery"
				src="org.exist.cocoon.XQueryGenerator">
            </map:generator>
		</map:generators>
	  	<map:readers default="resource"/>
	  	<map:serializers default="html"/>
	  	<map:selectors default="browser"/>
	  	<map:matchers default="wildcard"/>
	  	<map:transformers default="xslt">
	  	</map:transformers>
        <map:actions/>
	</map:components>

<!-- =========================== Pipelines ================================= -->
 
    <map:pipelines>
        <map:pipeline>

            <map:match pattern="*.gif">
                <map:read src="{1}.gif" mime-type="image/gif"/>
            </map:match>
            
            <map:match pattern="">
                <map:redirect-to uri="biblio.xq"/>
            </map:match>
            
            <map:match pattern="*.xml">
                <map:generate src="{1}.xml"/>
                <map:transform type="xinclude"/>
                <map:transform src="context://stylesheets/doc2html-2.xsl"/>
                <map:transform type="encodeURL"/>
                <map:serialize encoding="UTF-8" type="html"/>
            </map:match>

            <map:match pattern="biblio.xq">
                <map:act src="xmldb:exist:///db" type="xmldb-login">
                    <map:select type="request-parameter">
                        <map:parameter name="parameter-name" value="action"/>
                        <map:when test="logout">
                            <map:act type="session-invalidator"/>
                        </map:when>
                        <map:otherwise>
                            <map:generate src="biblio.xq" type="xquery"/>
                            <map:transform type="xinclude"/>
                            <map:transform type="encodeURL"/>
                            <map:serialize encoding="UTF-8" type="html"/>
                        </map:otherwise>
                    </map:select>
                </map:act>
                <!-- no session found: display login form -->
                <map:generate src="login.xhtml"/>
                <map:serialize type="html"/>
            </map:match>
            
            <map:match pattern="export.xq">
                <map:generate src="export.xq" type="xquery"/>
                <map:serialize encoding="UTF-8" type="xml"/>
            </map:match>
            
			<map:match pattern="*.xq">
                <map:generate src="{1}.xq" type="xquery">
                    <map:parameter name="file" value="{1}.xq"/>
				</map:generate>
				<map:serialize encoding="UTF-8" type="html"/>
	        </map:match>
            
            <map:match pattern="source/*.xq">
                <map:read src="{1}.xq" mime-type="text/text"/>
            </map:match>

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

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

</map:sitemap>
