Beginning XHTML | 18

Beginning XHTML

Try It Out - Using XSL Transformations

In this exercise, you are going to get a taste of things to come. Specifically, you are going to use the World Wide Web's new XSL Transformation technology to convert an XML document into two different presentations.

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="movie1.xsl"?>
<filmlibrary>
<name>Classic Films</name>
<movie>
<title>Beauty and the Beast</title>
<genre>Fantasy</genre>
<country>France</country>
<language>French</language>
<year>1946</year>
<length>90 Min.</length>
<filmtype>BW</filmtype>
<credits>
<director>Jean Cocteau</director>
<producer>Andre Paulve</producer>
<writer>Jean Cocteau</writer>
<story>Mme Leprince de Beaumont</story>
<cinematography>Henri Alekan</cinematography>
</credits>
<plot>Beauty lives in a cottage with her father and
her two wicked sisters. Once day her father comes
upon a strange mansion with an ugly sorcerer named
Beast.
</plot>
</movie>
<movie>
<title>The Bicycle Thief</title>
<genre>Social Drama</genre>
<country>Italy</country>
<language>Italian</language>
<year>1948</year>
<length>90 Min.</length>
<filmtype>BW</filmtype>
<credits>
<director>Vittorio de Sica</director>
<producer>Vittorio de Sica</producer>
<writer>Vittorio de Sica</writer>
<story>Gennarino Bartolini</story>
<cinematography>Carlo Montuori</cinematography>
</credits>
<plot>Told through the eyes of a young boy
named Bruno, <title>The Bicycle Thief</title> is the
story of his father"s struggle to provide for his family
in Rome following World War II.
</plot>
</movie>
</filmlibrary>

Save the file as movie1.xml. Run the file in Microsoft Internet Explorer. You should see something like this: