Simon Woodside | Alexandra open-source Relax NG to HTML forms and back again FAQ
Skip to content >

Alexandra open-source Relax NG to HTML forms and back again FAQ

Alexandra open-source Relax NG to HTML forms and back again FAQ

Simon Woodside

Revision History
Revision 1 2003/01/15 sbwoodside


What is Alexandra?

These are XSLT stylesheets to be used with a Relax NG schema. Alexandra uses the RNG schema to create a roundtripping forms interface in HTML to edit an instance document that conforms to the schema.


What's Relax NG?

RNG (Relax NG) is a schema language for XML. It's similar to, but better than ;-) the W3C XML Schema language. It's also a replacement for DTDs.


I have an W3C XML Schema/DTD/whatever, how do I get an RNG grammar?

There are some very convenient converters. Why don't you try Jing? That's what I used.


Why use Relax NG instead of W3C XML Schema/DTDs/etc?

RNG is an XML dialect so I can apply XSLT transformations to it. This is the glaring advantage over a DTD. I also considered W3C XML schemas but I discarded that because it's too complicated — unecessarily so in my opinion. In fact, I can't understand the specification, and I usually use the spec as my documentation. In fact, from researching the situation, it seems that actually most other people can't understand WXS (or XSD, or whatever you'd like to call it) either.

In addition, RNG is a superset of WXS, so anything that can be expressed in WXS can be converted to RNG. In addition, RNG has support for arbitrarily ordered elements and WXS doesn't — which seemed like a fairly glaring oversight to me.

To complete my diatribe, let me add that I think that RNG is a very easy-to-read, easy-to-work with schema language. I hope that more people adopt it.


What's all this about then? What's it for?

Lots of people these days are writing schemas to validate their XML data. Schemas are good because they can validate an existing instance document. Alexandra goes the other way, using the schema to help create a document that is always valid.

In order to avoid constantly writing forms interfaces by hand, it is necessary to introduce some form of automation into the process. Alexandra does this by using information that is already available about what the document is supposed to look like. Since schemas already exist for many formats, it would be simple to be able to plug in a schema and get a forms interface automatically.

Roundtripping is the process of sending the data on a round-trip from the server to the client (UA (user agent)) and back again. Alexandra passes information about the data format to the UA, and the UA passes information about changes the client wants to make back to the server. Then, the server updates the instance with this new information, and passes a new image of the data back to the client. This is a roundtrip.


Why do all that work on the server when you could do it on the client?

First, doing it on the client is still a hypothetical. It may be possible to do all of the necessary work on the client in a limited situation, e.g., Microsoft Internet Explorer 6.0. However many clients are not yet capable of doing what Alexandra can do. And some clients may never be up to it (e.g. cell phones, PDAs) while Alexandra could serve very light-weight forms to virtually any client device.

In addition, we would not want to trust the client to validate the data. That is best done on the trusted server.

Finally there is the issue of compatibility. Even if we limit ourselves to PC browsers, the different browsers have different implementations, e.g., of DOM and ECMAScript. I wish to write only once, and deploy on any platform.


What's all this about AxKit?

AxKit is a web-applications suite from the Apache project. It's written in perl but you don't need to know any perl to use it. It has excellent support for XSLT pipelining.

If you do know perl you can write extension in perl fairly easily. AxKit also supports taglibs and a language called XSP (eXtensible Server Pages). Alexandra is fully written in XSLT.

Apparently the Cocoon project from Apache is also an XSLT pipelining solution, written in Java.


Do I need to use AxKit to run Alexandra?

This distribution requires AxKit. I don't know if it will run on Cocoon without changes. From what I hear, they are very similar, so it could probably be ported to Cocoon. If other XSLT pipelining solutions appear, it could probably be ported to those as well.


What's XSLT pipelining?

Instead of just applying a single XSLT stylesheet to a document, with tons and tons of includes, you write a series of XSLTs. The results of one are passed on as input to the next. This allows a very flexible, reusable style of programming.

Incidentally, AxKit now supports (through the axkit: URI) XSLT tree-pipelining, which is even more flexible and fun. I don't use it in this project though (yet).


Doesn't it seem kind of ... unpolished?

The current release (0.01) is a pre-alpha demonstration release. It's GPL code so feel free to use and modify it if you want to.

Copyright © 1996-2007 Simon Woodside. If no license is noted, rights are reserved.

Valid XHTML 1.0 strict? Made with AxKit and Saxite.