<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html"/>

<xsl:template match="/">

<html>
<head>
	<title>Address book</title>
</head>

<body style="background:silver;">

<p/><table width="70%" align="center" style="background:silver;color:menutext;font:message-box;">
<tr>
	<th align="center" style="color:activecaptiontext;font:caption;">Name</th>
	<th align="center" style="color:activecaptiontext;font:caption;">Surname</th>
	<th align="center" style="color:activecaptiontext;font:caption;">Balance</th>
	<th align="center" style="color:activecaptiontext;font:caption;">Sex</th>
</tr>

<form action="3.xml" method="post" name="form">
<xsl:for-each select="//root/person">

<tr>
	<td>
		<xsl:attribute name="align">center</xsl:attribute>
		<xsl:if test="balance &lt; 0">
			<xsl:attribute name="bgcolor">red</xsl:attribute>
		</xsl:if>
		<xsl:value-of select="name"/>
	</td>
	<td align="center"><xsl:value-of select="surname"/></td>
	<td align="center"><xsl:value-of select="balance"/></td>
	<td align="center">
		<select>
			<xsl:attribute name="name">sex</xsl:attribute>

			<xsl:for-each select="sex">
			<option>
				<xsl:if test="@selected=1">
					<xsl:attribute name="selected">selected</xsl:attribute>
				</xsl:if>
				
				<xsl:attribute name="value"><xsl:value-of select="." />
				</xsl:attribute>
				
				<xsl:value-of select="@query_name"/>	
			</option>
			</xsl:for-each>
		</select>
	</td>
</tr>

</xsl:for-each>
</form>

</table>

</body>
</html>
</xsl:template>
</xsl:stylesheet>
