Digital Media Technology
Assignment 2

A. XSLT Stylesheet (50%).

Choose one of the scenarios below and write a stylesheet which can display or calculate all the information that is mentioned. More information on the use of APIs can be found here. Name your file [your surname]-DMT_Assignment2a.xsl, in accordance with the BDMS Style Sheet. Submit both the XML file and your XSL file. This part of the assignment can be awarded a maximum of 10 points.

Scenario 1
The GoodReads Api enables you to download data about a specific book title, identified by an ISBN. To obtain all the data that is available for the title with ISBN 9780385537148, for instance, you can use the following query:
https://www.goodreads.com/book/isbn/9780385537148?key=yZUIiWVAZOHzCFlFwIOTXA

Using the GoodReads API, download an XML file that contains data about a specific book. The GoodReads API can return bibliographic data, and data about books, which, according to readers, are related to this title. In the section that is encoded using the element <popular_shelves>, count both the total number of shelves the book is added to, and the number of shelves that have a count of 50 or higher (if applicable). In addition, create a bulleted list which shows all books this title is related. Only show those titles which have a rating of 4 or higher. Show the author name, the title in italics and the year of publication. This list must be sorted on the basis of the rating, in a descending order.

Scenario 2
You can use the New York Times Books API enables to get data about books reviews and bestseller lists.
The bestellers which were in the "combined print and e-book fiction" list from 1 January 2015 can be found, for instance, using the following query:
http://api.nytimes.com/svc/books/v3/lists/2015-01-01/combined-print-and-e-book-fiction.xml?api-key=cda705355dc731a3b819ac80ce02578b:15:72378286

The New York Times also publishes other types of beststellers lists. Information about the various categories can be found using the following API query:
http://api.nytimes.com/svc/books/v3/lists/names.xml?api-key=cda705355dc731a3b819ac80ce02578b:15:72378286 In the lists API, you need to use the name of the lists as given in the element >list_name_encoded<

Download a list of bestsellers from the New York Times, using the NYT’s books API. Write a stylesheet that can count the total number of books in the list, and the total number of books that have been on the list for longer than 10 weeks (if applicable; change this number if necessary. Note that this information can be found in the element <weeks_on_list>). Also create a bulleted list which shows all the books which are new on the list (i.e. where <weeks_on_list> is zero). For these new titles, display the title in italics, the author name, and, if available, a description. The list must be sorted alphabetically by title.

Scenario 3
Download one of the following TEI files:

Write a stylesheet that can count the number of acts, or, if no acts are available, the number of stage directions. Provide this information by writing the following sentence: “This play consists of … [acts / stage directions ].".
Next, choose a character from the play, and calculate data about the number of speeches spoken by this character (produce the sentence " The character [enter name of character here] has … speeches”). All the speeches in the play are encoded using the <sp> element. Create a list of all the spoken parts in the play which consists of less than 100 characters. Also display the total number of characters in between brackets. N.B. The length of a string of text can be calculated using the string-length() function.
The files that were made available have been encoded in the Text Creation Partnership. Shakespeare plays may also be downloaded from the website of the Folger Shakespeare Library. The TEI that are avilable at this site have a slightly more complicated encoded. To allow for linguistic analysis, the individual words in the plays have been encoded separately using the <w> element. The names of the speakers, for instance, can be found under speaker/w.


A similar scenario with a model answer can be found here.

B. Questions (50%).

The questions test your understanding of the concepts and the techniques that have been explained in the Digital Media Technology lectures and seminars on XSLT, and/or before. Read all the questions very carefully and motivate your answers as fully as possible. The answers to these questions need to be given in a separate document. Do not forget to write your name in the document that you submit, and format the file in accordance with the BDMS Style Sheet.
The five questions can be awarded 2 points each.

  1. Which XPath expressions have you used in the stylesheet that you have written for part A of this assignment? Name at least three, and briefly explain their function. [maximum word count (mwc): 150]

  2. To publish a TEI XML file on the web, it is usually transformed into HTML, with XSLT. An alternative publication scenario could be to encode the text directly in HTML and style it with CSS, without having to create a an XSLT to transform the XML. What advantage(s) and disadvantage(s) adhere to both scenarios? [mwc: 300]

  3. Mendeley and Zotero are two reference management applications, with which users can easily display sources in various citation styles, based on stored metadata. Below you can find three examples of this: in the first example (i), the article is cited according to the style of the American Psychological Association (APA); in the second example (ii), the citation follows the rules of the Modern Language Association (MLA); the third example (iii) adheres to the BDMS Stylesheet.
    1. Schreibman, S., Gueguen, G., & Roper J., (2008). Cross-collection Searching: A Pandora's Box or the Holy Grail', Literary and Linguistics Computing, 23 (1), 13-25.
    2. Schreibman, S., et al. "Cross-collection Searching: A Pandora's Box or the Holy Grail." Literary and Linguistics Computing 23.1 (2008): 13-25.
    3. S. Schreibman, G. Gueguen, and J. Roper,'Cross-collection Searching: A Pandora's Box or the Holy Grail', Literary and Linguistics Computing 23.1 (2008), pp. 13-25.

    Explain how XML and XSLT techniques can be used on these reference management applications to implement such a functionality. Which XSLT elements would you need to make sure any citation style can be precisely followed? Tip: Note that not all sources have multiple authors, or pagination. [maximum word count: 200]

  4. Explain the difference between 'statements' and 'flow control components' in programming languages. In which category would you place <xsl:for-each>?

  5. According to you and/or based on your own experience, which aspect(s) of XSLT is/are most difficult for new learners of the language? Illustrate your argumentation with material from the XSLT Exercises[maximum word count: 200]