RU beehive logo ITEC dept promo banner
ITEC 325
2011spring
ibarland

homelectsexamshws
breeze (snow day)

hw04-reviews
XSLT and DTDs
a videogame encyclopedia

Due: 2011.Apr.29 (Fri) 23:59; accepted up to May.01 noon

We will work with an XML-encoded database of information about videogames, hw04-reviews.xml.

  1. (5pts) Add one more game to the file.
  2. (25pts) Create an XSLT template which generates a summary-page of each game, looking similar to hw04-reviews-goal.html (you are encouraged to view-source).

  3. (Extra credit 10pts) Include the meta-critic score for each game: the average of all the (That is, if one review rated a game 8 out of 10, and another gave it 90 out of 100, the meta-critic score would be 85%.)

    Note that unfortunately, sum only allows node-sets as its arguments, not functions applied to nodesets.1 In order to calculate the meta-critic score, you'll have to set up a loop, and [read about how to] update a variable each time through the loop.

  4. (10pts) Have your list sorted by release-year, in reverse order (most recent first).
    (To test that this is working, have the game which you entered be in a different order than the output.)

    (If you want, you can use nested xsl:sort tags to sort by year-month-day2. Arrange the games in the source-file to make sure this sorting work.)

  5. (10pts) Include at least one apply-template instruction.
    (A separate template for formatting dates seems a good candidate for a nice, re-usable template.)
  6. (15pts) Generate a DTD for the grammar (You can have the DTD either in-line in your xml file, or as an external file.) Validate the file, using the validator such as the one at http://www.xmlvalidation.com/.

    If you include the DTD in-line, enclose all your <!ELEMENT> and <!ATTLIST> information inside a single, enclosing <!DOCTYPE games [ ]>: .

    <?xml  ?>
    <!DOCTYPE games [
      <!ELEMENT games (game*)>
      <!ELEMENT game >
      <!ATTLIST title
        lang >
      ⋮
    ]>
    

  7. (Extra-credit, 5pts) Define entities3 &ps3;, &wii2;, etc.

Please have your page (a) at https://php.radford.edu/~yourUserId/itec325/hw04.xml, with your other file(s) named hw04.xsl and (if in a separate file) hw04.dtd; and (b) those same files submitted on WebCT.

Tips:


1 Sigh. Someday these newfangled languages will catch up with Lisp's map (1965).      

2This is actually following a standard CS trick: If you first sort by month and then by year, you'll get what you want as long as the sorting algorithm is “stable” — it leaves tied elements in the same relative order they started in. It makes sense: after the first sort on months, all the Januaries come before all the Februaries. When you now sort by year, and two games are tied for year, the January one will stay ahead of the February one, in a stable sort.)      

3Okay okay, if you get technical, the “&” and “;” aren't part of the entity. Still, you know what I mean.      

homelectsexamshws
breeze (snow day)


©2011, Ian Barland, Radford University
Last modified 2011.Apr.26 (Tue)
Please mail any suggestions
(incl. typos, broken links)
to ibarlandradford.edu
Powered by PLT Scheme