如何从另一个项目访问或检索一个项目的 mets 内容?

How to access or retrieve mets content of an item from another item?

我的用例是我有一个项目在另一个项目中有一个 link。例如,项目 123456789/152 有一个元数据字段 dc.relation.hasversion=123456789/717。在 123456789/152 的项目视图中,如何检索 123456789/717 的元数据值?例如,我想从 123456789/152.

中检索 123456789/717dc.language.iso

我查看了 DSpace 中的 Related items 功能,但我不知道 Related items 列表中的元数据是如何显示的从该列表中的项目中提取。

我正在使用 DSpace Version 5.3 Mirage 2 Theme.

编辑

基于代码中的 schweerelos answer, below is my actual code. I am using a custom metadata field dc.relation.languageVersion. Basically, I want to link to that other version but instead of displaying the value, I will display the dc.language.iso of the other version in my item-view.xsl. I've incorporated the of schweerelos to this 但它 只是显示 dc.relation.languageVersion 的值 dc.relation.languageVersion 的样本值为 10665.1/984310665.1/9844 即不是完整的 URI,只是句柄。

提前致谢!

实际代码

<xsl:template name="itemSummaryView-DIM-other-language">
    <xsl:if test="dim:field[@element='relation' and @qualifier='languageVersion' and descendant::text()]">
        <div class="col-sm-6 col-print-4 item-page-field-wrapper">
            <h5><i18n:text>xmlui.dri2xhtml.METS-1.0.item-languageVersion</i18n:text></h5>
            <span>
                <xsl:for-each select="dim:field[@element='relation' and @qualifier='languageVersion']">
                    <xsl:apply-templates  select="./node()" mode="showRelatedLang"/>
                    <xsl:if test="count(following-sibling::dim:field[@element='relation' and @qualifier='languageVersion']) != 0">
                        <xsl:text>; </xsl:text>
                    </xsl:if>
                </xsl:for-each>
            </span>
        </div>
    </xsl:if>
</xsl:template>

<xsl:template match="dim:field[@element='relation' and @qualifier='languageVersion' and descendant::text()]" mode="showRelatedLang">
    <xsl:variable name="otherItemMetadataURL">
        <xsl:text>cocoon:/metadata/handle/</xsl:text>
        <xsl:value-of select="."/>
        <xsl:text>/mets.xml</xsl:text>
    </xsl:variable>
    <xsl:apply-templates select="document($otherItemMetadataURL)" mode="showLang"/>
</xsl:template>

<xsl:template match="dim:field[@element='language' and @qualifier='iso' and descendant::text()]" mode="showLang">
    <xsl:value-of select="util:isoLanguageToDisplay(node())"/>
</xsl:template>

相关项功能使用 Discovery solr 索引,其中 "relatedness" 是通过比较元数据计算得出的。相关项目的元数据也来自 solr 索引,因此您不能为了您的目的轻松地重复使用。

你没有说你正在使用什么 DSpace UI 变体——从你的其他问题我假设 XMLUI(你的问题可能更有帮助对于其他 Stack Overflow 用户,如果您每次都包含您的 DSpace 版本 + UI 变体)。

要检索您知道句柄的项目的元数据,请使用 document() 函数加载该项目的 mets 文件。然后,您可以将模板应用于整个事物或特定的元数据字段。

类似这样的东西(完全未经测试,您可能需要修改它才能使其实际工作):

假设您的 item-view.xsl 有这样的模板(以及确保实际调用模板的代码):

<xsl:template match="dim:field[@element='relation' and @qualifier='hasversion' and descendant::text()]" mode="showRelatedLang">        
    <xsl:variable name="otherItemMetadataURL">        
        <xsl:text>cocoon://metadata/handle/</xsl:text>
        <xsl:value-of select="."/>
        <xsl:text>/mets.xml</xsl:text>
    </xsl:variable>        
    <xsl:apply-templates select="document($otherItemMetadataURL)" mode="showLang"/>
</xsl:template>

<xsl:template match="dim:field[@element='language' and @qualifier='iso' and descendant::text()]" mode="showLang">
    <xsl:value-of select="."/>
</xsl:template>

第一个模板从第一个项目的 dc.relation.hasversion 读取句柄,然后将 URL 构造到第二个项目的 mets 文件并加载 mets 文件。然后它调用第二个模板来加载第二个项目的 mets 文件的结果。第二个模板从dc.language.iso中读取值;因为它是根据 document() 调用的结果调用的,所以这将 select second 项的语言。