saxonica.com

The Book List Stylesheet

This is a very simple sample stylesheet to illustrate several Saxon extensions. It uses the XML file books.xml (derived from a file issued originally by Microsoft). You will find this in the samples\data directory. The DTD is in books.dtd

There is a style sheet books.xsl that can be used to display the data: run this as follows, with the samples directory as the current directory:

On the Java platform:

java net.sf.saxon.Transform data\books.xml styles\books.xsl >output.html

On the .NET platform:

Transform data\books.xml styles\books.xsl >output.html

This produces an HTML page showing the data. (The output isn't very pretty, if you have time to write an improved version, please send it in).

The stylesheet takes a parameter named "top-author". This is the name of the "author of the week", and the default value is "Bonner". To run the stylesheet with a different top author, try adding to the end of the command line:

..... top-author=Danzig >output.html

It is possible (under those operating systems I know of) to write the author's name in quotes if it contains spaces, e.g. top-author="A. A. Milne".

There is another style sheet, books-csv.xsl, which converts the data into a comma-separated-values file.

A query that runs with this data is also supplied. The command to use on the Java platform is:

java net.sf.saxon.Query -s data\books.xml query\books.xq >output.html

The equivalent on .NET is:

Query -s data\books.xml query\books.xq >output.html

Next