<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:common="http://exslt.org/common"
      extension-element-prefixes="common">

<!--
  == weboutput.xsl
  == copyright 2006-2007 Brian Enigma <brian@netninja.com>
  == 
  == This program is free software; you can redistribute it and/or
  == modify it under the terms of the GNU General Public License
  == as published by the Free Software Foundation; either version 2
  == of the License, or (at your option) any later version.
  == 
  == This program is distributed in the hope that it will be useful,
  == but WITHOUT ANY WARRANTY; without even the implied warranty of
  == MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  == GNU General Public License for more details.
  == 
  == You should have received a copy of the GNU General Public License
  == along with this program; if not, write to the Free Software
  == Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  -->

<xsl:output method="html"/>

<xsl:template match="/">
	<html><head><title>My Media Library</title></head><body>
	<h1>Movies</h1>
	<ul>
	<xsl:for-each select="library/items/movie">
		<xsl:sort select="@title"/>
		<li><a href="{concat('details/mov-', @uuid, '.html')}"><xsl:value-of select="@title"/></a></li>
		<xsl:apply-templates select="." mode="details"/>
	</xsl:for-each>
	</ul>
	<h1>Books</h1>
	<ul>
	<xsl:for-each select="library/items/book">
		<xsl:sort select="@author"/>
		<li><a href="{concat('details/bok-', @uuid, '.html')}"><xsl:value-of select="@author"/> - <xsl:value-of select="@title"/></a></li>
		<xsl:apply-templates select="." mode="details"/>
	</xsl:for-each>
	</ul>
	<small>Created using <a href="weboutput.xsl">weboutput.xsl</a></small>
	</body></html>
</xsl:template>

<xsl:template match="movie" mode="details">
	<common:document method="html" href="{concat('./details/mov-', @uuid, '.html')}">
		<html><head><title><xsl:value-of select="@title"/></title></head><body>
		<h1><xsl:value-of select="@title"/></h1>

		</body></html>
	</common:document>
</xsl:template>

<xsl:template match="book" mode="details">
	<common:document method="html" href="{concat('./details/bok-', @uuid, '.html')}">
		<html><head><title><xsl:value-of select="@author"/> - <xsl:value-of select="@title"/></title></head><body>
		<h1><xsl:value-of select="@author"/> - <xsl:value-of select="@title"/></h1>

		</body></html>
	</common:document>
</xsl:template>

</xsl:stylesheet>
