================================ XSLT Transformations over Movies ================================ ------------------------------------------------------------------------- 1. Return an element "movie_titles" that contains a list of alphabetically sorted titles of all movies in the document. Write two stylesheets, one where iteration is expressed by template calls and another one where iteration is expressed by elements. ------------------------------------------------------------------------- Version 1: Iteration by template calls ------------------------------------------------------------------------- Version 2: Iteration by ------------------------------------------------------------------------- 2. Return an element with a list of elements, containing in turn attributes title and year, ordered by year in descending order. Use static element and attribute constructors ------------------------------------------------------------------------- ------------------------------------------------------------------------- 3. Rewrite the preceding stylesheet so that you use copying and dynamic element and attribute constructors whereever possible. ------------------------------------------------------------------------- ------------------------------------------------------------------------- 4. Restructure the movies document so that - movies appear according to their year, with the most recent years first, and, within the same year, according to their title - countries appear in alphabetical order - for each director, the first name is given before the last name - actors of a movie appear according to their last name and, for actors with the same last name, according to their first name. Everything else should remain as before. ------------------------------------------------------------------------- ------------------------------------------------------------------------- 5. Return an element with an alphabetically sorted list of elements, where each country from the document occurs exactly once. Use the two approaches shown in the lecture. ------------------------------------------------------------------------- Version 1: XPath test for duplicates ------------------------------------------------------------------------- Version 2: Muenchian approach to duplicate elimination ------------------------------------------------------------------------- 6. Output movies (title and year) and within each movie those actors whose role occurs in the summary of the movie. ------------------------------------------------------------------------- ------------------------------------------------------------------------- 7. Return an element with a list of elements, alphabetically sorted by last name and first name, where each actor from the movies document occurs exactly once. Each actor element should contain last name, first name, and year of birth of the actor. Hint: You need an element to remember the last name when you sort according to first name. ------------------------------------------------------------------------- The first sample solution uses the XPath-based method to eliminate duplicates: ------------------------------------------------------------------------- The next sample improves upon this idea by creating an index to speed up the search for actors with the same last name. ------------------------------------------------------------------------- The third sample solution follows an idea of Lukas Siemon and uses a key to choose only one copy of several duplicate actors. ------------------------------------------------------------------------- 8. Extend the stylesheet for the preceding task so that an actor also contains an element “movies” with the movies starring the actor (title and year are all the info needed for a movie). ------------------------------------------------------------------------- This is an extension of the first version. Note that I introduced an additional variable because I want to remember both the first name and the last name when retrieving the films of an actor. ------------------------------------------------------------------------- This is an extension of the second version. I used an additional variable to remember the last name when retrieving the movies for an actor. In line with the usage of an index ("key") for retrieving actors, I also used an index for retrieving movies. ------------------------------------------------------------------------- This is an extension of the third version, again following the solution by Lukas Siemon. Here, we use the same index for retrieving the movies as for retrieving the actors, which makes sense, since each actor occurs below the movie in which they act.