====== List of Greenstone3 Format Items ====== This page describes all the things that can go into the element in the collectionConfig.xml file - or can be added in the Format->FormatFeatures pane in GLI. Format items include options, parameter defaults, and templates. Templates can include standard XSL, but we have defined a set of gsf elements which are shortcuts to XSL. '''' formatting items are converted to XSLT by the ''web/interfaces/default/transform/config_format.xsl'' file. See also the description of [[en:user:gs3_format_statements|format statements]], and some [[en:user:gs3_sample_format_statements | sample format statements]] for miscellaneous tasks. ===== Top Level Elements ===== There are three main types of format items: options, parameter defaults, and templates. Options give you a switch to turn something on/off or change the look, parameter defaults let you change the default value of eg search parameters (stemming, casefolding etc) while templates let you describe what output you want. ==== Options ==== There are a few options available. They are specified by adding **** to the appropriate format element in GLI, or in the collectionConfig.xml file. ^Option name^Values^Format^Description^ | |||| |hideStatus|true|search|If set to true, will hide the line 'displaying 0 to 20 of 40 documents' in the search results| |[[rss|RSS]]|true| |If set to true, will add a RSS Feed link to the collection| |turnstyleClassifiers|false|browse|By default, bookshelves display a plus icon to open up that section of the classifier in place. will also use ajax to open the current section. If turnstyleClassifiers is set to false, then the plus icon is not displayed and will open a new page for just that section of the classifier.| |mapEnabled|true|display,search,browse| | |mapEnabledOpenLayers| ?? header.xsl| |panoramaViewerEnabled|true|browse,search| | |facetTableRows|integer|search| | |sectionExpandCollapse|true|display|? check if on when true or false| |backToTopLinks| |display|?| |sideBar|false |display|If false will not display any of the right side bar features, including cover image, search term highlighting checkbox, table of contents etc | |disableZoom|true|display| | |disableSearchTermHighlighting|true|display|If set to true, will not highlight search terms in the text, and will not display the on/off button for highlighting| |coverImage|true|display| | |TOC|true|display| | |viewSelection|false|display|If false, will not show the text/image/default view selector for paged image documents. | |slideShow|false|display|If false, will not display the slideshow option for paged image documents | |[[user_comments|allowUserComments]]|true|display|If set to true, will allow users to add comments to public collections. Users need not have editing permissions for a collection they wish to add comments to. They just need to have an account on that Greenstone Digital Library. (was AllowUserComments prior to 3.10)| |[[en:user_advanced:web_editor|allowDocumentEditing]]|true|display|If set to true (or is absent), will allow authenticated users (that have been assigned the correct group) the ability to edit document text and metadata through the web site. Set this to false to disable document editing. (since 3.09, was AllowDocumentEditing for 3.09)| |[[en:user_advanced:web_editor|allowMapGPSEditing]]|true|display|If set to true (or is absent), will allow authenticated users (that have been assigned the correct group) the ability to add and edit GPS data through the web site. Set this to false to disable the Map GPS editing controls. (since 3.10)| ==== Parameter Defaults ==== Inside a format element you can set default values for parameters, using the following syntax You can use this to set things like: * turn stemming on by default for mgpp collections: * return all hits in one page instead of paging the results: To see what parameters you have that you can change, you can look at the page source for a query page and see what names and values the form elements have. These can be added inside the and format statements using GLI or directly editing the collectionConfig.xml file). ==== Templates ==== Templates are the containers that hold all format statements. The value of ''match'' determines which part of the page content the template applies to. For example, ''template definition '' matches a documentNode element. ===== What can go inside a template? ===== ==== Links ==== ^Format Element^Greenstone2 equivalent^Description^ | ||| |'''' or \\ ''''|''[link][/link]''|The HTML link to the Greenstone version of the current document| |'''' | | Link to document with identifier xxx| |'''' | |Link to document whose identifier is specified by the xxx metadata value of the current document. | |''''|''[srclink][/srclink]''|The HTML link to the original file for documents that have been converted, e.g. Word,PDF, PS| |''''| |A link to a classification node (use in classifierNode templates)| |''''| |A link to a classification node (use in classifierNode templates). Static will make it a link to a new page for that particular bookshelf. javascript will make the link use javascript to open up that section of the classifier in the current page. Without a style attribute, the default behaviour will be 'javascript' in a VList, and 'static' in an HList.| |''s1.query=cats&s1.index=TI''| | a link to a search with the specified parameters. Will link to TextQuery search unless the optional name attribute is used. Add qs=1 to link to a quicksearch page rather than the full search page. You can see what parameters are used in a search by going to the search page and submitting a search. The parameters appear in the URL. | |'''' |''[weblink][/weblink]'' |Make a link using the weblink and /weblink metadata values| |''''| |Link to a collection page, in this case the about page| |''''| |Link to the collection's RSS feed| |''''| |Open the link in a new tab| |'''' | |Add a tooltip to a link using the title attribute| |'''' | |Add a tooltip to a link using the key specified. It will look up the key in the colname.properties file in the collection's resources folder (where colname is the collection's short name). Use this if you wish to translate the tooltip into different languages.| |'''' | |Link to equivalent documents| ==== Icons and Images ==== ^Format Element^Greenstone2 equivalent^Description^ | ||| |'''' or \\ ''''|''[icon]''|An appropriate icon for the document (e.g. book or page icon)| |''''| |Bookshelf icon (generally used for classification nodes)| |''''| | Outputs the value of the webicon metadata | |''''| | Displays the xxx.jpg image from the current interface's images folder | |''''| | Displays the xxx.jpg image from the current collection's images folder | |''''|''[srcicon]''|An appropriate icon for the original file e.g. Word, PDF icon, if available| |''''| ''[thumbicon]'' |Thumbnail for images (default width 100px, which can be modified in ImagePlugin options) (uses thumbicon metadata value) | |''''| ''[screenicon]'' |For images, a decent-sized version (width of 500px) for displaying the image in a webpage (uses screenicon metadata value)| |''''| '''' | Thumbnail of an image | |''''| '''' | Screen size version of an image| |''''| '''' | Displays the original image| |''''| '''' | Displays the document's cover image (if there is one)| |''''| ''['' | can take any html img attributes - they will be copied to the resulting element.| ==== Text and Metadata ==== ^Format Element^Greenstone2 equivalent^Description^ | ||| |''''|''[Text]''|The text of the current section| |''''|''[OID]''|The current document or section's identifier| |''''|''[rank]''|The rank of the current document/section (in search results)| |'''' or \\ ''''|''[Title]''|The value of a metadata element for the current document or section, in this case, Title| |''''| |A more extended selection of metadata values. The select field can be one of those shown in the table below. There are two optional attributes: separator gives a String that will be used to separate the fields, default is "“,"“, and pos selects one particular value.| |''''|''[parent:Title]''|The Title of the parent of the current document/section| |''''|''[parent(All):Title]''|The Title of all of the parent documents/sections, separated by a comma| |''''|''[parent(Top):Title]''|The Title of the top-level document (i.e. in a sectioned document, the Title of the document itself)| |''''|''[parent(All': '):Title]''|The Title of all of the parent documents/sections, separated by ": "| |''''|''[sibling(All': '):Title]''|The Title of all of the current document's/section's siblings, separated by ": "| |''''| |All dc.Dates and Dates (in the order that they come out of the database.| |''''| |The actual date (dc.Date or Date) that was used to classify the document into its current position in the classifier (List -metadata dc.Date,Date)| |''''| |The value of a metadata element for the current document, formatted in some way. formatDate turns '20040201' into '01 February 2004' (in a language dependent manner).| |''''| |The value of a metadata element for the current document, formatted in some way. format-Language: turns language code into language name, e.g. 'en' into 'English'.| === gsf:metadata modifiers === By default, gsf:metadata displays all values of the specified metadata field, for the current page or section of a document. You can change which page or section's metadata is output using the **select** attribute. And you can choose just a single value using the **pos** attribute. Or you can set **type='collection'** to retrieve collection level metadata. ^gsf:metadata Attribute^Possible Values^Description^ |select| |Select a different node or set of nodes, relative to the current node. Only valid for documentNode templates, not in classifierNodes.| |:::|current|The current section (this is the default type; if ''select'' is not specified, the current section is assumed)| |:::|parent|The immediate parent section| |:::|ancestors|All the parents back to the root (topmost) section| |:::|root|The root or topmost section| |:::|siblings|All the sibling sections| |:::|children|The immediate child sections of the current section| |:::|descendents|All the descendent sections (NOT YET IMPLEMENTED)| |pos|first, last or any number (1,2,3,etc.) |gsf:metadata by default displays all values of a metadata field for a document; this allows you to select which one you want (e.g. the first, second, 8th one listed)| |:::|classifiedBy|If the document has multiple values for the metadata element that you have classified on, this allows you to select the value that was used to classify the document into its current position in the classifier. Only useful in documentNode templates for a classifier.| |type|collection|Gets collection level metadata rather than document level. //select// attributes not useful with this type| === Formatting multiple values === When multiple values are to be displayed, they are separated by ", ", by default. You can change this using separator, suffix and prefix. These can be attributes to the gsf:metadata element, or child nodes. Attributes may only contain plain text, whereas the child nodes can contain HTML. The attribute version takes precedence over the child node version: only the attribute will be used if both are present. See [[en:user:gs3_sample_format_statements|here]] for an example using prefix and suffix. ^Modifier^Example^Description^ |separator||Puts //colon space// between metadata values| |:::|
|will break each value with a new line| |prefix||Puts +++ in front of each metadata value| |:::|subject: |Puts subject: in front of each metadata value| |suffix||Puts +++ after each metadata value| |:::|(xxx)|Puts (xxx) after each metadata value| Some metadata values can have added formatting applied. ^gsf:metadata Attribute^Possible Values^Description^ |format|formatDate|turns '20040201' into '01 February 2004' (in a language dependent manner)| |:::|formatLanguage|turns language code into language name, e.g. 'en' into 'English'.| === Hidden metadata === Finally, you may want to retrieve the metadata from the server, but not display it directly in the page. Maybe it will be processed by Javascript later on. The page XML will contain metadata values dependent on which gsf:metadata elements are in the XSLT for the page. You can add a //hidden// metadata to get the value into the page XML. ^gsf:metadata Attribute^Possible Values^Description^ |hidden|true|If true, then the metadata will be retrieved from the server, but not displayed at that point. | ==== 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^ | ||| |''''| |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.| |''''| |Display the xxx displayItem from the collection's //collectionConfig.xml// file.| |''''| | Display the xxx interface text string (from //interface_default.properties// in web/WEB-INF/classes)| |'''' | | Display the xxx string from the //.properties// file (in web/WEB-INF/classes) (Greenstone version 3.10 and later)| |''''| |Display the xxx from the current collection's //interface_custom.properties// file (found in resources folder inside the collection) | |''''| |Display the xxx from the current collection's //.properties// file (found in resources folder inside the collection) | ==== Miscellaneous Things ==== ^Format Element^Greenstone2 equivalent^Description^ | ||| |''''| _cgiargq_|The value of a cgi param (in this case will get s1.query from the cgi arguments)| |''value''| |Will output an into the transform result. Also, sets gs.variables.xxx = value, which is available for use in javascript code.| |''<li>''|
  • |Sometimes you want to output some HTML that is not valid XML in the config file. For example, adding
  • and
  • as prefix and suffix to a list of metadata values. In the final HTML it will be valid XML, but in the template it won't be. So use escaped < and > and enclose the text in tags.| ==== Conditional ==== ^Format Element^Greenstone2 equivalent^Description^ | ||| |''Untitled''|''[Or}{[dc.Title], [dls.Title], [Title], Untitled}''|A choice of metadata. Will select the first existing one. The metadata elements can have the select, separator and multiple attributes like normal. gives output if none of the metadata elements are defined.| |''output this if there is an abstractoutput this if there is no abstract''| ''{If}{[abstract],output this if there is an abstract,output this if there is no abstract}''|A simpler version of a switch based on whether a metadata value exists or not| |''''|''[If}{[Subject],[Subject]}''|Switch on the existence or value of a particular metadata - the metadata is specified in gsf:metadata, and has the same attributes as normal.| |'' \\ \\ ... \\ ... \\ ... \\ ''| |Switch on the value of a particular metadata - the metadata is specified in gsf:metadata, and has the same attributes as normal.| ===Preprocess Options === The preprocess attribute specifies something to do to the metadata value before performing the test. For example, you may want to lower case the value before comparing it to your text string. That way you don't need to worry about handling case variation in the metadata value. ^Preprocess^ Description^ |toLower | Make the value lower case| |toUpper| Make the value all upper case| |tidyWhiteSpace| Replace all sequences of white space with a single space character.| |stripWhitespace| Remove all whitespace characters| |formatDate| Converts 20020101 to 01 January 2002 (language dependent)| |formatLanguage| Converts 'en' to 'English' (language dependent)| |cgiSafe| Replace space with %20| |formatBigNumber| ???| === Test options === Sometimes you may want to output different things depending on the value of the metadata element. There are many tests you can make on the metadata value, listed below, which are specified using the test attribute. They all take a second parameter, specified using the test-value attribute, which is the value to compare to (with the exception of exists, which needs no test value). The preprocessing option, if specified, is carried out first, before performing the test. ^Test^ Description^ |equals | Returns true if the metadata value equals the specified test value | |notEquals | Returns true if the metadata value does NOT equal the specified test value| |exists | Returns true if there is a value for the metadata field| |contains | Returns true if the test value can be found inside the metadata value | |startsWith | Returns true if the metadata value starts with the specified test value| |endsWith | Returns true if the metadata value ends with the specified test valu| |lessThan | Returns true if the metadata value is lexicographically less than the test string| |lessThanOrEquals | Returns true if the metadata value is lexicographically less than or equal to the test string| |greaterThan | Returns true if the metadata value is lexicographically greater than the test string| |greaterThanOrEquals | Returns true if the metadata value is lexicographically greater than or equal to the test string| |oidIsMatchOrParent | Used for comparing OIDs. Returns true if the metadata value equals the test value, or is a parent of it. For example, b17mie.1.2 is a parent of b17mie.1.2.1| Note, these preprocessing and test options are defined in greenstone3/src/java/org/greenstone/gsdl3/util/XSLTUtil.java. ==== Iteration ==== ^Format Element^Greenstone2 equivalent^Description^ | ||| |'' \\ \\ ''| |Iterate over metadata values and output each one. Use this instead of if you want to put HTML around each value, which you can't do using a separator. is a placeholder for where the metadata value is to go in the output.| |'' \\ \\ \\ ''| |Iterate over each sorted metadata item. For a basic sort, use @sort='true' in the element. For a more specific sort, use the element which mirrors the element. For attributes, see below.| === gsf:foreach-metadata attributes === ^gsf:foreach-metadata Attribute^Possible Values^Description^ |select|current|The current section (this is the default type; if ''select'' is not specified, the current section is assumed)| |:::|parent|The immediate parent section| |:::|ancestors|All the parents back to the root (topmost) section| |:::|root|The root or topmost section| |:::|siblings|All the sibling sections| |:::|children|The immediate child sections of the current section| |:::|descendents|All the descendent sections| |type|collection|Collection level metadata rather than document level metadata| |separator|Any character(s)|This will be output between each value| |sort|true|Sort the metadata values (alphabetically, ascending order)| === gsf:sort attributes === ^gsf:sort Attribute^Possible Values^Description^ |select|Expression|Defines the sort key. The default is the string value of the node. Not so useful in this context.| |order|ascending/descending|Defines sort order| |case-order|upper-first/lower-first|Defines whether upper-case letters are to be sorted before or after lower-case letters. Default is language dependent.| |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| ==== 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 args is a comma separated list of args. They can be XSLT variables, numbers, strings, XSLT elements/attributes. For example: The collection was last built on 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 days ago. ==== Additional Notes ==== Some of these options (; using 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.