en:user:format_statements
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
en:user:format_statements [2015/03/09 01:25] – external edit 127.0.0.1 | en:user:format_statements [2016/02/15 01:48] (current) – removed kjdon | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Format Statements ====== | ||
- | |||
- | |||
- | <TABAREA tabs=" | ||
- | <TAB> | ||
- | |||
- | Greenstone3 uses XSL to dynamically generate all of the pages in your library. This provides a way to present different content in a consistent way. | ||
- | |||
- | Format statements are a way to customize the look of a collection/ | ||
- | |||
- | Format statements must be written in well-formed XML. XML syntax is very similar to HTML. [[http:// | ||
- | |||
- | This page provides an overview of format statements. There is also a [[list_of_format_options|list of format statements]]. | ||
- | |||
- | ===== Format Features ===== | ||
- | In the Format panel of the GLI, there is a Format Features section. This is where you can customize how parts of your collection will appear. Any changes made in the GLI will only effect the current collection (though, you can copy formatting into future collections by basing them on another collection). There are different types of pages in your collection, and you can select which page or pages you want your format changes to effect. For example, if you want to modify how search results will appear, you would modify the **search** format feature. If you want to modify how documents will be listed in all of your browsing classifiers, | ||
- | |||
- | ^Format Feature^Description^ | ||
- | |'' | ||
- | |'' | ||
- | |'' | ||
- | |'' | ||
- | |'' | ||
- | |'' | ||
- | |||
- | // | ||
- | |||
- | |||
- | So, each feature effects certain (or, for the **global** feature, potentially all) pages in the collection. To make these changes, you can add or modify one or more **templates** to the feature. | ||
- | |||
- | |||
- | ===== Templates ===== | ||
- | {{: | ||
- | **Templates** are the containers for format statements. Different templates effect different parts of the page. For example, some basic templates for browse pages include: | ||
- | * **documentNode**: | ||
- | * **classifierNode[@classifierStyle = ' | ||
- | * **classifierNode[@classifierStyle = ' | ||
- | |||
- | //A browsing classifier may not have a hierarchy and/or horizontal partitions, in which case these templates (VList and HList, respectively) will be ignored.// | ||
- | |||
- | A simple **documentNode** classifier might look like this (The result of this format statement on a basic list browsing classifier is shown below): | ||
- | |||
- | <code xml> | ||
- | < | ||
- | <td> | ||
- | < | ||
- | </td> | ||
- | <td> | ||
- | < | ||
- | < | ||
- | </ | ||
- | </td> | ||
- | </ | ||
- | </ | ||
- | \\ | ||
- | {{ : | ||
- | Notice the ''< | ||
- | |||
- | By default, browsing pages and search results are displayed using HTML tables, and every document has its own table row. For this reason, everything in our format statement is inside of a table cell tag (''< | ||
- | * ''< | ||
- | * ''< | ||
- | * ''< | ||
- | |||
- | These are examples of the most common format statement types. The following sections will look at each of these in turn, followed by the more complex **conditional** format statements. | ||
- | |||
- | |||
- | ===== Links ===== | ||
- | **Link** statements provide an easy way to link to document display pages, source documents, and classifier pages, as well as to associated documents. Link statements work like ''< | ||
- | |||
- | <code html> | ||
- | <a href=" | ||
- | </ | ||
- | |||
- | Everything in between the '' | ||
- | |||
- | Greenstone link statements work in a similar way, except instead of specifying the exact URL to link to, you specify the //type// of page to link to: // | ||
- | |||
- | In a **documentNode** template, you will likely want to link to either the document' | ||
- | |||
- | <code xml> | ||
- | < | ||
- | < | ||
- | A link with type ' | ||
- | </ | ||
- | < | ||
- | A link with NO type also links to the the document' | ||
- | </ | ||
- | < | ||
- | A link with type ' | ||
- | </ | ||
- | </ | ||
- | </ | ||
- | |||
- | \\ | ||
- | |||
- | In a **classifierNode** template, you will generally have a link to the classifierNode, | ||
- | |||
- | <code xml> | ||
- | < | ||
- | < | ||
- | < | ||
- | </ | ||
- | </ | ||
- | </ | ||
- | \\ | ||
- | |||
- | The final link type is slightly different. If you have specified associated documents for any items in your collection (generally, associated documents will be the same document in a different format), you can also add a link for these in the **documentNode** template: | ||
- | |||
- | <code xml> | ||
- | < | ||
- | This is a link to an associated/ | ||
- | </ | ||
- | </ | ||
- | |||
- | |||
- | |||
- | ===== Icons ===== | ||
- | |||
- | Greenstone format statements make it easy to quickly add in icons. '' | ||
- | |||
- | * ''< | ||
- | * ''< | ||
- | //(These icons are stored in '' | ||
- | |||
- | The remaining icon statements are dependent on the metadata of the document: | ||
- | |||
- | * ''< | ||
- | * ''< | ||
- | * ''< | ||
- | |||
- | |||
- | ===== Metadata ===== | ||
- | |||
- | Any metadata that has been extracted from or added to documents can be referenced in format statements using the '' | ||
- | |||
- | If you want to display the file name for documents, ''< | ||
- | |||
- | |||
- | The metadata tag can have additional, optional attributes: //select//, // | ||
- | |||
- | ==== Separator ==== | ||
- | When there are multiple values for a metadata field (for example, a document has two '' | ||
- | |||
- | ==== Position ==== | ||
- | Sometimes, when there are multiple values for a metadata field, you only want to display a particular one. You can do this by specifying the //pos// attribute: ''< | ||
- | |||
- | '' | ||
- | |||
- | ==== Format ==== | ||
- | The format attribute can be used to format dates and language codes: | ||
- | * ''< | ||
- | * ''< | ||
- | |||
- | Both of these are language dependent. That is, the month and language will be in whatever language has been selected by the user. | ||
- | |||
- | ==== Select ==== | ||
- | |||
- | In sectioned documents, //select// allows you to choose which section/ | ||
- | * ''< | ||
- | * ''< | ||
- | * ''< | ||
- | * ''< | ||
- | * ''< | ||
- | * ''< | ||
- | * ''< | ||
- | |||
- | ===== Conditional ===== | ||
- | Conditional statements are extremely useful if you want to display different things depending on the metadata of the document. There are two different types of conditional statements: choose-metadata and switch. | ||
- | |||
- | ==== Choose-metadata==== | ||
- | Choose-metadata is relatively simple. You provide a list of metadata fields and the first of the fields with a value for that document will be displayed. If none of the fields have a value, then you can add a fall-back option ('' | ||
- | |||
- | <code xml> | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | </ | ||
- | </ | ||
- | |||
- | In this example, Greenstone will first look for '' | ||
- | |||
- | ==== Switch ==== | ||
- | The switch format statement allows you to display different things based on the presence or value of a certain metadata field for a given document. | ||
- | |||
- | <code xml> | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | </ | ||
- | < | ||
- | <i>No Author</ | ||
- | </ | ||
- | </ | ||
- | </ | ||
- | |||
- | \\ | ||
- | This example is testing whether or not there is a value for '' | ||
- | |||
- | You can also test the //value// of a certain document (this example first test whether '' | ||
- | |||
- | <code xml> | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | </ | ||
- | </ | ||
- | < | ||
- | < | ||
- | < | ||
- | </ | ||
- | </ | ||
- | < | ||
- | < | ||
- | < | ||
- | </ | ||
- | </ | ||
- | </ | ||
- | </ | ||
- | |||
- | ===== Iteration ===== | ||
- | |||
- | Sometimes a document will have more than one value for a particular metadata element. < | ||
- | |||
- | < | ||
- | < | ||
- | < | ||
- | </ | ||
- | </ | ||
- | |||
- | In this simple example, each dc.Subject is output in bold formatting. | ||
- | |||
- | < | ||
- | < | ||
- | < | ||
- | </ | ||
- | </ | ||
- | |||
- | In this example, we add in a separator too. Separator is still useful here as we don't want it output for the last value, which would happen if we put the semi colon in the body of the element. | ||
- | |||
- | To sort the values, add '' | ||
- | [[en: | ||
- | |||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | </ | ||
- | </ | ||
- | |||
- | |||
- | ===== Additional Resources ===== | ||
- | * The **[[en: | ||
- | * There are some **[[en: | ||
- | * The templates in the GLI only effect very specific parts of the page. You may want to completely change large portions of how your Greenstone library looks. For more information on how to do this, check out the [[interfaces]] page. | ||
- | * [[http:// | ||
- | |||
- | |||
- | </TAB | ||
- | < | ||
- | ############################################################################## | ||
- | ############################################################################ | ||
- | <TAB> | ||
- | [[en: | ||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | ===== Additional Resources ===== | ||
- | |||
- | As writing format statements can be tricky, we have a [[en: | ||
- | * [[en: | ||
- | * [[en: | ||
- | * [[en: | ||
- | * [[en: | ||
- | * [[en: | ||
- | * [[en: | ||
- | * [[en: | ||
- | * [[en: | ||
- | * [[en: | ||
- | </ | ||
- | </ |
en/user/format_statements.1425864355.txt.gz · Last modified: 2016/02/15 01:40 (external edit)