<?xml version="1.0" encoding="windows-1251"?>
<!DOCTYPE xsl:stylesheet>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output xmlns="http://www.w3.org/TR/xhtml1/strict" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
encoding="Windows-1251" indent="yes" method="html" omit-xml-declaration="no" version="1.0" media-type="text/xml" />

<xsl:template match="/">
	<xsl:apply-templates select="orders"/>
</xsl:template>

<!-- Шаблон для списка заказов -->
<xsl:template match="/orders">
	<h1>Список заказов</h1>
	<xsl:apply-templates select="order_list"/>
</xsl:template>

<!-- Шаблон для заказа -->
<xsl:template match="order_list">
	<div style="border:1px solid #CCCCCC; padding: 5px; width: 60%;">
	Заказ&#xA0;<b>№<xsl:value-of select="@id"/></b> на сумму <b>
	<xsl:value-of select="sum"/></b>
	<!-- Показывать ли валюту -->
	<xsl:if test="currency/currency_name != ''">&#xA0;<xsl:value-of select="currency/currency_name"/> 
	</xsl:if>
	от&#xA0;<b><xsl:value-of select="date_time"/></b>
	<div style="padding-left: 13px;">
		<p />
		<b>Статус оплаты: </b>
		<xsl:choose>
			<xsl:when test="status_of_pay != '0'">
				оплачен, дата оплаты&#xA0;<xsl:value-of select="date_of_pay"/>
			</xsl:when>
			<xsl:otherwise>
				<font color="Red">не оплачен</font>
			</xsl:otherwise>
		</xsl:choose>	
		<p />
		<xsl:if test="order_status/order_status_name/node()">
		<b>Статус заказа:</b>&#xA0;<xsl:value-of select="order_status/order_status_name"/>		
		<p />
		</xsl:if>
		<b>Адрес:</b>&#xA0;<xsl:value-of select="index"/>, <xsl:value-of select="country_name"/>, 
		<xsl:value-of select="location_name"/>, г.<xsl:value-of select="city_name"/>, 
		<xsl:if test="city_area_name != ''">
			<xsl:value-of select="city_area_name"/>, 
		</xsl:if>
		<xsl:value-of select="address"/>
		<p />
		<b>Телефон:</b>&#xA0;<xsl:value-of select="phone"/>
		<p />
		<b>Платежная система:</b>&#xA0;<xsl:value-of select="system_of_pay_name"/><br />
		<p />
		<b>Тип доставки:</b>&#xA0;<xsl:value-of select="delivery_type/type_of_delivery_name"/><br />	
		<p />
		<b>Стоимость доставки:</b>&#xA0;<xsl:value-of select="order_delivery_price"/>
		<!-- Показывать ли валюту -->
		<xsl:if test="currency/currency_name != ''">&#xA0;<xsl:value-of select="currency/currency_name"/>
		</xsl:if>
		<p />
	</div>
	<table width="100%" style="padding-left: 10px;">
	<tr>
		<td colspan="5"><b>Заказанные товары</b></td>
	</tr>
	<xsl:apply-templates select="order_items/items_order"/>
	</table>
	</div><br />
</xsl:template>

<!-- Шаблон для элементов заказа -->
<xsl:template match="order_items/items_order">
	<tr>
		<td>
			<xsl:choose>
				<xsl:when test="item/node()">
					<a href="{../../shop/shop_path}{item/fullpath}{item/path}/">
					<xsl:value-of select="order_items_name"/></a>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="order_items_name"/>
				</xsl:otherwise>
			</xsl:choose>
		</td>
		<td align="right" width="90px">
			<xsl:value-of select="order_items_price"/>
			<!-- Показывать ли валюту -->
			<xsl:if test="../../currency/currency_name != ''">&#xA0;<xsl:value-of select="../../currency/currency_name"/>
			</xsl:if>
		</td>
		<td width="60px"><b>x&#xA0;</b><xsl:value-of select="order_items_quantity"/> шт.</td>
		<td width="15px" align="center">=</td>
		<td width="90px" align="right">
			<xsl:value-of select="order_items_price * order_items_quantity"/>
			<!-- Показывать ли валюту -->
			<xsl:if test="../../currency/currency_name != ''">&#xA0;<xsl:value-of select="../../currency/currency_name"/>
			</xsl:if>
		</td>
	</tr>
</xsl:template>

</xsl:stylesheet>