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

    The contents of this file are subject to the license and copyright
    detailed in the LICENSE and NOTICE files at the root of the source
    tree and available online at

    http://www.dspace.org/license/

-->

<!--

The BrowseArtifacts Aspect is responsible for browsing communities /
collections / items / and bitstreams.

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

        <map:transformers>
            <map:transformer name="Navigation" src="org.dspace.app.xmlui.aspect.browseArtifacts.Navigation"/>
            <map:transformer name="CommunityBrowser" src="org.dspace.app.xmlui.aspect.artifactbrowser.CommunityBrowser"/>
            <map:transformer name="CommunityBrowse" src="org.dspace.app.xmlui.aspect.browseArtifacts.CommunityBrowse"/>
            <map:transformer name="CollectionBrowse" src="org.dspace.app.xmlui.aspect.browseArtifacts.CollectionBrowse"/>
            <map:transformer name="ConfigurableBrowse" src="org.dspace.app.xmlui.aspect.artifactbrowser.ConfigurableBrowse"/>
            <map:transformer name="StaticPage" src="org.dspace.app.xmlui.aspect.browseArtifacts.StaticPage"/>
        </map:transformers>

        <map:matchers default="wildcard">
                <map:matcher name="HandleTypeMatcher" src="org.dspace.app.xmlui.aspect.general.HandleTypeMatcher"/>
                <map:matcher name="HandleAuthorizedMatcher" src="org.dspace.app.xmlui.aspect.general.HandleAuthorizedMatcher"/>
                <map:matcher name="ContainerHomePageSelector" src="org.dspace.app.xmlui.aspect.viewArtifacts.ContainerHomePageMatcher"/>
        </map:matchers>
    </map:components>

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

            <!--
                    Navigation links to browse the repository.
                    - This includes links that are relative to the currently
            -->
            <map:transform type="Navigation"/>

            <map:match pattern="">
                <map:transform type="CommunityBrowser">
                        <map:parameter name="depth" value="1"/>
                </map:transform>
                <map:serialize type="xml"/>
            </map:match>

            <!-- List all communities & collections in DSpace -->
            <map:match pattern="community-list">
                    <map:transform type="CommunityBrowser">
                            <map:parameter name="depth" value="999"/>
                    </map:transform>
                    <map:serialize type="xml"/>
            </map:match>

            <map:match pattern="page/*">
                <map:transform type="StaticPage"/>
                <map:serialize type="xml"/>
            </map:match>

            <!-- Browse (by anything) -->
            <map:match pattern="browse">
                    <map:transform type="ConfigurableBrowse"/>
                    <map:serialize type="xml"/>
            </map:match>

            <!-- Handle specific features -->
            <map:match pattern="handle/*/**">
                <map:match type="HandleAuthorizedMatcher" pattern="READ">
                    <map:match type="HandleTypeMatcher" pattern="community,collection">
                        <!-- Browse (by anything) -->
                        <map:match pattern="handle/*/*/browse">
                            <map:transform type="ConfigurableBrowse"/>
                            <map:serialize type="xml"/>
                        </map:match>

                        <map:match type="HandleTypeMatcher" pattern="community">
                            <map:match pattern="handle/*/*">
                                <map:transform type="CommunityBrowse"/>
                            </map:match>
                        </map:match>

                        <map:match type="HandleTypeMatcher" pattern="collection">
                            <map:match pattern="handle/*/*">
                                <map:match type="ContainerHomePageSelector" pattern="metadata">
                                    <map:transform type="CollectionBrowse"/>
                                </map:match>
                            </map:match>
                        </map:match>

                    </map:match>

                </map:match>

            </map:match>

            <!-- Not a URL we care about, so just pass it on. -->
            <map:serialize type="xml"/>

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