Yliopiston etusivulle In English
Helsingin yliopisto
clt236: XML - lukuvuosi 2009-2010


Yleisen kielitieteen laitos

PL 24 (Unioninkatu 40)

Puhelin +358 (09) 1911 (vaihde)
Faksi +358 (09) 191 28313

8. XPath and XSLT.

  • Lecture notes
  • Further reading
  • Practical work: XPath Tool
    • The jEdit XSLT plugin includes XPath Tool. Use jEdit's menus to open XPath Tool and use the docking options to dock it on the right.
    • We can use XPath Tool to check which parts of an XML document are selected by different XPath expressions, without actually doing any transformations.
    • Copy the XPath examples 9-1.xml, 9-2.xsl, 9-3.xsl, 9-4.xsl to your Windows folder. In jEdit, use the XPath plugin to check which parts of 9-1.xml are selected by the various XPath expressions included in the stylesheets.
    • Then use the XSLT plugin to do the transformations, and check the results.
  • Practical work: Transforming Sonnet 130 to HTML
    • Read Transforming XML into HTML by Doug Tidwell (IBM).
      Focus on the sonnet example (Transformation #1).
    • Copy sonnet130.xml, sonnet.dtd, and sonnet-html.xsl either to your Windows folder or to your Linux directory (or both).
    • On Windows, use jEdit to validate the sonnet with the DTD (see Week 3)
      and to transform the sonnet from XML to HTML with XSLT (see Week 7).
    • On Linux, validate the sonnet with the DTD by
      ./clt236-xerces -v sonnet130.xml
      and transform the sonnet from XML to HTML with XSLT by
      ./clt236-xalan -in sonnet130.xml -xsl sonnet-html.xsl -out sonnet130.html
  • Practical work: XSLT Quickly tutorial
    • What does the XSLT Quickly tutorial say about empty stylesheets?
      Copy hello.xml and empty.xsl to your Windows folder or Linux directory.
      Transform the XML file to HTML with the empty stylesheet using jEdit or by
      ./clt236-xalan -in hello.xml -xsl empty.xsl -out empty.html
    • Revise the XSLT Quickly tutorial. Do you know how to
      • delete elements?
      • rename elements?
      • reorder elements?
      • delete or rename attributes?
      • convert elements to attributes?
      • convert attributes to elements?

Assignment 4.

© 2001-2009 Graham Wilcock