<?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="no" indent="yes" encoding="ISO-8859-1" doctype-public="-//WAPFORUM//DTD WML 1.1//EN" doctype-system="http://www.wapforum.org/DTD/wml_1.1.xml"/>
<xsl:decimal-format decimal-separator="," grouping-separator="."/>

<xsl:template match="gruppi">
	<wml xml:lang="it">

	<card id="titolo">
		<xsl:attribute name="title"><xsl:value-of select="@h1"/></xsl:attribute>
		<p align="center">
			<img src="img/logo.wbmp" alt="Logo"/>
			<em><xsl:value-of select="@h1"/> <xsl:value-of select="@tipo"/></em>
		</p>
		

		<p mode="nowrap" align="left">
			<xsl:for-each select="gruppo">
				<anchor>
	            	<xsl:attribute name="title"><xsl:value-of select="@h2"/></xsl:attribute>
					<xsl:value-of select="@h2"/>&#xa0;<xsl:value-of select="@tipo"/>
					<go>
						<xsl:attribute name="href">#<xsl:number value="position()" format="A"/></xsl:attribute>
					</go>
	        	</anchor>
				<br/>
			</xsl:for-each>
		</p>
	</card>

	<xsl:apply-templates select="gruppo"/>

	</wml>
</xsl:template>

<xsl:template match="gruppo">
	<card>
		<xsl:attribute name="id"><xsl:number value="position()" format="A"/></xsl:attribute>
		<xsl:attribute name="title"><xsl:value-of select="@h2"/>&#xa0;<xsl:value-of select="@tipo"/></xsl:attribute>
		<xsl:apply-templates select="p"/>
		<xsl:apply-templates select="cliente"/>
		<xsl:apply-templates select="email"/>
		<do type="prev"><prev/></do>
	</card>
</xsl:template>

<xsl:template match="p">
	<p><xsl:apply-templates/></p>
</xsl:template>

<xsl:template match="cliente">
	<p><img src="img/quadrato.wbmp" alt="*"/>&#xa0;<xsl:apply-templates/></p>
</xsl:template>

<xsl:template match="br">
	<br/>
</xsl:template>

<xsl:template match="email">
	<p>
		<img src="img/email.wbmp" alt="EMail"/>
		<a><xsl:attribute name="href">mailto:<xsl:value-of select="@href"/></xsl:attribute><xsl:value-of select="@href"/></a>
	</p>
</xsl:template>

<xsl:template match="link">
	<br/>
	<img src="img/link.wbmp" alt="Link"/>
	<a><xsl:attribute name="href"><xsl:value-of select="@href"/></xsl:attribute>
		<xsl:if test=".=''"><xsl:value-of select="@href"/></xsl:if>
		<xsl:if test="not(.='')"><xsl:apply-templates/></xsl:if>
	</a>
</xsl:template>

</xsl:stylesheet>