Choose a style: Default Greenstone, Blue, OlivePurple, None

Cascading Style Sheets


This collection demonstrates Greenstone's use of Cascading Style Sheets (CSS) for visual formatting in web browsers. On every page, you can change the style-sheet in effect, to modify that page's appearance. This collection contains the same material as the original Greenstone demo collection.

A combination of JavaScript and the overriding of GS3 XSL templates in Greenstone 3's global format statement is used by the collection to provide the stylesheet switching. As in some other Documented Example Collections, GLI's Format > Format Features > global can be used to define the additionalHeaderContent template. Doing so overrides the existing additionalHeaderContent template, and appends any specified HTML elements to the HTML header.

In this case, the additionalHeaderContent specifies the custom collection stylesheet currently active and the JavaScript to facilitate the stylesheet switching when a link is clicked. The create-banner XSL template in the global format statement is also overridden to provide links to the multiple stylesheets within the existing GS3 banner section, and invoke the custom JavaScript when any link is clicked.

 
<xsl:template name="additionalHeaderContent"> 
<xsl:variable name="httpCollection"> 
<xsl:value-of select="/page/pageResponse/collection/metadataList/metadata[@name='httpPath']"/> 
</xsl:variable> 
<link rel="stylesheet" href="{$httpCollection}/style/gs3-style-default-extra.css" type="text/css"  
title="GS3 Style" id="custom-style" charset="UTF-8"/> 
<script src="{$httpCollection}/script/custom-script.js" type="text/javascript"> 
</script> 
</xsl:template> 

<xsl:template name="create-banner">   
<div class="choose_style"> 
Choose a style: 
<a href="#" onclick="replaceStyle('gs3-style-default-extra');return false;">Default Greenstone</a>, 
<a href="#" onclick="replaceStyle('gs3-style-blue');return false;">Blue</a>, 
<a href="#" onclick="replaceStyle('gs3-style-olive-purple');return false;">OlivePurple</a>,		 
<a href="#" onclick="replaceStyle('');return false;">None</a> 
</div> 
<div id="gs_banner" class="ui-widget-header ui-corner-bottom">	     
<div id="titlesearchcontainer"> 
<xsl:call-template name="page-title-area"/>	 
<xsl:call-template name="quick-search-area"/> 
<div style="clear:both;"><xsl:text> </xsl:text></div>	 
</div> 
<xsl:call-template name="browsing-tabs"/>	 
</div> 
</xsl:template> 

If you want to download any of these stylesheets for your own collections, here are links to them:

Using a downloaded stylesheet