Search code examples
javaxslt-1.0dspace

How to shorten filename displayed in DSpace


I would like to shorten the file name that is being displayed in the simple item view.

If I have a very long file name, this is displayed in the simple item record:

simple-view

This example file name is shortened if you view the full item record:

full-record-view

But if you edit this item and click the Item Bitstreams tab, the file name is being displayed like this:

enter image description here

My goal is to apply what is being displayed in the edit bitstream (the 3rd picture) to the simple and full item view. I don't know where this transformation is being generated. I looked at administrative.xsl and I can't find anything on the shortening of the file name. Please advice on how to achieve this or where to look for this transformation.


Solution

  • The rewrite of the file name in the "Item Bitstreams" tab is done in Java code, not in the XSL. It's here: EditItemBitstreamsForm.java.

    Your item page screenshot looks like you're working in XMLUI / Mirage 2, is that right? Your best bet is to use the shortenString method in org.dspace.app.xmlui.utils.XSLUtils (code). Actually maybe you aren't using Mirage 2 because Mirage 2 does just that, see item-view.xsl:

    <xsl:value-of select="util:shortenString(mets:FLocat[@LOCTYPE='URL']/@xlink:title, 30, 5)"/>