Search code examples
dspace

How and where are templates in item-view.xsl called?


In the Mirage theme's page-structure.xsl, I see that the template with match="dri:body" will call </apply-templates> in its <xsl:otherwise> case.

How does this eventually lead to the templates in item-view.xsl being called/generated? Most of the templates in item-view.xsl match elements in the dim: namespace (i.e. match="dim:..."), which are from the mets.xml, not the DRI xml.

I don't see any templates in any .xsl files matching the dri namespace (i.e. match="dri:...") which explicitly call templates within item-view.xsl, such as the template matching dim:dim or mets:file.


Solution

  • Have a look at the DRI of an item page: http://demo.dspace.org/xmlui/DRI/handle/10673/5

    You'll find that the references to the mets.xml are made within the referenceSet elements:

    <referenceSet id="aspect.artifactbrowser.ItemViewer.referenceSet.collection-viewer" n="collection-viewer" type="summaryView">
        <reference repositoryID="10673" type="DSpace Item" url="/metadata/handle/10673/5/mets.xml">
            <referenceSet rend="hierarchy" type="detailList">
                <head>This item appears in the following Collection(s)</head>
                <reference repositoryID="10673" type="DSpace Collection" url="/metadata/handle/10673/2/mets.xml"/>
            </referenceSet>
        </reference>
    </referenceSet>
    

    These referenceSets are matched by the templates in the .../aspect/artifactbrowser/common.xsl file.

    In case the of a "summaryView", this is what happens:

    <xsl:apply-templates select="document($externalMetadataURL)" mode="summaryView"/>
    

    will be matched by (still in common.xsl)

    <xsl:template match="mets:METS[mets:dmdSec/mets:mdWrap[@OTHERMDTYPE='DIM']]" mode="summaryView">
    

    which in turn will call

    <xsl:call-template name="itemSummaryView-DIM"/>
    

    which is one of the top templates templates in item-view.xsl.