User Tools

Site Tools


en:user:gs3_list_of_format_options

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_list_of_format_options [2019/10/21 21:18] – [Miscellaneous Things] kjdonen:user:gs3_list_of_format_options [2020/02/03 00:06] – [Text Strings] kjdon
Line 158: Line 158:
  
  
-==== Text Strings ====+==== Collection/Interface Text Strings ==== 
 + 
 +These will be displayed in the current interface language (if available), otherwise in the default language. 
 ^Format Element^Greenstone2 equivalent^Description^ ^Format Element^Greenstone2 equivalent^Description^
 |     ||| |     |||
-|''<gsf:displayText name='xxx'/>'' |Will display the xxx displayItem from the collection's collectionConfig.xml file. If that is not found, will try to look for xxx from the interface's property file.| +|''<gsf:displayText name='xxx'/>'' |Will display the xxx displayItem from the collection'//collectionConfig.xml// file. If that is not found, will try to look for xxx from the interface's property file.| 
-|''<gsf:displayItem name='xxx'/>'' |Display the xxx displayItem from the collection's collectionConfig.xml file.| +|''<gsf:displayItem name='xxx'/>'' |Display the xxx displayItem from the collection'//collectionConfig.xml// file.| 
-|''<gsf:interfaceText name='xxx'/>'' | Display the xxx interface text string (from interface_default.properties in web/WEB-INF/classes)| +|''<gsf:interfaceText name='xxx'/>'' | Display the xxx interface text string (from //interface_default.properties// in web/WEB-INF/classes)| 
-|''<gsf:collectionText name='xxx'/>'' |Display the xxx from the current collection's colname.properties file (found in resources folder inside the collection) |+|''<gsf:interfaceText name="xxx" propertyFile="file_name"/>'' | | Display the xxx string from the //file_name.properties// file (in web/WEB-INF/classes) (Greenstone version 3.10 and later)| 
 +|''<gsf:collectionText name='xxx'/>'' |Display the xxx from the current collection'//colname.properties// file (found in resources folder inside the collection) |
  
 ==== Miscellaneous Things ==== ==== Miscellaneous Things ====
Line 246: Line 250:
 |lang|language code|Defines the language whose sorting conventions are to be used| |lang|language code|Defines the language whose sorting conventions are to be used|
 |data-type|text/number/data-type name|Defines whether values are sorted alphabetically, numerically, or using a user-defined data type| |data-type|text/number/data-type name|Defines whether values are sorted alphabetically, numerically, or using a user-defined data type|
 +
 +==== Utility Functions ====
 +
 +There are many utility functions defined in src/java/org/greenstone/gsdl3/util/XSLTUtil.java. Some of these are used behind the scenes, as part of gsf elements. For example, ....
 +
 +They can be called explicitly using
 +<code>
 +<xsl:value of select="util:fname(args)"/>
 +</code>
 +args is a comma separated list of args. They can be XSLT variables, numbers, strings, XSLT elements/attributes.
 +
 +For example:
 +<code>
 +   <xsl:variable name="raw_date"><gslib:collectionMeta name="buildDate"/></xsl:variable>
 +   The collection was last built on <xsl:value-of select="util:formatTimeStamp($raw_date, 0, 0, /page/@lang)"/>
 +</code>
 +
 +This code is getting the buildDate timestamp from collection metadata. Then it is formatting it using the formatTimeStamp function.
 +This function takes 4 arguments:
 +  * the timestamp - here we use the raw_date variable we have just made
 +  * an integer for timestamp type - 0 is seconds, 1 is milliseconds
 +  * an integer for output format tupe - 0 is date, 1 is time, 2 is date and time, 3 is days ago
 +  * the language code for which language you want the output in - here we use the attribute from the page element.
 +
 +We could change this output to days ago:
 +The collection was last built <xsl:value-of select="util:formatTimeStamp($raw_date, 0, 3, /page/@lang)"/> days ago.
  
 ==== Additional Notes ==== ==== Additional Notes ====
 +
  
 Some of these options (<gsf:html>; using <gsf:metadata> inside the parameters for a search link) are not available in the 3.07 release. If you are using 3.07, you can download an updated config_format.xsl file. Rename your current greenstone3/web/interfaces/default/transform/config_format.xsl (so that you can put it back if something goes wrong), and copy this one into its place. Some of these options (<gsf:html>; using <gsf:metadata> inside the parameters for a search link) are not available in the 3.07 release. If you are using 3.07, you can download an updated config_format.xsl file. Rename your current greenstone3/web/interfaces/default/transform/config_format.xsl (so that you can put it back if something goes wrong), and copy this one into its place.
en/user/gs3_list_of_format_options.txt · Last modified: 2024/03/11 20:16 by kjdon