Search code examples
xsltsitemapdspaceapache-cocoon

Viewing an uploaded item in DSpace 4.2 xmlui


This is how the my search results page of DSpace looks like :

enter image description here On clicking the item a new page opens up showing its description:

enter image description here

The description page opens the file upon clicking View/Open. Is it possible to directly open the file upon clicking its title on the results page? I want to skip the item description page.

As per my understanding this is the Java file which is called to render items. Do I need to make changes to this file? Or is it possible to achieve what I want by simply modifying the sitemap and xsl files?


Solution

  • I was able to achieve what I wanted with help from Antoine Snyers, terrywb and this link. As pointed out by terrywb the information which I needed to read, i.e, the bitstream address of the uploaded file, was stored in the metsDoc. Here's a screenshot of my metsDoc with the fileSec expanded:

    enter image description here

    To be able to access the fileSec of the metsDoc I changed this line in discovery.xsl and this line in common.xsl to <xsl:text>?sections=dmdSec,fileSec&amp;fileGrpTypes=ORIGINAL,THUMBNAIL</xsl:text>.

    Then I added/modified the following code to the itemSummaryList in discovery.xsl so that the title hyperlink now points to the file bitstream.

    <xsl:variable name="filetype">
        <xsl:value-of select="$metsDoc/mets:METS/mets:fileSec/mets:fileGrp[@USE='CONTENT']"/>
    </xsl:variable> 
    
    <xsl:variable name="fileurl">
        <xsl:value-of select="$metsDoc/mets:METS/mets:fileSec/mets:fileGrp[@USE='CONTENT']/mets:file/mets:FLocat[@LOCTYPE='URL']/@xlink:href"/>
    </xsl:variable> 
    
    
    <div class="artifact-title">
    
                <xsl:element name="a">
                    <xsl:attribute name="href">
                        <xsl:choose>
                            <xsl:when test="$metsDoc/mets:METS/mets:dmdSec/mets:mdWrap/mets:xmlData/dim:dim/@withdrawn">
                                <xsl:value-of select="$metsDoc/mets:METS/@OBJEDIT"/>
                            </xsl:when>
    
    
                <xsl:when test="$filetype">
                    <xsl:value-of select="$fileurl"/>
                </xsl:when>
    
                        </xsl:choose>
    
                    </xsl:attribute>
    

    Similarly, I also made changes to item-list.xsl file, and added this line <xsl:apply-templates select="mets:fileSec/mets:fileGrp[@USE='CONTENT']" mode="itemSummaryList-DIM"/> to the template itemSummaryList-DIM.

    So finally I got my desired result: enter image description here

    As visible in the inspector, the href attribute of the title now points to the original bitstream of the file :)