<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:variable name="Space"><xsl:text>&amp;nbsp;</xsl:text></xsl:variable>
<xsl:output method="html"/>

<xsl:template match="/">
	<html>
		<head>
			<link rel="STYLESHEET" href="css/main.css" type="text/css"/>
			<script type="text/javascript">

			</script>
		</head>
		<body>
			<xsl:apply-templates select="main_page"/>
		</body>
	</html>
        
        
</xsl:template>


<!-- ======================================================================= -->
	<xsl:template match="main_page">
		<xsl:value-of select="@query_result"/>
		<table class="data_table">
			<tr>
				<td class="home_client">
					<xsl:apply-templates select="_list_hc"/>	
				</td>
				<td class="room_location">
					<xsl:apply-templates select="_list_rl"/>
				</td>
				<td class="item">
					<xsl:apply-templates select="_list_items"/>
				</td>
			</tr>
		</table>
		<p/>
	</xsl:template>

	<xsl:template match="_list_hc">
		<div class="header_title">Homes / Clients </div>
		<a class="new_url" href="{@new_hc_url}"><xsl:value-of select="@new_hc_text"/></a><p/>
		<table class="hc_list">
			<xsl:apply-templates select="hc_page"/>
		</table>
	</xsl:template>

	<xsl:template match="hc_page">
		<tr>
			<td class="{@hc_class}">
				<a href="{@hc_url}"><xsl:value-of select="@hc_name"/> - <xsl:value-of select="@hc_type"/></a>
				 <xsl:value-of select="$Space" disable-output-escaping="yes"/>
				 <xsl:value-of select="$Space" disable-output-escaping="yes"/>
				 <a href="{@hc_edit_url}"><img class="edit_icon" src="images/edit-119-16.png" title="Edit"/></a>
			</td>
		</tr>
<xsl:if test="@hc_report">
		<tr>
			<td class="report">
			 <a href="{@hc_report_url}" target="_blank"><xsl:value-of select="@hc_report"/></a>
			</td>
		</tr>
</xsl:if>		
	</xsl:template>

	<xsl:template match="_list_rl">
			<div class="header_title">Rooms / Locations </div>
			<a class="new_url" href="{@new_rl_url}"><xsl:value-of select="@new_rl_text"/></a><p/>
			<table class="rl_list">
				<xsl:apply-templates select="rl_page"/>
			</table>
	</xsl:template>

	<xsl:template match="rl_page">
		<tr>
			<td class="{@rl_class}">
				<a href="{@rl_url}"><xsl:value-of select="@rl_name"/></a>
				<xsl:value-of select="$Space" disable-output-escaping="yes"/>
				<xsl:value-of select="$Space" disable-output-escaping="yes"/>
				<a href="{@rl_edit_url}"><img class="edit_icon" src="images/edit-119-16.png" title="Edit"/></a>
			</td>
		</tr>
	</xsl:template>

	<xsl:template match="_list_items">
			<div class="header_title">Items</div>
			<a class="new_url" href="{@new_item_url}"><xsl:value-of select="@new_item_text"/></a><p/>
			<table class="item_list">
				<tr class="list_heading_row">
					<td class="list_heading">Name</td>			
					<td class="list_heading">Description</td>			
					<td class="list_heading">Cost ea</td>			
					<td class="list_heading">Qty</td>			
					<td class="list_heading">Movable</td>			
					<td class="list_heading"></td>			
				</tr>

				<xsl:apply-templates select="items_page"/>

				<tr class="list_heading_row">
					<td class="list_heading"></td>			
					<td class="list_heading">TOTAL</td>			
					<td class="list_heading_right_align"><xsl:value-of select="@home_currency"/><xsl:value-of select="$Space" disable-output-escaping="yes"/><xsl:value-of select="@room_total_cost"/></td>			
					<td class="list_heading"></td>			
					<td class="list_heading"></td>			
					<td class="list_heading"></td>			
				</tr>
			
			
			
			
			</table>
	</xsl:template>

	<xsl:template match="items_page">
		<tr class="list_row">
			<td class="list"><a href="{@item_edit_url}"><xsl:value-of select="@item_name"/></a></td>
			<td class="list"><xsl:value-of select="@item_description"/></td>
			<td class="list_right_align"><xsl:value-of select="@home_currency"/><xsl:value-of select="$Space" disable-output-escaping="yes"/><xsl:value-of select="@item_cost"/></td>
			<td class="list"><xsl:value-of select="@item_qty"/></td>
			<td class="list"><xsl:value-of select="@item_movable"/></td>
			<td class="list"><a href="{@item_edit_url}"><img class="edit_icon" src="images/more-line-1-16.png" title="More"/></a></td>
		
		</tr>
	</xsl:template>

</xsl:stylesheet>