CIT041X Index > Assignment XSL-FO

Converting XML to XSL-FO

The object of this assignment is to write an XSLT stylesheet that will transform a movie database to an XSL-FO document, which can then be converted to a PDF file. Your final PDF file should look like this.

The XML File

The XML file you should use is a modified version of the XML file from assignment 4. Here it is. The changes are:

The Conversion - Requirements

For each movie:

The synopsis is followed by production credits

Production credits are followed by the cast.

The cast is followed by reviews, if any.

Notes & Hint

If you wish to use the extra information in the <actor> element to do something special with lead actors or actors who deserve special mention, you may do so, but you do not have to.

The trickiest part comes when you are handling a <review> element and have to output the corresponding <reviewer>. This is because review/reviewer pairs are all in a line; they aren’t “fenced in” by a parent element the way that name/role pairs are enclosed in an <actor> element.

If you are in a template that matches a <review> element, and you want to get the corresponding <reviewer>, use this expression: select="following-sibling::*[position()=1]". The following-sibling::* selects all nodes on the following-sibling axis. The [position()=1] predicate will narrow that down to the first of those siblings, which is the <reviewer> element that you want.

Your final PDF file should look like this.