Adobe
GoLive 6 Dynamic Content Samples
Overview
Database Design
Monthly View

This example uses XML data sources to describe the structure of the calendar and provide the information to be displayed as calendar events.

Two XML files are used along with an XSLT transform script to join them and create a data format that makes it easy to generate the web page.

Calendar.xml

This file lists dates in the months. It has the following structure:

<?xml version="1.0" encoding="UTF-8"?>
<Calendar>
<Page Month="January">
<Box />
<Box Day="1" Date="2001-01-01" />
<Box Day="2" Date="2001-01-02" />
...
<Box Day="31" Date="2001-01-31" />
<Box />
<Box />
<Box />
</Page>
<Page Month="February">
<Box />
<Box />
<Box />
<Box />
<Box Day="1" Date="2001-02-01" />
<Box Day="2" Date="2001-02-02" />
...
</Page>
</Calendar>

Note that the top level element is Calendar which contains a series of 12 <Page> elements. Within each <Page> element are 35 <Box> elements each of which represent a calendar box. Some boxes are numbered and some are blank.

Events.xml

This XML file contains elements representing items that should appear in the calendar boxes. The structure of this file is:

<?xml version="1.0" encoding="UTF-8"?>
<Events>
<Event Date="2001-01-03">Computer Class 101</Event>
<Event Date="2001-01-10">Park Skate (Ice skating on the Park Pond)</Event>
<Event Date="2001-01-20">Joe Shalik Band in Concert</Event>
</Events>

Each <Event> element has a Date attribute and a value.

Calendar.xsl

The XSLT script combines the two XML files and returns a structure similar to a database JOIN of two tables. The resulting structure looks like the Calendar.xml file but includes an added attribute containing the Event value.

Calendar XML Data Source

To use XML content on a page, you need to create an XML datasource that contains information about the structure of the XML file that will be used. This is done in the Site Settings dialog. You fill in the information to access a sample XML file with structure representative of what will later be used on the page. You then expand the display and select xml elements and attributes that you want to use on your page.