<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" omit-xml-declaration="yes" indent="yes" encoding="ISO-8859-15" doctype-public="-//W3C//DTD XHTML 1.1//EN" doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"/>

<xsl:template match="gruppi">
	<html><xsl:attribute name="xml:lang"><xsl:value-of select="@lang"/></xsl:attribute>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-15"/>
		<meta http-equiv="Content-Style-Type" content="text/css"/>
		<meta name="author" content="Luca Bezzan"/>
		<link rev="help" href="mailto:lucabezzan@fabsoft.it"/>
	
		<meta name="description"><xsl:attribute name="content"><xsl:value-of select="@description"/></xsl:attribute></meta>
		<meta name="keywords"><xsl:attribute name="content"><xsl:value-of select="@keywords"/></xsl:attribute></meta>
		<link rel="stylesheet" type="text/css" href="default.css"/>
		<script src="default.js" type="text/javascript"></script>
		
		<title><xsl:value-of select="@h1"/><xsl:value-of select="@tipo"/></title>
	</head>
	<body>
	<div class="contenitore">
		<h1><img src="img/logo.png" width="19" height="19" alt="Logo" class="logo"/><xsl:value-of select="@h1"/>&#xA0;<span><xsl:value-of select="@tipo"/></span></h1>
		<xsl:apply-templates select="gruppo"/>
		<img src="img/linea.png" width="600" height="4" alt="" class="lineaFine"/>
	</div>
	</body>
	</html>
</xsl:template>

<xsl:template match="gruppo">
	<img src="img/linea.png" width="600" height="4" alt="" class="linea"/>
    <h2><xsl:value-of select="@h2"/>&#xA0;<span><xsl:value-of select="@tipo"/></span></h2>
	<xsl:apply-templates select="p"/>
	<xsl:if test="cliente">
		<ul><xsl:apply-templates select="cliente"/></ul>
	</xsl:if>
	<xsl:apply-templates select="email"/>
</xsl:template>

<xsl:template match="cliente">
	<li><xsl:apply-templates/></li>
</xsl:template>

<xsl:template match="descrizione">
	<span><xsl:apply-templates/></span>
</xsl:template>

<xsl:template match="p">
	<p><xsl:apply-templates/></p>
</xsl:template>

<xsl:template match="b">
	<strong><xsl:apply-templates/></strong>
</xsl:template>

<xsl:template match="br">
	<br/>
</xsl:template>

<xsl:template match="email">
	<div class="link">
		<img src="img/email.png" width="13" height="11" alt="EMail"/><a><xsl:attribute name="href">mailto:<xsl:value-of select="@href"/></xsl:attribute><xsl:value-of select="@href"/></a>
	</div>
</xsl:template>

<xsl:template match="link">
	<div class="link"><img src="img/link.png" width="9" height="7"
		 alt="Link"/><a><xsl:attribute name="href">
				<xsl:choose>
				<xsl:when test="@tipo=2">javascript:apriFinestra2('<xsl:value-of select="@href"/>')</xsl:when>
				<xsl:otherwise>javascript:apriFinestra('<xsl:value-of select="@href"/>')</xsl:otherwise>
				</xsl:choose>
			</xsl:attribute>
			<xsl:if test=".=''"><xsl:value-of select="@href"/></xsl:if>
			<xsl:if test="not(.='')"><xsl:apply-templates/></xsl:if>
		</a>
	</div>
</xsl:template>

</xsl:stylesheet>