<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:output method='html' version='1.0' encoding='utf-8' indent='yes'/>
	<xsl:template match="/">
		<html>
			<head><meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"/></head>
			<body>
				<table style="width: 70%; text-align: left; margin-left: auto; margin-right: auto;" border="1" cellpadding="0" cellspacing="0" align="center">
					<tr>
						<td>
							<table style="width: 100%; text-align: left; margin-left: auto; margin-right: auto;" border="0" cellpadding="1" cellspacing="1">
								<tbody>
									<tr style="font-weight: bold; font-family: Arial;" align="center">
										<td colspan="6" rowspan="1" style="vertical-align: middle;"><span><h2>PRICE CALCULATION</h2></span></td>
									</tr>
									<xsl:call-template name="GetCarrierAndProduct"/>
									<xsl:call-template name="GetHeaderItems"/>
									<xsl:call-template name="GetBodyHeader"/>
									<xsl:call-template name="GetBodyItems"/>
									<xsl:call-template name="GetBodyFooter"/>
								</tbody>
							</table>
						</td>
					</tr>
					<xsl:call-template name="GetReportFooterItems"/>
					<xsl:call-template name="GetReportFooterMessage"/>
				</table>
			</body>
		</html>
	</xsl:template>
	<xsl:template name="GetCarrierAndProduct" match="/FreightReport/Carrier">
		<tr style="font-family: Arial;" align="left">
			<td colspan="1" rowspan="1"><span style="font-weight: bold;">Carrier: </span><xsl:value-of select="/FreightReport/Carrier"/></td>
			<td colspan="5" rowspan="1"><span style="font-weight: bold;">Product: </span><xsl:call-template name="GetProduct"/></td>
		</tr>
	</xsl:template>
	<xsl:template name="GetProduct" match="/FreightReport/Product">
		<xsl:value-of select="/FreightReport/Product"/>
	</xsl:template>
	<xsl:template name="GetHeaderItems" match="/FreightReport/Header">
		<xsl:for-each select="/FreightReport/Header/Item">
			<tr style="font-weight: normal; font-family: Arial;" align="left">
				<td><xsl:value-of select="@Name"/></td>
				<td><xsl:value-of select="@Value"/></td>
				<td colspan="4" rowspan="1"/>
			</tr>
		</xsl:for-each>
	</xsl:template>
	<xsl:template name="GetBodyHeader" match="/FreightReport/Body/Header">
		<tr style="background-color: rgb(238, 238, 238);font-weight: bold; font-family: Arial;" align="left">
			<td><xsl:value-of select="/FreightReport/Body/Header/@Name"/></td>
			<td><xsl:value-of select="/FreightReport/Body/Header/@Value"/></td>
			<td><xsl:value-of select="/FreightReport/Body/Header/@Index1"/></td>
			<td><xsl:value-of select="/FreightReport/Body/Header/@Price1"/></td>
			<td><xsl:value-of select="/FreightReport/Body/Header/@Index2"/></td>
			<td><xsl:value-of select="/FreightReport/Body/Header/@Price2"/></td>
		</tr>
	</xsl:template>
	<xsl:template name="GetBodyItems" match="/FreightReport/Body/BodyItems/BodyItem">
		<xsl:for-each select="/FreightReport/Body/BodyItems/BodyItem">
			<tr style="font-weight: normal; font-family: Arial;" align="right">
				<td style="text-align: left;"><xsl:value-of select="Header/@Name"/></td>
				<td><xsl:value-of select="Header/@Value"/></td>
				<td><xsl:value-of select="Header/@Index1"/></td>
				<td><xsl:value-of select="Header/@Price1"/></td>
				<td><xsl:value-of select="Header/@Index2"/></td>
				<td><xsl:value-of select="Header/@Price2"/></td>
				<xsl:for-each select="Items">
					<xsl:for-each select="Item">
						<tr style="font-weight: normal; font-family: Arial;" align="right">
							<td style="text-align: left;"><xsl:value-of select="@Name"/></td>
							<td><xsl:value-of select="@Value"/></td>
							<td><xsl:value-of select="@Index1"/></td>
							<td><xsl:value-of select="@Price1"/></td>
							<td><xsl:value-of select="@Index2"/></td>
							<td><xsl:value-of select="@Price2"/></td>
						</tr>
					</xsl:for-each>
				</xsl:for-each>
				<tr style="background-color: rgb(224, 235, 255);font-weight: bold; font-family: Arial;" align="right">
					<td style="text-align: left;"><xsl:value-of select="Footer/@Name"/></td>
					<td><xsl:value-of select="Footer/@Value"/></td>
					<td><xsl:value-of select="Footer/@Index1"/></td>
					<td><xsl:value-of select="Footer/@Price1"/></td>
					<td><xsl:value-of select="Footer/@Index2"/></td>
					<td><xsl:value-of select="Footer/@Price2"/></td>
				</tr>
			</tr>
		</xsl:for-each>
	</xsl:template>
	<xsl:template name="GetBodyFooter" match="/FreightReport/Body/Footer">
		<xsl:for-each select="/FreightReport/Body/Footer/DetailItem">
			<tr style="background-color: rgb(204, 204, 255);font-weight: bold; font-family: Arial;" align="right">
				<td style="text-align: left;"><xsl:value-of select="@Name"/></td>
				<td><xsl:value-of select="@Value"/></td>
				<td><xsl:value-of select="@Index1"/></td>
				<td><xsl:value-of select="@Price1"/></td>
				<td><xsl:value-of select="@Index2"/></td>
				<td><xsl:value-of select="@Price2"/></td>
			</tr>
		</xsl:for-each>
	</xsl:template>
	<xsl:template name="GetReportFooterItems">
		<xsl:for-each select="/FreightReport/Footer/Item">
			<tr style="font-weight: normal; font-family: Arial;" align="right">
				<td style="text-align: left;">
						<xsl:element name="a">
						<xsl:attribute name="href">
							<xsl:value-of select="@Value" />
						</xsl:attribute> 
						<xsl:value-of select="@Name"/>
						</xsl:element> 
				</td>
			</tr>
		</xsl:for-each>
	</xsl:template>
	<xsl:template name="GetReportFooterMessage">
		<tr style="font-weight: normal; font-family: Arial;" align="left">
			<td colspan="6" rowspan="1"><span style=""><xsl:value-of select="/FreightReport/FooterMessage"/></span></td>
		</tr>
	</xsl:template>
</xsl:stylesheet>