# Shakespeare Example

This example works on an input file containing a Shakespeare play. You can use any of the Shakespeare plays in Jon Bosak's distribution at http://www.ibiblio.org/bosak/xml/eg/shaks200.zip, but for convenience one of them, Othello, is included in the Saxon distribution (in the samples\data directory).

Shakespeare stylesheet

There is an XSLT stylesheet, `play.xsl`, which processes an input play in XML and generates a set of linked HTML files (one for the play and one for each scene) in an output directory. To run this on the Java platform, create a directory (say playhtml) and execute the following from the command line:

cd samples
java net.sf.saxon.Transform data\othello.xml styles\play.xsl dir=playhtml

The equivalent on .NET is:

cd samples
Transform data\othello.xml styles\play.xsl dir=playhtml

The last parameter sets the value of the constant dir to the value playhtml; this constant is referenced from the style sheet when creating output files.

Shakespeare XPath Sample Application

This example applies to the Java platform only. However, there is also a C# version of this application in `samples/cs/XPathExample`.

In the `samples/java` directory is an example application called `XPathExample.java`. This is designed to illustrate the use of Saxon's implementation of the JAXP 1.3 XPath API from a Java application. It searches a Shakespeare play for all occurrences of a word entered from the console, displaying the lines containing that word, and the context where they appear.

To run this example, first ensure that it is on your classpath, and find the location of the `othello.xml` file in the `samples/data` directory. Open a command-line console, and run the application using the command:

cd samples
java XPathExample data\othello.xml

The application prompts for a word. Enter the word (try "castle" or "handkerchief"). The lines containing the chosen word are displayed on the console. Exit the application by entering ".".

Next