问题
I just "inherited" this repository in my office. I have no experience at all with it and I've been asked to show custom metadata below an item's title in the summary view. The custom metadata has already been registered (it is called dc.magazine.title) and I managed to edit the input forms so that all the new metadata can be registered in the database.
The repository is using the default mirage theme with XMLUI. I have changed some code in the file DIM-Handler.xsl trying to emulate how the other info is rendered but I have no idea how it works so my approach has given no results. This is what I tried:
<!-- Magazine row -->
<tr class="ds-table-row {$phase}">
<td><span class="bold"><i18n:text>xmlui.dri2xhtml.METS-1.0.item-title</i18n:text>: </span></td>
<td>
<xsl:choose>
<xsl:when test="count(dim:field[@element='magazine'][@qualifier='title']) = 1">
<xsl:value-of select="dim:field[@element='magazine'][@qualifier='title'][1]/node()"/>
</xsl:when>
<xsl:otherwise>
<i18n:text>xmlui.dri2xhtml.METS-1.0.no-title</i18n:text>
</xsl:otherwise>
</xsl:choose>
</td>
</tr>
<xsl:call-template name="itemSummaryView-DIM-fields">
<xsl:with-param name="clause" select="($clause + 1)"/>
<xsl:with-param name="phase" select="$otherPhase"/>
</xsl:call-template>
But nothing is showing besides the default metadata. Can somebody give me a hand on how to show this new metadata? Some clues on how this code works so I can make future changes will be really appreciated!
回答1:
If you are using the default installation of DSpace using the Mirage 1 theme, the display of the item's metadata is rendered in [DSpace-installed-directory]/webapps/xmlui/themes/Mirage/lib/xsl/aspect/artifactbrowser/item-view.xsl
. In my comment, I specified [DSpace-installed-directory]
since I'm not so sure if the repository you 'inherited' could be using a customized theme with a different theme name other than Mirage.
You said that you are required to show a custom metadata below the item's title. Try to insert this before the <!-- Author(s) row -->
<xsl:when test="$clause = 2 and (dim:field[@element='magazine' and @qualifier='title' and descendant::text()])">
<div class="simple-item-view-other">
<span class="bold"><i18n:text>xmlui.dri2xhtml.METS-1.0.item-title</i18n:text>:</span>
<span>
<xsl:for-each select="dim:field[@element='magazine' and @qualifier='title']">
<xsl:value-of select="./node()"/>
<xsl:if test="count(following-sibling::dim:field[@element='magazine' and @qualifier='title']) != 0">
<br/>
</xsl:if>
</xsl:for-each>
</span>
</div>
<xsl:call-template name="itemSummaryView-DIM-fields">
<xsl:with-param name="clause" select="($clause + 1)"/>
<xsl:with-param name="phase" select="$otherPhase"/>
</xsl:call-template>
</xsl:when>
Please take note of the $clause
number. You should update all the clause number below ie the author's row should be $clause = 3
down to the part of
<!-- IMPORTANT: This test should be updated if clauses are added! -->
<xsl:if test="$clause < 8">
<xsl:call-template name="itemSummaryView-DIM-fields">
<xsl:with-param name="clause" select="($clause + 1)"/>
<xsl:with-param name="phase" select="$phase"/>
</xsl:call-template>
</xsl:if>
来源:https://stackoverflow.com/questions/32074688/how-to-show-custom-metadata-in-dspaces-summary-view