==================================================================== Saxon Instructions (Linux+Java only, modify them for windows) ===================================================================== Saxon comes in Java or .NET version. The documentation for the command line version of either is available at: http://www.saxonica.com/documentation/using-xquery/commandline.xml To download either version navigate to: http://sourceforge.net/projects/saxon/files/ (The instructions below will download saxon Java version from scratch). 0. Open a text editor of your own choice and save the following in q1.xq (uptil the end of ): { for $x in doc("mondial.xml")/mondial/country//city/name/text() return { $x } } Similarly save the following in q2.xq. { for $x in doc("mondial.xml")/mondial/country[normalize-space(name)="Peru"]/province[count(city)>1]/name return { fn:string($x) } } (: Comment :) (: !!! Note: Using "fn:string" is because $x is an attribute. This is one way to return the value of an attribute. The normalize-space function takes any non-single-space whitespace (newline, tab, consecutive spaces, etc) and replaces them with a single space, and removes all leading and trailing spaces. You may want to consider using this function when dealing with strings you cannot control (like strings from variables). :). 1. Navigate to the hw directory $ cd hw6 # Alternatively $ mkdir hw6 && cd $_ 2. Download the java version of the saxon home edition. $ wget http://sourceforge.net/projects/saxon/files/Saxon-HE/9.3/saxonhe9-3-0-1j.zip/download 3. Unzip saxon $ unzip saxonhe9-3-0-1j.zip 4. Get the mondial.xml and dtd (if not already done before) $ wget http://www.cs.washington.edu/education/courses/csep544/10au/hw/hw6/mondial.xml $ wget http://www.cs.washington.edu/education/courses/csep544/10au/hw/hw6/mondial.dtd 5. Run the program $ java -cp saxon9he.jar net.sf.saxon.Query q1.xq