Changeset 26023 for main/trunk/greenstone3
- Timestamp:
- 2012-07-25T21:37:04+12:00 (12 years ago)
- Location:
- main/trunk/greenstone3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/AbstractGS2DocumentRetrieve.java
r25967 r26023 411 411 // check for pos on the front, indicating which piece of meta the user wants 412 412 // pos can be "first", "last" or the position value of the requested piece of metadata 413 if (temp.startsWith(GSConstants.META_POS)) 414 { 413 if (temp.startsWith(GSConstants.META_POS) || temp.equals("all")) 414 { 415 if (temp.startsWith(GSConstants.META_POS)) { 415 416 temp = temp.substring(GSConstants.META_POS.length()); 416 417 pos = temp; 418 } 417 419 418 420 index = metadata.indexOf(GSConstants.META_RELATION_SEP); -
main/trunk/greenstone3/web/interfaces/default/transform/config_format.xsl
r26022 r26023 125 125 </xsl:template> 126 126 127 <!-- calls a template in gslib.xsl in order to avoid xsl vs xslt issue --> 128 <xsl:template match="gsf:equivlinkgs3"> 129 <xslt:call-template name="equivDocLinks"> 130 <xslt:with-param name="count" select="0"/> 131 </xslt:call-template> 132 </xsl:template> 133 134 <!-- Another way (also works with DSpace tutorial): build all the equivalent document links for the current document in one go. No looping necessary: handled in function call. --> 135 <!--<xsl:template match="gsf:equivlinkgs3"> 136 <xslt:variable name="docicon" select="metadataList/metadata[contains(@name, 'equivDocIcon')]"/> 137 <xslt:variable name="docStartlink" select="metadataList/metadata[contains(@name, 'all_*,*_equivDocLink')]"/> 138 <xslt:variable name="docEndlink" select="metadataList/metadata[contains(@name, '/equivDocLink')]"/> 139 140 <xslt:variable name="equivDocLinks" select="java:org.greenstone.gsdl3.util.XSLTUtil.getEquivDocLinks(',',$docicon, $docStartlink, $docEndlink, ' ')" /> 141 <xslt:value-of disable-output-escaping="yes" select="$equivDocLinks"/> 142 </xsl:template>--> 143 144 <!-- 145 In the collection's format statement, could have the following javascript+XSLT in place of 146 the gsf:equivlinkgs3 element (which resolves to the XSLT in config_format.xsl and gslib.xsl). 147 <xsl:text disable-output-escaping="yes"><script>var equivDocIcon= [ " 148 </xsl:text> 149 <gsf:metadata name="equivDocIcon" separator="", "" multiple="true"/> 150 <xsl:text disable-output-escaping="yes">"];var equivDocStartLink= [ " 151 </xsl:text> 152 <gsf:metadata name="equivDocLink" separator="","" multiple="true"/> 153 <xsl:text disable-output-escaping="yes">"];var equivDocEndLink= [ " 154 </xsl:text> 155 <gsf:metadata name="/equivDocLink" separator="","" multiple="true"/> 156 <xsl:text disable-output-escaping="yes">"];for (var i=0; i<equivDocIcon.length; i++) { document.write(equivDocStartLink[i]+ equivDocIcon[i] + equivDocEndLink[i]); }</script> 157 </xsl:text> 158 --> 159 127 160 <!-- gsf:cgiparam example, as used by the Enhanced PDF tutorial: 128 161 <a><xsl:attribute name="href"><gsf:metadata name="httpPath" type="collection"/>/index/assoc/<gsf:metadata name="archivedir"/>/<gsf:metadata name="srclinkFile"/>#search=&quot;<gsf:cgi-param name="query"/>&quot;</xsl:attribute>src doc link with query highlighting</a> --> -
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.