UMEÅ UNIVERSITET Institutionen för informatik Andreas Lund alund@informatik.umu.se Workshop 3 Omvandling av bibliografiska data med XSLT Inledning Denna workshopen syftar till att ge praktisk färdighet i att skapa omvandlingsmallar med XSLT-språket för att omvandla XML-dokument till HTML. Workshopen är organiserad i ett antal mindre uppgifter med successivt ökande grad av komplexitet. Kontexten för upgifterna är ett XML-dokument med bibliografiska data. Rotelemented i detta dokument heter publications. Publicationselementet har som underordnade element en samling av element med namnet publication. Kännetecknande för detta element är att det har ett attribut med namnet type. Värdet på detta attribut anger vad för slags publikation elementet i fråga avser. I sin nuvarande version förekommer följande värden på detta attribut: book, journal article, book section och edited book. Beroende på vilken publikationstyp det är frågan om kan publications-elementen skilja sig åt med avseende på vilka underordnade barnelement de har. Gemensamt för alla publication-element är dock att de har ett element för titel (title), ett eller flera element för författare (author), samt publikationsår (year). Undersök dokumentet i en textediorför att få grepp om vilka övriga element som ingår. Nedanstående är en redigerad kortversion av dokumentet med ett publication-element för varje publikationstyp:
<?xml version="1.0" encoding="iso-8859-1"?> <publications> <publication type="book section"> <author>virzi, Robert A.</author> <year>1997</year> <title>usability Inspection Methods</title> <book>handbook of Human-Computer Interaction</book> <publisher>elsevier Science B. V</publisher> <pages>705--715</pages> <publication type="journal article"> <author>wolf, Catherine C.</author> <year>1992</year> <title>a Comparative Study of Gestural, Keyboard, and Mouse Interfaces</title> <journal>behaviour and Information Technology</journal> <volume>11</volume> <issue>1</issue> <pages>13-23</pages> <abstract>this paper presents results from three experiments which compared gestural, keyboard, and mouse/keyboard interfaces to a spreadsheet program. This is the first quantitative comparison of these types of interfaces known to the author. The gestural interface employed gestures (hand-drawn marks such as carets or brackets) for commands, and handwriting as input techniques. In one configuration, the input/output hardware consisted of a transparent digitizing tablet mounted on top of an LCD which allowed the user to interact with the program by writing on the tablet with a stylus. The experiments found that participants were faster with the gestural interface than with the keyboard or mouse/keyboard interface. In addition, subjects tended to prefer the gestural interface over the keyboard interface. Inexperienced mouse users also tended to prefer the gestural interface over the mouse/keyboard interface, although experienced mouse users preferred the mouse. The main difficulties with the gestural interface had to do with poor display legibility and problems with the stylus. The benefits of the gestural interface are explained in terms of the fewer number of steps required to carry out an operation, the greater ease of remembering gestural commands, and the ability to focus on a single surface for input and output.</abstract> <publication type="book section"> <author>yee, Ka-Ping</author> <year>2003</year> <title>peephole Displays: Pen Interaction on Spatially Aware</title> <book>proceedings of ACM CHI 2003 Conference on Human Factors in Computing Systems</book> <pages>161-168</pages> <publication type="book"> <author>zuboff, Shoshana</author> <year>1988</year> <title>in the Age of the Smart Machine. The Future of Work and Power</title> <publisher>basic Books</publisher> </publications> Dokumentet är ett resultat av en exportering från referensverktyget EndNote via ett litet program som jag skrivit för att konvertera datan till XML. Upgift 1 sätt det skriver ut den första publikationens titel.
Upgift 2 sätt det skriver ut en lista med alla publikationers titel. Upgift 3 sätt det skriver ut en lista med alla publikationers titel under förutsättning att publikationen är en journal article.
Upgift 4 sätt det skriver ut en lista med alla publikationers titel under förutsättning att publikationen är en journal article. Listan ska vara sorterad med avseende på titel. Upgift 5 Gör en XSLT-mall som skriver ut alla böcker (type= book ) så att utseendet är enligt nedanstående bild.
Upgift 6 Gör en XSLT-mall enligt föregående uppgift men som dessutom inkluderar samtliga författare. Upgift 7 Gör en XSLT-mall enligt föregående uppgift med den skillnaden att samtliga publikationstyper listas grupperande under en rubrik med ett lämpligt beskrivande innehåll.
(I denna bild har jag dessutom förändrat presentation för tidskriftsartiklar så att det är mer i enlighet med konventionen för denna typ av publikation) Upgift 8 Gör en XSLT mall baserat på ovanstående omvandling som inleder HTMLdokumentet med information om antal böcker per publikationstyp samt totalt antal böcker.