Show
Ignore:
Timestamp:
04.07.2011 21:22:54 (9 years ago)
Author:
ak19
Message:

Still part of ticket 449. Need a more accurate way of setting docStartlink, since we don't have an ends-with function anymore.

Files:
1 modified

Legend:

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

    r24219 r24228  
    124124    <xsl:param name="count"/> 
    125125 
    126       <xsl:variable name="docicon" select="metadataList/metadata[contains(@name, 'equivDocIcon')]"/>     
    127       <xsl:variable name="docStartlink" select="metadataList/metadata[contains(@name, 'all_*,*_equivDocLink')]"/>    
     126      <xsl:variable name="docicon" select="metadataList/metadata[contains(@name, 'equivDocIcon')]"/> 
    128127      <xsl:variable name="docEndlink" select="metadataList/metadata[contains(@name, '/equivDocLink')]"/> 
     128 
     129      <!--<xsl:variable name="docStartlink" select="metadataList/metadata[contains(@name, 'all_*,*_equivDocLink')]"/>-->     
     130      <!-- In the following variable statement, we're trying to set the docStartlink to any metadata whose value  
     131    ends on equivDocLink but NOT /equivDocLink. Unfortunately, the xslt function fn:ends-with only exists from 
     132    xslt 2.0 onwards. So need to use substring() and string-lenth() functions now to check whether the 13th char 
     133    from the end is a slash or not, in order to distinguish between the start of a doclink and end of one.  
     134    If this 13th char from the end is not a slash, then we found (the string we want to store in) docStartlink. --> 
     135      <xsl:variable name="docStartlink"> 
     136    <xsl:for-each select="metadataList/metadata"> 
     137      <xsl:if test="contains(@name, 'equivDocLink')">    
     138        <xsl:variable name="tmpvar" select="substring(@name, string-length(@name)-12, 1)"/>  
     139          <xsl:if test="not($tmpvar='/')"> 
     140            <xsl:value-of select="self::node()[@name]"/>             
     141          </xsl:if>      
     142      </xsl:if> 
     143    </xsl:for-each>  
     144      </xsl:variable> 
    129145 
    130146      <xsl:variable name="equivDocIcon" select="java:org.greenstone.gsdl3.util.XSLTUtil.getNumberedItem($docicon, $count)" />