Book List Example
The XML file
is used for a number of demonstrations. This file, along with its DTD
books.dtd, is found in the
books.xsl can be used to display the data, and is designed to
illustrate several Saxon extensions. Run this as follows, with the samples directory as
the current directory:
For SaxonJ:java net.sf.saxon.Transform -s:data/books.xml -xsl:styles/books.xsl -o:output.html
For SaxonCS:dotnet SaxonCS transform -s:data/books.xml -xsl:styles/books.xsl -o:output.html
This produces an HTML page showing the data.
The stylesheet takes a parameter named "top-author". This is the name of the "author of the week", and the default value is "Jasper Fforde". To run the stylesheet with a different top author, try adding to the end of the command line:..... top-author='Thomas Hardy'
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 -q:query/books.xq -o:output.html
The equivalent on .NET is:dotnet SaxonCS query -s:data/books.xml -q:query/books.xq -o:output.html
Several other related XML resources are supplied. The schema for
data/books.xsd. Also supplied in the
samples resources is the file
data/books-invalid.xml, which (as the name
suggests) is a version of the books file which is invalid against the schema, and
data/more-books.xml which lists some different books.
may be used for instance with the sample applications
There is another stylesheet,
styles/books-csv.xsl, which converts the data
in the file
data/books.xml into a comma-separated-values file.
styles/total.xsl is used by the JDOM2 Example application, and the query
query/books-to-html.xq is used by one of the examples in the
The sample program
XPathExampleSA.java illustrates the use of the JAXP XPath
API, extended by Saxon to allow schema-aware XPath 2.0 processing. The program is
designed to run against the sample file
books.xml. It produces a list of
all books over 2cm thick that were published during the 6 years since the start of
Also see the SQL extension
instructions example for details on the sample stylesheet
styles/books-sql.xsl which uses Saxon SQL extension instructions to
load the contents of
books.xml into a database table.