| iMatix home page
| Xitami home page
| << | < | > | >>
Xitami Xitami
Version 2.5b4

 

Server-Side XML Processing

XML is a data-definition language, used more and more to describe data coming from databases and other places. Xitami can produce XML logfiles, and uses XML in other places.

With server-side XML processing, you can display XML files as HTML quickly and easily, with full control over the HTML that is produced. Xitami's XML processing is simpler and more powerful than stylesheets or other ways of processing XML.

Server-side XML processing is an excellent way to show data coming from databases, other applications, spreadsheets, and so on. All you need to do is to create the data in an XML format and write a GSL script that processes it (as described below).

The GSL Language

Xitami uses the GSL language to describe how an XML file is shown. GSL is iMatix's Open Source template-based code-generation language. The GSLgen engine is built-in to Xitami, and GSLgen is also provided as a seperate command-line tool with Xitami.

If you want to use server-side XML processing, you should download the GSLgen tool from imatix.com, and study the GSL language. It's quite simple. This is an example GSL script, provided as an example in the webpages directory:

<HTML><BODY><CENTER>
<H1>Client Summary</H1>
<P>At $(date) $(time)
.for client
<H3>$(name:)</H3>
<P>$(address:)
<TABLE WIDTH="50%">
<TR><TD>Date:</TD><TD>Quantity:</TD><TD>Delivered:</TD></TR>
.define total = 0
.for order
<TR><TD>$(date:)</TD><TD>$(quantity:)</TD><TD>$(delivered:)</TD></TR>
.define total = total + quantity
.endfor
</TABLE>
<P>Total ordered: $(total)
.endfor
</CENTER></BODY></HTML>

By default, Xitami uses a script with the same name as the XML file (but with the extension .gsl). You can use a specific script by adding an attribute 'script' to the root item, e.g.:

<data script = "testxml.gsl" >

This is useful if you process several XML files through the same script.

Preparing Output From CGIs

One handy way to use XML files is in combination with CGIs. Your CGI program can create an XML file, then use the 302 HTTP code to redirect the request to the XML file.

Predefined Attributes

As well as the standard attributes (date, time, filename, script), the GSL script can access all the environment variables normally passed to a CGI program, such as REMOTE_USER.

Passing Arguments to The XML File

You can pass arguments to the the XML file processor by using the query string syntax:

http://xx.xx.xx.xx/myfile.xml?arg=value;arg=value;...

This is useful to override attributes like 'script'. All arguments passed in the query string are defined in the XML root item.


| << | < | > | >>
| Welcome To Xitami | Table Of Contents | Installing Xitami | Administration | Configuration | Using The Common Gateway Interface (CGI) | Server-Side Includes (SSI) | Using Filters | Server-Side XML Processing | Server-Side GSL Scripting | Image Maps | Virtual Hosts | The FTP Service | The Dynamic DNS Feature | Throttle Pipes | A Beginner's Guide | Writing Web Server Extension (WSX) Agents | Extending Xitami with External Peer Processes | FAQ | Getting Support | Credits | Release History | License Agreement
iMatix
Copyright © 1996-99 iMatix Corporation