helix84,
Thanks for the information, it was very helpful. I started out
attempting a solution similar to what you suggested, but I just
couldn't easily get it to work properly. I managed to get something
working using the xlink:title attribute. I've attached my mets:file
template and a representative mets.xml file so you can see how it
works. I'm going to add another choose/when/test in there so no
lightbox code shows up unless there is definitely a preview bitstream,
but it works for my immediate needs.
As for the larger issue of branded previews not being linked to the
original bitstreams, I've had less success. This doesn't appear to be
something that handled by the media filter itself, rather it seems to
be handled by the xmlui api. For instance the ItemAdapter class
[https://svn.duraspace.org/dspace/dspace/trunk/dspace-xmlui/dspace-xmlui-api/src/main/java/org/dspace/app/xmlui/objectmanager/ItemAdapter.java]
marks THUMBNAIL and TEXT bundles as derivatives of ORIGINAL bitstreams
upon. However, this is hard coded. I tried adding in
'BRANDED_PREVIEW' to this and another class with hard-coded bundles,
and then doing a clean build and update of DSpace, but it doesn't seem
to have any effect. I also tried building new jars and dropped them
into my install, but it didn't work either. I'm not really familiar
with java development though, so I may be making a silly mistake.
On Wed, Nov 14, 2012 at 3:42 AM, helix84 <[email protected]> wrote:
> On Tue, Nov 13, 2012 at 9:06 PM, Jason Sherman <[email protected]> wrote:
>> $context/mets:fileSec/mets:fileGrp[@USE='BRANDED_PREVIEW']/mets:file[@GROUPID=current()/@GROUPID]/mets:FLocat[@LOCTYPE='URL']/@xlink:href
>
> Hi Jason,
>
> are you using this in a template that matches match="mets:file"? Send
> us the whole template and the METS document you're applying it to. You
> can find the METS document on your instance here (example):
>
> /metadata/handle/123456789/100/mets.xml
>
>> CONTENT
>> GROUPID=group_file_12212
>> ID=file_12212
>>
>> THUMBNAIL
>> GROUPID=group_file_12212
>> ID=file_34568
>>
>> BRANDED_PREVIEW:
>> GROUPID=group_file_34569
>> ID=file_34569
>>
>> This seems like it's probably a bug, but it could be somebody's
>> feature. What can I do to change or to work around this behavior?
>
> OK, nice you found that out. How about doing something like this?
>
> <xsl:variable name="$thumbnail_id"
> select="substring($context/mets:fileSec/mets:fileGrp[@USE='THUMBNAIL']/mets:file[@GROUPID=current()/@GROUPID]/@ID,
> 5)"/>
>
> <xsl:value-of select="$context/mets:fileSec/mets:fileGrp[@USE='THUMBNAIL']/
> mets:file[@GROUPID= concat('group_file_', $thumbnail_id)
> ]/mets:FLocat[@LOCTYPE='URL']/@xlink:href"/>
>
> This is completely off the top of my head and probably contains a
> million bugs, but it should give you the idea.
>
>
>> I found very limited documentation about creating custom media filters,
>> but I couldn't find how to make a copy of an existing filter and
>> modify it.
>
> So you probably saw this page:
> https://wiki.duraspace.org/pages/viewpage.action?pageId=27001634#TransformingDSpaceContent(MediaFilters)-CreatingCustomMediaFilters
>
> Why not just make a copy of one of the classes here
> https://github.com/DSpace/DSpace/tree/master/dspace-api/src/main/java/org/dspace/app/mediafilter
>
> change the class name, add it to dspace.cfg and rebuild DSpace?
> Shouldn't be harder than that.
>
>
> Regards,
> ~~helix84
>
> Compulsory reading: DSpace Mailing List Etiquette
> https://wiki.duraspace.org/display/DSPACE/Mailing+List+Etiquette
--
Jason Sherman
Systems Librarian
University of Science and Arts of Oklahoma
405.574.1340
<!-- this is from ../dri2xhtml/General-Handler.xsl -->
<!-- Build a single row in the bitsreams table of the item view page -->
<xsl:template match="mets:file">
<xsl:param name="context" select="."/>
<tr>
<xsl:attribute name="class">
<xsl:text>ds-table-row </xsl:text>
<xsl:if test="(position() mod 2 = 0)">even </xsl:if>
<xsl:if test="(position() mod 2 = 1)">odd </xsl:if>
</xsl:attribute>
<td>
<a>
<xsl:attribute name="href">
<xsl:value-of
select="mets:FLocat[@LOCTYPE='URL']/@xlink:href"/>
</xsl:attribute>
<xsl:attribute name="title">
<xsl:value-of
select="mets:FLocat[@LOCTYPE='URL']/@xlink:title"/>
</xsl:attribute>
<xsl:choose>
<xsl:when
test="string-length(mets:FLocat[@LOCTYPE='URL']/@xlink:title) > 50">
<xsl:variable name="title_length"
select="string-length(mets:FLocat[@LOCTYPE='URL']/@xlink:title)"/>
<xsl:value-of
select="substring(mets:FLocat[@LOCTYPE='URL']/@xlink:title,1,15)"/>
<xsl:text> ... </xsl:text>
<xsl:value-of
select="substring(mets:FLocat[@LOCTYPE='URL']/@xlink:title,$title_length -
25,$title_length)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of
select="mets:FLocat[@LOCTYPE='URL']/@xlink:title"/>
</xsl:otherwise>
</xsl:choose>
</a>
</td>
<!-- File size always comes in bytes and thus needs conversion -->
<td>
<xsl:choose>
<xsl:when test="@SIZE < 1024">
<xsl:value-of select="@SIZE"/>
<i18n:text>xmlui.dri2xhtml.METS-1.0.size-bytes</i18n:text>
</xsl:when>
<xsl:when test="@SIZE < 1024 * 1024">
<xsl:value-of select="substring(string(@SIZE div
1024),1,5)"/>
<i18n:text>xmlui.dri2xhtml.METS-1.0.size-kilobytes</i18n:text>
</xsl:when>
<xsl:when test="@SIZE < 1024 * 1024 * 1024">
<xsl:value-of select="substring(string(@SIZE div (1024
* 1024)),1,5)"/>
<i18n:text>xmlui.dri2xhtml.METS-1.0.size-megabytes</i18n:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="substring(string(@SIZE div (1024
* 1024 * 1024)),1,5)"/>
<i18n:text>xmlui.dri2xhtml.METS-1.0.size-gigabytes</i18n:text>
</xsl:otherwise>
</xsl:choose>
</td>
<!-- Lookup File Type description in local messages.xml based on
MIME Type.
In the original DSpace, this would get resolved to an
application via
the Bitstream Registry, but we are constrained by the
capabilities of METS
and can't really pass that info through. -->
<td>
<xsl:call-template name="getFileTypeDesc">
<xsl:with-param name="mimetype">
<xsl:value-of select="substring-before(@MIMETYPE,'/')"/>
<xsl:text>/</xsl:text>
<xsl:value-of select="substring-after(@MIMETYPE,'/')"/>
</xsl:with-param>
</xsl:call-template>
</td>
<td>
<xsl:choose>
<!-- Assuming there is a branded jpeg preview for any bitstream
with a thumbnail,
generate a thumbnail that links into a lightbox gallery for
that handle. If
you haven't set up lightbox in your xmlui theme, comment this
section out and
uncomment the original code. -->
<xsl:when
test="$context/mets:fileSec/mets:fileGrp[@USE='THUMBNAIL']/
mets:file[@GROUPID=current()/@GROUPID]">
<xsl:variable name="thmbnlttlln"
select="string-length($context/mets:fileSec/mets:fileGrp[@USE='THUMBNAIL']/
mets:file[@GROUPID=current()/@GROUPID]/mets:FLocat[@LOCTYPE='URL']/@xlink:title)-4"
/>
<xsl:variable name="thmbnlttl"
select="substring($context/mets:fileSec/mets:fileGrp[@USE='THUMBNAIL']/
mets:file[@GROUPID=current()/@GROUPID]/mets:FLocat[@LOCTYPE='URL']/@xlink:title,1,$thmbnlttlln)"
/>
<xsl:variable name="branded_preview_title"
select="concat($thmbnlttl,'.preview.jpg')"/>
<a class="image-link">
<xsl:attribute name="rel">
<xsl:text>lightbox[BrandedPreview]</xsl:text>
</xsl:attribute>
<xsl:attribute name="href">
<xsl:value-of
select="$context/mets:fileSec/mets:fileGrp[@USE='BRANDED_PREVIEW']/
mets:file/mets:FLocat[@LOCTYPE='URL'][@xlink:title=$branded_preview_title]/@xlink:href"/>
</xsl:attribute>
<img alt="Thumbnail">
<xsl:attribute name="src">
<xsl:value-of
select="$context/mets:fileSec/mets:fileGrp[@USE='THUMBNAIL']/
mets:file[@GROUPID=current()/@GROUPID]/mets:FLocat[@LOCTYPE='URL']/@xlink:href"/>
</xsl:attribute>
</img>
</a>
</xsl:when>
<!--
<xsl:when
test="$context/mets:fileSec/mets:fileGrp[@USE='THUMBNAIL']/
mets:file[@GROUPID=current()/@GROUPID]">
<a class="image-link">
<xsl:attribute name="href">
<xsl:value-of
select="mets:FLocat[@LOCTYPE='URL']/@xlink:href"/>
</xsl:attribute>
<img alt="Thumbnail">
<xsl:attribute name="src">
<xsl:value-of
select="$context/mets:fileSec/mets:fileGrp[@USE='THUMBNAIL']/
mets:file[@GROUPID=current()/@GROUPID]/mets:FLocat[@LOCTYPE='URL']/@xlink:href"/>
</xsl:attribute>
</img>
</a>
</xsl:when>
-->
<xsl:otherwise>
<a>
<xsl:attribute name="href">
<xsl:value-of
select="mets:FLocat[@LOCTYPE='URL']/@xlink:href"/>
</xsl:attribute>
<i18n:text>xmlui.dri2xhtml.METS-1.0.item-files-viewOpen</i18n:text>
</a>
</xsl:otherwise>
</xsl:choose>
</td>
<!-- Display the contents of 'Description' as long as at least one
bitstream contains a description -->
<xsl:if
test="$context/mets:fileSec/mets:fileGrp[@USE='CONTENT']/mets:file/mets:FLocat/@xlink:label
!= ''">
<td>
<xsl:value-of
select="mets:FLocat[@LOCTYPE='URL']/@xlink:label"/>
</td>
</xsl:if>
</tr>
</xsl:template>
<?xml version="1.0" encoding="UTF-8"?>
<mets:METS xmlns:mets="http://www.loc.gov/METS/" xmlns:xlink="http://www.w3.org/TR/xlink/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dim="http://www.dspace.org/xmlns/dspace/dim" OBJEDIT="/xmlui/admin/item?itemID=1618" OBJID="/xmlui/handle/11076/1620" PROFILE="DSPACE METS SIP Profile 1.0" LABEL="DSpace Item" ID="hdl:11076/1620">
<mets:dmdSec GROUPID="group_dmd_0" ID="dmd_1">
<mets:mdWrap MDTYPE="OTHER" OTHERMDTYPE="DIM">
<mets:xmlData>
<dim:dim dspaceType="ITEM">
<dim:field element="date" qualifier="accessioned" language="" mdschema="dc">2012-09-21T19:01:14Z</dim:field>
<dim:field element="date" qualifier="available" language="" mdschema="dc">2012-09-21T19:01:14Z</dim:field>
<dim:field element="date" qualifier="issued" language="en_US" mdschema="dc">1971-07-08</dim:field>
<dim:field element="identifier" qualifier="uri" language="" mdschema="dc">http://hdl.handle.net/11076/1620</dim:field>
<dim:field element="description" qualifier="provenance" language="en" mdschema="dc">Made available in DSpace on 2012-09-21T19:01:14Z (GMT). No. of bitstreams: 4
19710708.pdf: 210179 bytes, checksum: 74007b2d329cd1fbff7b20ede89eb943 (MD5)
19710708001.tif: 104082 bytes, checksum: 890a550d8c4892c5c5387eb31c372362 (MD5)
19710708002.tif: 86880 bytes, checksum: 89dc505b646d9ceaf1dde87c737915b6 (MD5)
19710708.txt: 8340 bytes, checksum: b106c0777eeb1ef152db31e8417aa8fe (MD5)
Previous issue date: 1971-07-08</dim:field>
<dim:field element="title" language="en_US" mdschema="dc">The Trend, July 08, 1971</dim:field>
</dim:dim>
</mets:xmlData>
</mets:mdWrap>
</mets:dmdSec>
<mets:fileSec>
<mets:fileGrp USE="CONTENT">
<mets:file CHECKSUMTYPE="MD5" GROUPID="group_file_12211" ID="file_12211" MIMETYPE="application/pdf" SIZE="210179" CHECKSUM="74007b2d329cd1fbff7b20ede89eb943">
<mets:FLocat LOCTYPE="URL" xlink:title="19710708.pdf" xlink:type="locator" xlink:href="/xmlui/bitstream/handle/11076/1620/19710708.pdf?sequence=1"/>
</mets:file>
<mets:file CHECKSUMTYPE="MD5" GROUPID="group_file_12212" ID="file_12212" MIMETYPE="image/tiff" SIZE="104082" CHECKSUM="890a550d8c4892c5c5387eb31c372362">
<mets:FLocat LOCTYPE="URL" xlink:title="19710708001.tif" xlink:type="locator" xlink:href="/xmlui/bitstream/handle/11076/1620/19710708001.tif?sequence=2"/>
</mets:file>
<mets:file CHECKSUMTYPE="MD5" GROUPID="group_file_12213" ID="file_12213" MIMETYPE="image/tiff" SIZE="86880" CHECKSUM="89dc505b646d9ceaf1dde87c737915b6">
<mets:FLocat LOCTYPE="URL" xlink:title="19710708002.tif" xlink:type="locator" xlink:href="/xmlui/bitstream/handle/11076/1620/19710708002.tif?sequence=3"/>
</mets:file>
<mets:file CHECKSUMTYPE="MD5" GROUPID="group_file_12214" ID="file_12214" MIMETYPE="text/plain" SIZE="8340" CHECKSUM="b106c0777eeb1ef152db31e8417aa8fe">
<mets:FLocat LOCTYPE="URL" xlink:title="19710708.txt" xlink:type="locator" xlink:href="/xmlui/bitstream/handle/11076/1620/19710708.txt?sequence=4"/>
</mets:file>
</mets:fileGrp>
<mets:fileGrp USE="TEXT">
<mets:file CHECKSUMTYPE="MD5" GROUPID="group_file_12211" ID="file_34687" MIMETYPE="text/plain" SIZE="7600" CHECKSUM="9a1ed01213b97d10788fcfd86256e2a5">
<mets:FLocat LOCTYPE="URL" xlink:title="19710708.pdf.txt" xlink:label="Extracted text" xlink:type="locator" xlink:href="/xmlui/bitstream/handle/11076/1620/19710708.pdf.txt?sequence=187"/>
</mets:file>
<mets:file CHECKSUMTYPE="MD5" GROUPID="group_file_12214" ID="file_34692" MIMETYPE="text/plain" SIZE="8136" CHECKSUM="4778b0e6db88d6b65acdd33d48fbfa13">
<mets:FLocat LOCTYPE="URL" xlink:title="19710708.txt.txt" xlink:label="Extracted text" xlink:type="locator" xlink:href="/xmlui/bitstream/handle/11076/1620/19710708.txt.txt?sequence=192"/>
</mets:file>
</mets:fileGrp>
<mets:fileGrp USE="THUMBNAIL">
<mets:file CHECKSUMTYPE="MD5" GROUPID="group_file_12212" ID="file_34688" MIMETYPE="image/jpeg" SIZE="4650" CHECKSUM="92531142b692a9c64ed6655eae1f5bef">
<mets:FLocat LOCTYPE="URL" xlink:title="19710708001.tif.jpg" xlink:label="Generated Thumbnail" xlink:type="locator" xlink:href="/xmlui/bitstream/handle/11076/1620/19710708001.tif.jpg?sequence=188"/>
</mets:file>
<mets:file CHECKSUMTYPE="MD5" GROUPID="group_file_12213" ID="file_34690" MIMETYPE="image/jpeg" SIZE="4006" CHECKSUM="0e1f9964cda04f8b6c2a73c3785d8d5b">
<mets:FLocat LOCTYPE="URL" xlink:title="19710708002.tif.jpg" xlink:label="Generated Thumbnail" xlink:type="locator" xlink:href="/xmlui/bitstream/handle/11076/1620/19710708002.tif.jpg?sequence=190"/>
</mets:file>
</mets:fileGrp>
<mets:fileGrp USE="BRANDED_PREVIEW">
<mets:file CHECKSUMTYPE="MD5" GROUPID="group_file_34689" ID="file_34689" MIMETYPE="image/jpeg" SIZE="232450" CHECKSUM="7ccf96026993766987b2f28677327e3e">
<mets:FLocat LOCTYPE="URL" xlink:title="19710708001.tif.preview.jpg" xlink:label="Generated Branded Preview" xlink:type="locator" xlink:href="/xmlui/bitstream/handle/11076/1620/19710708001.tif.preview.jpg?sequence=189"/>
</mets:file>
<mets:file CHECKSUMTYPE="MD5" GROUPID="group_file_34691" ID="file_34691" MIMETYPE="image/jpeg" SIZE="205871" CHECKSUM="cbdedf0f6344967b56a3c46775d499dc">
<mets:FLocat LOCTYPE="URL" xlink:title="19710708002.tif.preview.jpg" xlink:label="Generated Branded Preview" xlink:type="locator" xlink:href="/xmlui/bitstream/handle/11076/1620/19710708002.tif.preview.jpg?sequence=191"/>
</mets:file>
</mets:fileGrp>
</mets:fileSec>
<mets:structMap LABEL="DSpace" TYPE="LOGICAL">
<mets:div DMDID="dmd_1" TYPE="DSpace Item">
<mets:div ID="div_2" TYPE="DSpace Content Bitstream">
<mets:fptr FILEID="file_12211"/>
</mets:div>
<mets:div ID="div_3" TYPE="DSpace Content Bitstream">
<mets:fptr FILEID="file_12212"/>
</mets:div>
<mets:div ID="div_4" TYPE="DSpace Content Bitstream">
<mets:fptr FILEID="file_12213"/>
</mets:div>
<mets:div ID="div_5" TYPE="DSpace Content Bitstream">
<mets:fptr FILEID="file_12214"/>
</mets:div>
</mets:div>
</mets:structMap>
</mets:METS>
------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
DSpace-tech mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspace-tech