- Timestamp:
- 2012-07-25T21:37:04+12:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/web/interfaces/default/transform/gslib.xsl
r25934 r26023 705 705 </xsl:template> 706 706 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 707 750 </xsl:stylesheet>
Note:
See TracChangeset
for help on using the changeset viewer.