SiteExperts.com Logo Home | Community | Developer's Paradise | Jobs
User Groups | Site Tools | Site Information | Search

Inside Technique : XML-Based Survey Server : Survey Server Overview

The Survey Server consists of three core files:

  • An XML file storing the survey data - surveys.xml.
  • An XSL file describing the different presentation's for the data - surveys.xsl.
  • An ASP include file containing core functions for manipulating and generating Surveys - survey.inc.

These three files provide support for any number of surveys into your web-site. In addition, a single web page is provided for creating, editing and deleting surveys.

The XML data file, surveys.xml, defines the surveys and current number of votes in the following format:

<surveylist>
  <survey voters="20">
    <id>1</id>
    <question>Do you program with ASP?</question>
    <answer votes="13">Yes</answer>
    <answer votes="7">No</answer>
  </survey>
  <survey voters="201">
    <id>2</id>
    <question>Do you program with JavaScript?</question>
    <answer votes="53">Yes</answer>
    <answer votes="142">No</answer>
    <answer votes="6">I want to</answer>
  </survey>
</surveylist>

Each survey is defined within a survey element. To indentify each survey, an ID element is defined whose value must be unique across all surveys. Within each survey you can have one unique question element and any number of answers. The answers are presented in the same order they are stored.

To track the survey answers the number of votes are stored in the answer elements votes attribute. To improve efficiency, we also store the total number of votes in a voters attribute on the survey element.

The survey presentation is stored independently from the actual data. The Survey Server supports an extensible number of presentations. We currently provide two sample presentations - one that enables you to present the survey as a 468x60 banner, the other is a 125 pixel wide box that grows vertically. Below demonstrates both presentations of the first survey:

Horizontal Banner

Vertical Banner
Do you program with ASP?

Survey Server from SiteExperts.com

After voting, the results are presented using a simple HTML-based bar chart based on our original HTML bar-chart technique.

Do you program with ASP?

Total Voters: 25
(68%)
Yes
(28%)
No
(4%)
Sometimes
Survey Server, Copyright 1999, SiteExperts.com

This bar chart is also generated using an XSL file allowing you to easily modify and change the result presentation.

All the presentation information is defined in a single file, survey.xsl. New presentations can be added simply by adding a new section to the file. We continue by explaining how to define presentations within the survey.xsl file.