﻿<?xml version="1.0" encoding="utf-8"?>

<!--Notice the namespaces: There is a namespace for xsl, and a 
namespace for the underlying DVD xml document, xhtml
is made the default namespace, the only one without a prefix -->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:dvd="http://seattlecentral.org/faculty/sconge/DVD"
xmlns="http://www.w3.org/1999/xhtml">

<!--Below is the root template that sets up the basic html document-->
<xsl:template match="/">
<html>
<head>
<link rel="stylesheet" type="text/css" href="DVD.css"/>
</head>
<body>
<h1><xsl:value-of select="//dvd:title" /></h1>
<hr/>
<!-- notice the first element is reading the attribute-->
<p>
<strong>ISBN:            </strong><xsl:value-of select="/dvd:DVD/@ISBN" /><br/>
<strong>Studio:         </strong> <xsl:value-of select="//dvd:studio" /><br/>
<strong>Rating:         </strong><xsl:value-of select="//dvd:rating" /> <br/>
<strong>Genre:          </strong><xsl:value-of select="//dvd:genre" /> <br/>
<strong>Format:         </strong><xsl:value-of select="//dvd:format" /> <br/>
<strong>Purchase Date:  </strong><xsl:value-of select="//dvd:purchaseDate" /> <br/>
<strong>Purchase Price: </strong><xsl:value-of select="//dvd:format" /> <br/>
</p>
<!--Notice that you don't need to do things in the same order they are
in the document-->
<p><xsl:value-of select="//dvd:description"/></p>
<h2>Actors</h2>
<!--here we are calling additional templates defined below-->
<xsl:apply-templates select="//dvd:actors" />
<h2>Exras</h2>
<xsl:apply-templates select="//dvd:extras" />
</body>
</html>

</xsl:template>
<!--this template makes a unordered list of actors -->

<xsl:template match="//dvd:actors">
<ul>
<xsl:for-each select="dvd:actor">
<li><xsl:value-of select="." />
</li>
</xsl:for-each>
</ul>

</xsl:template>

<!--this template makes an unordered list of extras-->

<xsl:template match="//dvd:extras">
<ul>
<xsl:for-each select="//dvd:extra">
<li><xsl:value-of select="." />
</li>
</xsl:for-each>
</ul>

</xsl:template>

</xsl:stylesheet>