# An Example Web Site

### Trevor Nash

Melvaig Software Engineering Limited

## Chapter 1. Web Site

## Administrative Details

Declare an object which controls whether the site is produced in 'development mode', i.e. whether icons for editing the source files are provided. Change this to false() to produce a production site.

For Object w:mode replacement:

    <sk:replace>
    <sk:declare>
       <xsl:param name="dev-mode" select="true()"/>
    </sk:declare>
    </sk:replace>

## Style and Presentation

The background color is #cccccc with #99cccc for the navigation pane. Markers: ideally these would be graphics, but you can use characters. If you change the character used, change w:other-marker as well.

First, for the tabular format.

For Object w:current-marker replacement:w:current-marker[@style='tabular']

    <sk:replace match="w:current-marker[@style='tabular']">></sk:replace>

Note the trick with colours to get an apparently blank space the same size as the current marker: we use the same character, but make the foreground colour the same as the background.
For Object w:other-marker replacement:w:other-marker[@style='tabular']

    <sk:replace match="w:other-marker[@style='tabular']"><font color="#99cccc">></font></sk:replace>

And now the plain style. We only have a marker for the current page here.

For Object w:current-marker replacement:w:current-marker[@style='plain']

    <sk:replace match="w:current-marker[@style='plain']">@</sk:replace>

## The Index Page

The Web Sock produces two different formats of HTML from the same content. The index page welcomes the browser to the site and invites them to select the format they prefer.

### The Index Page

Example Home Page

## Site Contents

Define the headers and footers. We use the same text regardless of format for the footer, but use the type attribute to select something more colourful for the header on the tabular format.

For Object w:header replacement:w:header[@style='tabular']

    <sk:replace match="w:header[@style='tabular']">
       <p align="right" style="color: #800000; font-size: 18pt; font-family: sans-serif; font-weight: bold">Web Example</p>
    </sk:replace>

For Object w:header replacement:w:header[@style!='tabular']

    <sk:replace match="w:header[@style!='tabular']">
       <center><h2>Web Example</h2></center>
    </sk:replace>

For Object w:footer replacement:

    <sk:replace>Site developed using Sock,
    <w:link href="http://www.melvaig.co.uk"/></sk:replace>

The site is laid out as a tree with the home page at the top. Each page has a body and possibly sub-pages.

### Site Structure

An Example Web Site

- A Leaf Page
- Nested Pages
  - Sub page 1 of Nested Pages
  - Sub page 2 of Nested Pages
- Contact