我正在尝试显示收获物品的缩略图。我对收割选项的设置是收割元数据和对比特流的引用(需要ORE支持)。在寻找有关DSpace如何在简单视图中显示收获项目的位流的文件名和文件大小的代码时,我发现在https://github.com/DSpace/DSpace/blob/dspace-6.1/dspace-xmlui-mirage2/src/main/webapp/xsl/aspect/artifactbrowser/item-view.xsl#L375-L378
<!-- Special case for handling ORE resource maps stored as DSpace bitstreams -->
<xsl:when test="//mets:fileSec/mets:fileGrp[@USE='ORE']">
<xsl:apply-templates select="//mets:fileSec/mets:fileGrp[@USE='ORE']" mode="itemSummaryView-DIM" />
</xsl:when>
<!-- Special case for handling ORE resource maps stored as DSpace bitstreams -->
<xsl:when test="./mets:fileSec/mets:fileGrp[@USE='ORE']">
<xsl:apply-templates select="./mets:fileSec/mets:fileGrp[@USE='ORE']" mode="itemDetailView-DIM" />
</xsl:when>
所以看来item-view.xsl
中的代码正在调用ORE.xsl
中的模板匹配。
[现在,在ORE.xsl
中专门查看收获物品的样本mets.xml
文件,我们可以看到它引用了//mets:fileSec/mets:fileGrp[@USE='ORE']
中的ORE.xml
。
/bitstream/handle/10862/3360/ORE.xml
基于在<mets:fileSec>
<mets:fileGrp USE="ORE">
<mets:file GROUPID="group_file_f148a8ad-b7ad-49fe-8b4b-0d3893d2c351" CHECKSUM="7afebcfcf393395503377219395e3926" MIMETYPE="text/xml" SIZE="4137" ID="file_f148a8ad-b7ad-49fe-8b4b-0d3893d2c351" CHECKSUMTYPE="MD5">
<mets:FLocat LOCTYPE="URL" xlink:href="/bitstream/handle/10862/3360/ORE.xml?sequence=1&isAllowed=y" xlink:type="locator" xlink:title="ORE.xml"/>
</mets:file>
</mets:fileGrp>
</mets:fileSec>
中找到的模板匹配,我们可以看到文件名和文件大小是通过以下代码生成的:
ORE.xsl
查看<xsl:template match="mets:fileGrp[@USE='ORE']" mode="itemSummaryView-DIM">
<xsl:variable name="AtomMapURL" select="concat('cocoon:/',substring-after(mets:file/mets:FLocat[@LOCTYPE='URL']//@*[local-name(.)='href'],$context-path))"/>
<div class="item-page-field-wrapper table">
<h5>
<i18n:text>xmlui.dri2xhtml.METS-1.0.item-files-viewOpen</i18n:text>
</h5>
<xsl:for-each select="document($AtomMapURL)/atom:entry/atom:link[@rel='http://www.openarchives.org/ore/terms/aggregates']">
<xsl:variable name="link_href" select="@href"/>
<xsl:if test="/atom:entry/oreatom:triples/rdf:Description[@rdf:about=$link_href][dcterms:description='ORIGINAL']
or not(/atom:entry/oreatom:triples/rdf:Description[@rdf:about=$link_href])">
<xsl:call-template name="itemSummaryView-DIM-file-section-entry">
<xsl:with-param name="href" select="@href" />
<xsl:with-param name="mimetype" select="@type" />
<xsl:with-param name="label-1" select="'title'" />
<xsl:with-param name="label-2" select="'title'" />
<xsl:with-param name="title" select="@title" />
<xsl:with-param name="label" select="@title" />
<xsl:with-param name="size" select="@length" />
</xsl:call-template>
</xsl:if>
</xsl:for-each>
</div>
</xsl:template>
,我们可以看到,除了/bitstream/handle/10862/3360/ORE.xml
包外,ORIGINAL
和TEXT
包在收获时也被捕获了。
THUMBNAIL
现在,我的目标是捕获并重新使用在<atom:link href="https://repository.seafdec.org.ph/bitstream/10862/152/1/ediblecrustacea.pdf" length="2310365" rel="http://www.openarchives.org/ore/terms/aggregates" title="ediblecrustacea.pdf" type="application/pdf"/>
<atom:link href="https://repository.seafdec.org.ph/bitstream/10862/152/4/edible-crust-errata.pdf" length="177699" rel="http://www.openarchives.org/ore/terms/aggregates" title="edible-crust-errata.pdf" type="application/pdf"/>
<oreatom:triples>
<rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" rdf:about="http://hdl.handle.net/10862/152/ore.xml#atom">
<rdf:type rdf:resource="http://www.dspace.org/objectModel/DSpaceItem"/>
<dcterms:modified>2011-06-07T06:45:26Z</dcterms:modified>
</rdf:Description>
<rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" rdf:about="https://repository.seafdec.org.ph/bitstream/10862/152/35/edible-crust-errata.pdf.txt">
<rdf:type rdf:resource="http://www.dspace.org/objectModel/DSpaceBitstream"/>
<dcterms:description>TEXT</dcterms:description>
</rdf:Description>
<rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" rdf:about="https://repository.seafdec.org.ph/bitstream/10862/152/36/ediblecrustacea.pdf.txt">
<rdf:type rdf:resource="http://www.dspace.org/objectModel/DSpaceBitstream"/>
<dcterms:description>TEXT</dcterms:description>
</rdf:Description>
<rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" rdf:about="https://repository.seafdec.org.ph/bitstream/10862/152/1/ediblecrustacea.pdf">
<rdf:type rdf:resource="http://www.dspace.org/objectModel/DSpaceBitstream"/>
<dcterms:description>ORIGINAL</dcterms:description>
</rdf:Description>
<rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" rdf:about="https://repository.seafdec.org.ph/bitstream/10862/152/4/edible-crust-errata.pdf">
<rdf:type rdf:resource="http://www.dspace.org/objectModel/DSpaceBitstream"/>
<dcterms:description>ORIGINAL</dcterms:description>
</rdf:Description>
<rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" rdf:about="https://repository.seafdec.org.ph/bitstream/10862/152/32/ediblecrustacea.pdf.jpg">
<rdf:type rdf:resource="http://www.dspace.org/objectModel/DSpaceBitstream"/>
<dcterms:description>THUMBNAIL</dcterms:description>
</rdf:Description>
<rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" rdf:about="https://repository.seafdec.org.ph/bitstream/10862/152/33/edible-crust-errata.pdf.jpg">
<rdf:type rdf:resource="http://www.dspace.org/objectModel/DSpaceBitstream"/>
<dcterms:description>THUMBNAIL</dcterms:description>
</rdf:Description>
</oreatom:triples>
中找到的url,并将其用作在/atom:entry/oreatom:triples/rdf:Description[@rdf:about][dcterms:description='THUMBNAIL']
和src
模板的代码中找到的缩略图的itemSummaryView-DIM-thumnail
。 。顺便说一句,此项目中的文件视图仍然不是很好,所以...
itemSummaryView-DIM-thumnail
关于以简单视图显示缩略图,我正在考虑在mets:file
模板中有一个mets:file
,即:
我现在的问题是,我不知道如何在<xsl:when test="//mets:fileSec/mets:fileGrp[@USE='ORE']">
文件中引用缩略图的网址。我还注意到,名称和文件大小是根据上述itemSummaryView-DIM-thumbnail
代码从 <xsl:choose>
<xsl:when test="//mets:fileSec/mets:fileGrp[@USE='THUMBNAIL']">
<xsl:variable name="src">
<xsl:choose>
<xsl:when test="/mets:METS/mets:fileSec/mets:fileGrp[@USE='THUMBNAIL']/mets:file[@GROUPID=../../mets:fileGrp[@USE='CONTENT']/mets:file[@GROUPID=../../mets:fileGrp[@USE='THUMBNAIL']/mets:file/@GROUPID][1]/@GROUPID]">
<xsl:value-of
select="/mets:METS/mets:fileSec/mets:fileGrp[@USE='THUMBNAIL']/mets:file[@GROUPID=../../mets:fileGrp[@USE='CONTENT']/mets:file[@GROUPID=../../mets:fileGrp[@USE='THUMBNAIL']/mets:file/@GROUPID][1]/@GROUPID]/mets:FLocat[@LOCTYPE='URL']/@xlink:href"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of
select="//mets:fileSec/mets:fileGrp[@USE='THUMBNAIL']/mets:file/mets:FLocat[@LOCTYPE='URL']/@xlink:href"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Checking if Thumbnail is restricted and if so, show a restricted image -->
<xsl:choose>
<xsl:when test="contains($src,'isAllowed=n')"/>
<xsl:otherwise>
<img class="img-thumbnail" alt="Thumbnail">
<xsl:attribute name="src">
<xsl:value-of select="$src"/>
</xsl:attribute>
</img>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="//mets:fileSec/mets:fileGrp[@USE='ORE']">
<xsl:apply-templates select="//mets:fileSec/mets:fileGrp[@USE='ORE']" mode="itemSummaryView-DIM-thumbnail" />
</xsl:when>
<xsl:otherwise>
<img class="img-thumbnail" alt="Thumbnail">
<xsl:attribute name="data-src">
<xsl:text>holder.js/100%x</xsl:text>
<xsl:value-of select="$thumbnail.maxheight"/>
<xsl:text>/text:No Thumbnail</xsl:text>
</xsl:attribute>
</img>
</xsl:otherwise>
</xsl:choose>
中提取的。
提前感谢!
UPDATE
这是我所做的:我修改了源服务器的ORE.xml
,以便当使用/atom:entry/atom:link[@rel='http://www.openarchives.org/ore/terms/aggregates']
作为元数据格式时,它将在ORE.xsl
输出的[dspace]/config/crosswalks/oai/metadataFormats/ore.xsl
部分中显示缩略图,但是我必须清理oai的缓存并执行在源服务器中完全重新导入OAI。另外,我必须从收获服务器重置并导入收获,以包括新生成的<atom:link rel="http://www.openarchives.org/ore/terms/aggregates">
文件。我所做的修改是将OAI
的行号67从[]更改为
ore
进入:
ORE.xml
然后在
ore.xsl
中,我将此行包括在<xsl:if test="doc:field[@name='name']/text() = 'ORIGINAL'">
中:
然后,在<xsl:if test="doc:field[@name='name']/text() = 'ORIGINAL' or doc:field[@name='name']/text() = 'THUMBNAIL'">
中,我包括以下几行:
item-view.xsl
这是有效的,除了在源项目中有多个缩略图的情况下,即使我处于测试条件
<xsl:template name="itemSummaryView-DIM-thumbnail">
,它也会显示多个缩略图。请参见下面的屏幕截图:
[dspace]/webapps/xmlui/themes/Mirage2/xsl/aspect/artifactbrowser/ORE.xsl
而且,我宁愿不修改源服务器的人行横道目录中的<xsl:template match="mets:fileGrp[@USE='ORE']" mode="itemSummaryView-DIM-thumbnail">
<xsl:variable name="AtomMapURL" select="concat('cocoon:/',substring-after(mets:file/mets:FLocat[@LOCTYPE='URL']//@*[local-name(.)='href'],$context-path))"/>
<xsl:apply-templates select="document($AtomMapURL)/atom:entry/atom:link[@rel='http://www.openarchives.org/ore/terms/aggregates']" mode="itemSummaryView-DIM-thumbnail"/>
</xsl:template>
<xsl:template match="atom:link[@rel='http://www.openarchives.org/ore/terms/aggregates']" mode="itemSummaryView-DIM-thumbnail">
<xsl:variable name="link_href" select="@href"/>
<xsl:if test="/atom:entry/oreatom:triples/rdf:Description[@rdf:about=$link_href][dcterms:description='THUMBNAIL' and position() = 1]
or not(/atom:entry/oreatom:triples/rdf:Description[@rdf:about=$link_href])">
<img class="img-thumbnail" alt="Thumbnail">
<xsl:attribute name="src">
<xsl:value-of select="@href"/>
</xsl:attribute>
</img>
</xsl:if>
</xsl:template>
,因此,本帖子:<xsl:if test="/atom:entry/oreatom:triples/rdf:Description[@rdf:about=$link_href][dcterms:description='THUMBNAIL' and position() = 1] or not(/atom:entry/oreatom:triples/rdf:Description[@rdf:about=$link_href])">
UPDATE 2-缩略图现在显示在简单的项目视图中
我做了什么:
ore.xsl
然后,我在Extract attribute value if child node contains this text中添加了此模板:
<xsl:template name="itemSummaryView-DIM-thumbnail">
我的收获物品现在在物品摘要视图中显示缩略图:
<xsl:when test="//mets:fileSec/mets:fileGrp[@USE='ORE']"> <xsl:apply-templates select="//mets:fileSec/mets:fileGrp[@USE='ORE']" mode="itemSummaryView-DIM-thumbnail" /> </xsl:when>
如果我还可以使缩略图显示在项目列表和搜索结果中,那真是太好了,但是现在,我不知道如何匹配和选择缩略图URL。我不知道如何从ORE.xsl
模板中引用它们。
我正在尝试显示收获物品的缩略图。我对Harvesting选项的设置是Harvest元数据和对比特流的引用(需要ORE支持)。当寻找...
供我将来参考,这是我为显示已收获物品的缩略图所做的。