Last modified on 3 May 2009, at 22:25

XML - Managing Data Exchange/XSLT and Style Sheets/Exercises

Stylesheet Chapter => XSL and Style Sheets

Stylesheet Answers => Answers

  1. For Chapter 2's exercises, we created an XML document, schema, and stylesheet to define a museum entity. Change that stylesheet to transform that XML document into another XML document, instead of into HTML.
  2. In Chapter 4 we created an XML document, schema, and stylesheet to list restaurants, including the most popular, in a city.
    • a. Create a new stylesheet that uses a named template to output the name of the city. Then use two templates with different modes to print out the restaurants, using a larger font for the most popular restaurant.
    • b. Now create a stylesheet that will sort the restaurant names alphabetically, and number them using the number() function and a single level of numbering.
    • c. Finally, we will use the call-template and with-param elements to create a stylesheet that will count the restaurants in a city, and add the prices up, and output it to a text file. This stylesheet will first call a template named "count-restaurants" and will use with-param to pass a parameter to count the restaurants. Then it will call a template named "sum-prices" that will use with-param to pass the parameter "num" to sum() the upper price for the restaurant.

Stylesheet Chapter => XSL and Style Sheets

Stylesheet Answers => Answers