<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
	xmlns:xinclude="http://www.w3.org/1999/XML/xinclude"
	xmlns:xlink="http://ww.w3.org/TR/xlink"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	exclude-result-prefixes="xinclude xlink"
	version="1.0">

<xsl:output method="xml" 
	    encoding="utf-8"
	    doctype-public="-//WAPFORUM//DTD WML 1.1//EN"
	    doctype-system="http://www.wapforum.org/DTD/wml_1.1.xml"/>

	
<xsl:template match="/">
	<wml>
	   <xsl:apply-templates />
	</wml>
</xsl:template>


<!-- Netfolder processing section -->
<xsl:template match="netfolder">
	<card>
		<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
		<p>
		<img alt="Talva Corp." src="logo.bmp" align="middle"/>
		<select name="type" title="Mobile Portal">
			<xsl:for-each select="./resource">
				<option>
				<xsl:attribute name="onpick"><xsl:value-of select="./@xlink:href"/></xsl:attribute>
				<xsl:value-of select="./@xlink:title"/></option>
			</xsl:for-each>
		</select>
		</p>
	</card>
</xsl:template>

<xsl:template match="*[@xlink:type='extended']">
<card>
	<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
	<p>
	<img alt="Talva Corp." src="logo.bmp" align="middle"/>
	<select name="type" title="Mobile Portal">
		<xsl:for-each select="./resource">
			<option>
				<xsl:attribute name="onpick"><xsl:value-of select="./@xlink:href"/></xsl:attribute>
				<xsl:value-of select="./@xlink:title"/>
			</option>
		</xsl:for-each>
	</select>
	</p>
</card>
</xsl:template>

<!-- xform processing section -->
<xsl:template match="xform">
<card>
   <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>

	<do type="ACCEPT">
		<go method="post">
		   <xsl:attribute name="href"><xsl:value-of select="./@action"/></xsl:attribute>
		   <xsl:for-each select="./model/group//*">
			 <postfield>
				<xsl:attribute name="name"><xsl:value-of select="./@name"/></xsl:attribute>
				<xsl:attribute name="value">$<xsl:value-of select="./@name"/></xsl:attribute>
			  </postfield>
		   </xsl:for-each>
		</go>
	</do>
	<p>	
	   <xsl:for-each select="./model/group//*">
			<xsl:text>Enter </xsl:text><xsl:value-of select="./@display-name"/><xsl:text>:</xsl:text>
			<input>
				<xsl:attribute name="name"><xsl:value-of select="./@name"/></xsl:attribute>
				<xsl:attribute name="title"><xsl:value-of select="./@display-name"/></xsl:attribute>
				<xsl:attribute name="type">text</xsl:attribute>
			</input>
	   </xsl:for-each>
	</p>
</card>
</xsl:template>

</xsl:stylesheet>
