User Tools

Site Tools


en:user:gs3_sample_interface_modifications

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
en:user:gs3_sample_interface_modifications [2019/09/23 22:59] kjdonen:user:gs3_sample_interface_modifications [2019/10/21 20:58] – [Changing the collection description] kjdon
Line 32: Line 32:
 </code> </code>
  
-<gslib:collectionMeta> can retrieve metadata elements from the collection (as opposed to from documents). Here we use it to retrieve "numDocs" metadata - the number of documents in the colleciton.+<gslib:collectionMeta> can retrieve metadata elements from the collection (as opposed to from documents). Here we use it to retrieve "numDocs" metadata - the number of documents in the collection - and "buildDate" metadata - the date the collection was last built.
  
 The buildDate metadata element is a timestamp, so is not user friendly. We can use one of our utility functions to format it. The buildDate metadata element is a timestamp, so is not user friendly. We can use one of our utility functions to format it.
 +Utility functions are defined in src/java/org/greenstone/gsdl3/util/XSLTUtil.java.
  
 ==== Total documents in library ==== ==== Total documents in library ====
Line 40: Line 41:
 The above section shows how to add "this collection contains X number of documents" to a collection's about page. But what if we want to do that for the whole library? The above section shows how to add "this collection contains X number of documents" to a collection's about page. But what if we want to do that for the whole library?
  
-We can add up all the numDocs from each collection using 'sum', and count the number of collecitons using 'count':+We can add up all the numDocs from each collection using 'sum', and count the number of collections using 'count':
  
 <code> <code>
 <xsl:template match="/page/pageResponse"> <xsl:template match="/page/pageResponse">
 .... ....
-<xsl:variable name="totaldocs" select="sum(/page/pageResponse/collectionList/collection/metadataList/metadata[@name='numDocs'])" />+<xsl:variable name="totaldocs" select="sum(/page/pageResponse/collectionList/collection/metadataList 
 +/metadata[@name='numDocs'])" />
 <xsl:variable name="totalcolls" select="count(/page/pageResponse/collectionList/collection)"/> <xsl:variable name="totalcolls" select="count(/page/pageResponse/collectionList/collection)"/>
-<p>This library contains a total of <xsl:value-of select="$totaldocs"/> documents over <xsl:value-of select="$totalcolls"/> collections.</p>+ 
 +<p>This library contains a total of <xsl:value-of select="$totaldocs"/> documents over <xsl:value-of  
 +select="$totalcolls"/> collections.</p>
 .... ....
 </xsl:template> </xsl:template>
en/user/gs3_sample_interface_modifications.txt · Last modified: 2023/03/13 01:46 by 127.0.0.1