Search code examples
dspace

Is there a way to determine the handle of the owning collection of an item just using XSLT in DSpace?


This is related to this question. Outside of item-view.xsl, is there a way to retrieve the handle of the owning collection of an item say for example from the front page? In the front page, there's a list of recently submitted items, but looking at the mets file of a particular item, there is no reference to what collection it belongs.

My use case for this is for example in the recently submitted list, I want to exclude items that belongs to a certain collection. I'm not talking about a restricted collection here. Recently submitted items from that collection should not show up in the front page.

I'm using DSpace version 5.3 Mirage 2 theme.

Thanks in advance.


Solution

  • If you have a handle a/b, you can retrieve the XML for that object.

    document("/handle/a/b?XML")
    

    That XML will contain a hierarchy of collections/communities containing the item.

    document("handle/a/b?XML")//dri:trail[@target]
    

    The handle for the collection will be in the last trail element containing a target attribute.