# XQuery/Slideshow
## Motivation

Despite being a 20-year old program, albeit enhanced over the years, Microsoft PowerPoint is the ubiquitous presentation software. It provides a wide range of functionality, but most of us use it for simple text slides, perhaps with a bit of animation.
However Powerpoint does not cleanly separate the content of the presentation from its presentation (as slides, in printed form, as a index) and appearance (styles, colors), is an expensive proprietary product and over-weight for many tasks. Thus there is value in using simple XML tools to provide similar functionality.

## Prior art

There are a number of approaches to using XML technologies to provide light-weight, non-proprietorial presentation software. These typically rely on a web browser as the rendering engine (a design choice not open to Richard Gaskins in 1984). Core problems are the task of dividing the presentation into separate slides and supporting navigation in the slide sequence.
* Slidy by Dave Raggett - SlidyXML, XSLT, Javascript
* S5 by Eric Meyer
* DocBook by Norman Walsh - DocBook, XSLT
* DocBook, CSS, Opera presentation mode
This project uses XQuery as the server-side language.

## Presentation format

Other approaches use a defined vocabulary but the choice here is to use XHTML with a little additional markup to define slide boundaries and slideshow properties. This provides a wide range of functionality needed such as formating, linking, images, embedded video.
Here I have used two namespaces: the default is the XHTML used in the slide body, the ss namespace is used for the slideshow elements which define slideshow properties, master slide, and the slide boundaries.
This is a very minimal format which would be expanded in future.

## The Script

The XML document defining the slideshow content needs to be transformed into slides for projection and into a print format. In this implementation, both versions are generated from the same script.

### Namespaces

The two namespaces must be declared - an arbitrary prefix used for the default XHTML namespace.

### Parameters

The slide parameters are the uri of the slideshow document (whether a database document or an external document), the slide number and the mode - slide or print. The parameters are passed in a semicolon-delimited query string rather than in the more usual key=value form because I was unable to get the & separator to work in Javascript(??)

### Fetching the XML

The slideshow is fetched - this is faster if stored in the database but may also be an external file.

### The Slide Show
#### Show a Slide

A function generates the div holding a slide. The global variables define the common slideshow properties.

#### Contents Slide

The <h1> element in each slide is used to generate a contents slide, numbered 0.

#### Navigation

Navigation is handled by a JavaScript function which handles keypress events and is attached to the page body. This code is different for each slide so is generated for each slide. The keypress mapping is based partly on the codes generated by a common wireless presenter, the Labtec Notebook presenter which is designed for use with PowerPoint. Documentation on the device was hard to find, so the key mapping was analysed by capturing the keypresses observed by a simple javascript.
* left and right buttons: PageUp and PageDown to step forwards and backwards
* bottom key : 'b' to blank the screen
* top button : toggle between F5 to fullscreen, Esc to edit mode
Other key mappings were added to allow the cursor keys to be used and to go to print mode.
Note that in generating this Javascript code, { } brackets need to be doubled.

#### Generate
### Print format

Other functions generate a printable version of the slide show. This comprises :

#### Links

The URIs for links is not visible in the printed slides, so it is useful to add a final page with all the links which appear in the slides listed together.

#### Generate Print View

If the mode is "print" then generate the print format:

## Execute

* An introductory lecture - incomplete CW 18/09/08