Exercises

XPath Exercises

  • Download the following three files to your local machine. Open data.xml in your browser to view the exercise. Open the same file in notepad to view the XML structure. Note that the .xml file calls the xpaths.xsl file, which mixes HTML with XSLT fragments to output the result of XPath expressions.
  • To answer the questions in the assignment, edit the .xsl file and enter in XPath expressions inside <xsl:value-of> tags as shown in the sample.
  • If you get stuck or want to check your answers, look at the answers.xsl file. Edit the stylesheet declaration in the data.xml file if you want to view the answers.xsl stylesheet applied to the data.
  • We will discuss this or practice this exercise in class as needed.

XSLT Exercises
Download the following files to your computer. Each file comes directly from the Examples Appendix of the XSLT Spec:

You can view the result in your browser by prefacing each .xml file with the following processing instruction:

<?xml:stylesheet type="text/xsl" href="insert-stylesheet-name-here.xsl"?>

You can also use an XSLT processor to create the result document, so that you can inspect it, in addition to viewing it in a browser.