XQuery/Creating a Timeline

Motivation
You want to create a timeline of event data. Timelines show events in a horizontal scrolling view.

Method
We will use the JavaScript client Timeline widgets provided by the Simile-Widgets project. In this example we will be using the timeline 2.2.0 API calls.

To do this we need to transform a list of event dates into the proper formats and then create an HTML page that includes calls to the Simile JavaScript libraries.

Steps
 * 1) View sample Event XML File format
 * 2) View HTML template that loads XML file
 * 3) Create XQuery Function that generates the HTML template and loads the appropriate XML data file

Our first example will use a list of non-Duration Events (Instant Events). We will explore duration events and other events in a future chapter.

We will then create a simple XQuery module with a single function that loads a simple timeline.

Sample XML File Using Standard XML Date Formats
Most XML dates use ISO 8601 coding. To use this format you must put in a date format attribute in the data file.

Note that the data file must specify the ISO8601 date formats that are used as the XML date format.

HTML Driver Template
The sample HTML file shows how this XML file is loaded using the Timeline.loadXML function.

Sample Image
This will produce the following example: