Greenstone Tutorial Information

Contents

Requirements

To use this package to re-generate the Greenstone tutorial HTML, or generate a workshop, you need to have the following:

Contents of this package

README.html
This file
generate-html.sh/bat
Scripts for generating all the HTML
generate-workshop.sh/bat
Scripts for generating a workshop
xml-source
The raw XML files for the tutorials
processing
XSL and auxiliary files for transforming the XML into HTML or other format
../shared
Java classes and jar files common to tutorials and manuals

Generating HTML files

The easy way

  1. Run source setup.bash/source gs3-setup.sh in the top level directory of your Greenstone installation
  2. Run ./generate-html.sh [2 or 3] in this tutorials directory, where 2/3 is which Greenstone version you want to generate tutorials for.
Windows versions of these commands are like the following:
  1. setup.bat/gs3-setup.bat in the top level directory of your gs2 or gs3 installation
  2. generate-html [2 or 3] in this tutorials directory
These commands will make an html folder, with en subfolder containing all the English pages, plus index.html and wiki-index.txt. This is currently set up to only generate the English version of the HTML. The French, Spanish and Russion translations are for 2.70 and haven't been updated, so we don't need to do them each time. But if they did get translated, and you want to generate the other languages, do the following:
  1. Edit generate-html.sh, and add all the language codes to langs (langs="en fr es ru")
  2. Edit xml-to-top-index.xsl, set the value of all-langs variable to 1
  3. Re-run the generate-html.sh/bat script

The old complicated way

  1. Run source setup.bash in the top level directory of your Greenstone installation
  2. Create a subdirectory in gsdl-tutorials for your output files. If you are using multiple languages and want to create top level index files, then you should name the directories en, fr, es, and ru, otherwise the links won't be valid.
  3. cd to the appropriate directory
  4. Generate the index page:
    java -cp $shared_dir:$GSDLHOME/gli:$GSDLHOME/gli/classes:$GSDLHOME/perllib:$shared_dir/xalan.jar -DGSDLHOME=$GSDLHOME ApplyXSLT $processing_dir/xml-to-index.xsl $source_dir/tutorial_$l.xml > index.html
  5. Generate the individual pages
    java -cp $shared_dir:$GSDLHOME/gli:$GSDLHOME/gli/classes:$GSDLHOME/perllib:$shared_dir/xalan.jar -DGSDLHOME=$GSDLHOME ApplyXSLT $processing_dir/xml-to-many-html.xsl $source_dir/tutorial_$l.xml | perl -S $GSDLHOME/gli/help/splithelpdocument.pl
  6. Generate a single HTML file containing all tutorials
    java -cp $shared_dir:$GSDLHOME/gli:$GSDLHOME/gli/classes:$GSDLHOME/perllib:$shared_dir/xalan.jar -DGSDLHOME=$GSDLHOME ApplyXSLT $processing_dir/xml-to-one-html.xsl $source_dir/tutorial_$l.xml > all_tutorials.html
  7. Generate the top level combined index. Should be run from the gsdl-tutorial directory, not from the subdirectory
    java -cp $shared_dir:$GSDLHOME/gli:$GSDLHOME/gli/classes:$GSDLHOME/perllib:$shared_dir/xalan.jar -DGSDLHOME=$GSDLHOME ApplyXSLT $processing_dir/xml-to-top-index.xsl  $source_dir/tutorial_en.xml > $output_dir/index.html
Windows versions of these commands are like the following:
  1. Run setup in the top level directory of your Greenstone installation
  2. Create a subdirectory in gsdl-tutorials for your output files. If you are using multiple languages and want to create top level index files, then you should name the directories en, fr, es, and ru, otherwise the links won't be valid.
  3. cd to the appropriate directory
  4. Generate the index page:
    java -cp %shared_dir%;%GSDLHOME%\gli;%GSDLHOME%\gli\classes;%GSDLHOME%\perllib;%shared_dir%\xalan.jar -DGSDLHOME=%GSDLHOME% ApplyXSLT %processing_dir%\xml-to-index.xsl %source_dir%\tutorial_en.xml > index.html
  5. Generate the individual pages
    java -cp %shared_dir%;%GSDLHOME%\gli;%GSDLHOME%\gli\classes;%GSDLHOME%\perllib;%shared_dir%\xalan.jar -DGSDLHOME=%GSDLHOME% ApplyXSLT %processing_dir%\xml-to-many-html.xsl %source_dir%\tutorial_en.xml | perl -S %GSDLHOME%\gli\help\splithelpdocument.pl

  6. Generate a single HTML file containing all tutorials
    java -cp %shared_dir%;%GSDLHOME%\gli;%GSDLHOME%\gli\classes;%GSDLHOME%\perllib;%shared_dir%\xalan.jar -DGSDLHOME=%GSDLHOME% ApplyXSLT %processing_dir%\xml-to-one-html.xsl %source_dir%\tutorial_en.xml > all_tutorials.html

  7. Generate the top level combined index. Should be run from the gsdl-tutorial directory, not from the subdirectory
    java -cp %shared_dir%;%GSDLHOME%\gli;%GSDLHOME%\gli\classes;%GSDLHOME%\perllib;%shared_dir%\xalan.jar -DGSDLHOME=%GSDLHOME% ApplyXSLT %processing_dir%\xml-to-top-index.xsl  %source_dir%\tutorial_en.xml > %output_dir%\index.html

The generate-html.sh/bat scripts are shell scripts that carry out a lot of these commands for you.

Generating files for other languages

The English version of the tutorial is currently valid for Greenstone 2.85, while the French, Spanish and Russian versions are valid for Greenstone version 2.70. If you want to generate a workshop using one of these languages, you will need to use Greenstone 2.70.

You will need to replace the appropriate source file name for tutorial_en.xml in the above commands. Edit common.xsl, and change 'en' to e.g. 'fr' in the line

<xsl:variable name="diction" select="dict:new('en')"/>

If you want an up-to-date tutorial for another language, one option is to have the tutorial text in English, with all the button names and GLI references in the other language. To do this, use tutorial_en.xml as the source file, but change the dictionary language as above.

Generating the exercises for a workshop

For a workshop, you can select a subset of the exercises, and place them in any order you want. This is done with the manifest file. A sample manifest file has been included - this is one that we used for a Greenstone workshop in Hawaii, 2006.

Once you have created your manifest file, you need to run the following. You can choose whether to have a separate HTML file per session, or the entire workshop in one file.

  1. Run source setup.bash in the top level directory of your Greenstone installation
  2. Create a subdirectory in gsdl-tutorials for your output files, eg "workshop"
  3. cd to this directory
  4. Generate one file per workshop session:
    java -cp $shared_dir:$GSDLHOME/gli:$GSDLHOME/gli/classes:$GSDLHOME/perllib:$shared_dir/xalan.jar -DGSDLHOME=$GSDLHOME ApplyXSLT $processing_dir/xml-to-workshop.xsl $source_dir/tutorial_en.xml | perl -S $GSDLHOME/gli/help/splithelpdocument.pl
  5. Generate a single file containing all sessions
    java -cp $shared_dir:$GSDLHOME/gli:$GSDLHOME/gli/classes:$GSDLHOME/perllib:$shared_dir/xalan.jar -DGSDLHOME=$GSDLHOME ApplyXSLT $processing_dir/xml-to-one-workshop.xsl $source_dir/tutorial_en.xml > workshop.html
Windows versions of these commands are like:
  1. Run setup in the top level directory of your Greenstone installation
  2. Create a subdirectory in gsdl-tutorials for your output files, eg "workshop"
  3. cd to this directory
  4. Generate one file per workshop session:
    java -cp "%shared_dir%;%GSDLHOME%\gli;%GSDLHOME%\gli\classes;%GSDLHOME%\perllib;%shared_dir%\xalan.jar" -DGSDLHOME=%GSDLHOME% ApplyXSLT %processing_dir%\xml-to-workshop.xsl %source_dir%\tutorial_en.xml | perl -S "%GSDLHOME%\gli\help\splithelpdocument.pl"

  5. Generate a single file containing all sessions
    java -cp "%shared_dir%;%GSDLHOME%\gli;%GSDLHOME%\gli\classes;%GSDLHOME%\perllib;%shared_dir%\xalan.jar" -DGSDLHOME=%GSDLHOME% ApplyXSLT %processing_dir%\xml-to-one-workshop.xsl %source_dir%\tutorial_en.xml > workshop.html

The generate-workshop.sh/bat scripts are shell scripts that carry out these commands for you.

A basic manifest file looks something like this:

<Manifest>
<Title>Greenstone Hawaii Workshop, Jun 2006</Title>
<Section id="one" number="1">
<Heading>Lab 1: Installing Greenstone</Heading>
<TutorialRef id="install_greenstone"/>
<TutorialRef id="update_greenstone_installation"/>
</Section>
<Section id="two" number="2">
<Heading>Lab 2: Building a collection</Heading>
<TutorialRef id="small_html_collection"/>
<TutorialRef id="word_pdf_collection"/>
</Section>
</Manifest>

The manifest has a Title, which is the Workshop title. Then it is divided into Sections. Each section will be saved in a separate file, named using the Section's id attribute. A Section has a Heading, and then a list of TutorialRefs - these indicate which tutorials should go into the section. The id attribute must match the Tutorial id used in tutorial_en.xml.

For more control over the exercises, you can specify only part of a tutorial should be used in one exercise. For example, in the Hawaii workshop, we split the Word and PDF exercise over two lab sessions. To do this we used <SplitTutorialRef>.
<SplitTutorialRef id="word_pdf_collection" titleextra="—Part A" type="preceding" split="Heading[2]">
<EndNotes>
<Comment><Text>In exercise 2.1 we correct some of this incorrect metadata by manually adding Dublin Core Title metadata.</Text></Comment>
</EndNotes>
</SplitTutorialRef>
....
<SplitTutorialRef id="word_pdf_collection" titleextra="—Part B" type="following" current="true" split="Heading[2]">
<BeginNotes>
<Comment><Text>In the Librarian Interface, open up the reports collection that you created in exercise 1.5. Remember that the extracted Title metadata for some documents was incorrect.</Text></Comment>
</BeginNotes>
</SplitTutorialRef>

SplitTutorialRef has some extra attributes:
titleextra: some extra text to be added to the Title, in this case, we add "— Part A" and "— Part B".
split: the XML node to split the tutorial on.
type: whether we want the sections before the split (preceeding) or after the split (following).
current: set to true if the node to split on should be included.

SplitTutorialRef can also include BeginNotes and/or EndNotes element - this is for extra text of instructions that should be added to the start or end of the exercise. The format inside BeginNotes and EndNotes follows the format of the general tutorial, see below.

Tutorial XML Format

tutorial_en.xml is the main file. Make modifications in that. The translator takes care of the other languages.

All <Text> elements need a unique id, and all need to be on their own lines, with no other tags (apart from tags inside the text).

Tag examples:

<Link>url</Link> for URLS.
<Link url="url">display text</Link> for URLS which have different text to display
<Format>format statement, or macro statement</Format>
<Path>file paths</Path>
<Menu> menu sequence, eg File → New</Menu>

Bullet lists:

<BulletList>
<Bullet>
<Text id="223">first bullet point</Text>
</Bullet>
...
</BulletList>

Main numbering
<NumberedItem>
text, comments etc go in here
</NumberedItem>
Block of text in italics:
<Comment>
<Text id="xxx">some italics text</Text>
</Comment>
Section heading:
<Heading>
<Text id="009">A heading</Text>
</Heading>

Tutorial printing notes

To print the tutorials with appropriate highlighting in place, need to set "print background colours" in page setup (mozilla).