Ignore:
Timestamp:
2012-07-25T21:37:04+12:00 (12 years ago)
Author:
ak19
Message:
  1. Fixing the java code to handle gsf:equivlinkgs3 again. The code had recently been changed to remove the gsf:meta attribute of multiple=true to use attribute pos=index|first|last instead. But when multiple=true in the past, _all_ would be prefixed to the metadata_sep and metadata, and this still needed to be processed. 2. Added the XSLT to deal with gsf:equivlinkgs3 into the default skin (previously this was only added into gs3-library which has now become the basic skin). With changes 1 and 2, the parts of the DSpace tutorial which deal with equivlink now work for GS3 (again).
File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/web/interfaces/default/transform/gslib.xsl

    r25934 r26023  
    705705  </xsl:template>
    706706
     707
     708  <!-- builds up links to available document types equivalent to the default source
     709       document with as anchor the equivalent documents' doctype icons. -->
     710  <xsl:template name="equivDocLinks">
     711    <xsl:param name="count"/>
     712
     713      <xsl:variable name="docicon" select="metadataList/metadata[contains(@name, 'equivDocIcon')]"/>
     714      <xsl:variable name="docEndlink" select="metadataList/metadata[contains(@name, '/equivDocLink')]"/>
     715
     716      <!--<xsl:variable name="docStartlink" select="metadataList/metadata[contains(@name, 'all_*,*_equivDocLink')]"/>-->   
     717      <!-- In the following variable statement, we're trying to set the docStartlink to any metadata whose value
     718    ends on equivDocLink but NOT /equivDocLink. Unfortunately, the xslt function fn:ends-with only exists from
     719    xslt 2.0 onwards. So need to use substring() and string-lenth() functions now to check whether the 13th char
     720    from the end is a slash or not, in order to distinguish between the start of a doclink and end of one.
     721    If this 13th char from the end is not a slash, then we found (the string we want to store in) docStartlink. -->
     722      <xsl:variable name="docStartlink">
     723    <xsl:for-each select="metadataList/metadata">
     724      <xsl:if test="contains(@name, 'equivDocLink')">   
     725        <xsl:variable name="tmpvar" select="substring(@name, string-length(@name)-12, 1)"/>
     726          <xsl:if test="not($tmpvar='/')">
     727            <xsl:value-of select="self::node()[@name]"/>           
     728          </xsl:if>     
     729      </xsl:if>
     730    </xsl:for-each>
     731      </xsl:variable>
     732
     733      <xsl:variable name="equivDocIcon" select="java:org.greenstone.gsdl3.util.XSLTUtil.getNumberedItem($docicon, $count)" />
     734      <xsl:variable name="equivStartlink" select="java:org.greenstone.gsdl3.util.XSLTUtil.getNumberedItem($docStartlink, $count)" />
     735      <xsl:variable name="equivEndlink" select="java:org.greenstone.gsdl3.util.XSLTUtil.getNumberedItem($docEndlink, $count)" />
     736
     737      <xsl:if test="$equivDocIcon != ''">
     738        <xsl:value-of disable-output-escaping="yes" select="$equivStartlink"/>
     739        <xsl:value-of disable-output-escaping="yes" select="$equivDocIcon"/>
     740        <xsl:value-of disable-output-escaping="yes" select="$equivEndlink"/>
     741
     742        <!-- recursively call this template to get multiple entries -->
     743        <xsl:call-template name="equivDocLinks">
     744          <xsl:with-param name="count"><xsl:value-of select="$count + 1"/></xsl:with-param>
     745        </xsl:call-template>
     746      </xsl:if>
     747
     748  </xsl:template>
     749
    707750</xsl:stylesheet>
Note: See TracChangeset for help on using the changeset viewer.