<!--
File: temp.xsl
Author: Elise Dupont 07/02/2002
Desc: Transform xml into quote where catagorisation is choosable
-->
<xsl:stylesheet version="1.0"
xmlns:xsl="[URL unfurl="true"]http://www.w3.org/1999/XSL/Transform"[/URL]
xmlns="urn:schemas-microsoft-com:xml-data">
<xsl:output method="html" indent="yes"/>
<xsl:key name="item-by-id" match="BudgetItemXML" use="BIT_ItemID" />
<xsl:key name="item-by-cat" match="BudgetItemXML" use="CAT_CategoryName" />
<xsl:key name="item-by-service" match="BudgetItemXML" use="SERV_ServiceName" />
<xsl:key name="item-by-service-id" match="BudgetItemXML" use="concat(SERV_ServiceName, ' ',BIT_ItemID)" />
<xsl:key name="item-by-id-service" match="BudgetItemXML" use="concat(BIT_ItemID, ' ',SERV_ServiceName)" />
<xsl:key name="item-by-service-cat" match="BudgetItemXML" use="concat(SERV_ServiceName, ' ', CAT_CategoryName)" />
<xsl:key name="item-by-id-service-cat" match="BudgetItemXML" use="concat(BIT_ItemID, ' ', SERV_ServiceName,' ',CAT_CategoryName)" />
<xsl:key name="item-by-service-id-cat" match="BudgetItemXML" use="concat(SERV_ServiceName,' ',BIT_ItemID, ' ', CAT_CategoryName)" />
<xsl:key name="item-by-service-cat-id" match="BudgetItemXML" use="concat(SERV_ServiceName, ' ', CAT_CategoryName,' ',BIT_ItemID)" />
<xsl:template match="dsBudget">
<html>
<head>
<title>Untitled</title>
</head>
<body>
<table cellspacing="0">
<tr>
<td>
<IMG height="45" src="D:\backup\My Documents Boulot\devp\Quotation\XML transformation\logo.jpg" width="150" border="0"/>
</td>
<td>
<table cellspacing="0">
<TR>
<td bgcolor="#000080" height="45">
<table style="color: White;" cellspacing="0">
<tr>
<td width="100" >Client: </td>
<td width="100" style="FONT-WEIGHT: bold"><xsl:value-of select="/*/*[1]/*[6]" /></td>
<td width="100" >Quotation #: </td>
<td width="100" style="FONT-WEIGHT: bold"><xsl:value-of select="/*/*[1]/*[1]" /></td>
<td width="100">Date: </td>
<td width="100" style="FONT-WEIGHT: bold"><xsl:value-of select="/*/*[1]/*[5]" /></td>
</tr>
<tr>
<td>Project: </td>
<td style="FONT-WEIGHT: bold"></td>
<td>Project Code: </td>
<td style="FONT-WEIGHT: bold"><xsl:value-of select="/*/*[1]/*[7]" /></td>
<td>Author: </td>
<td style="FONT-WEIGHT: bold"><xsl:value-of select="/*/*[1]/*[4]" /></td>
</tr>
</table>
</td>
</TR>
</table>
</td>
</tr>
</table>
Quote Done in <xsl:value-of select="/*/*[1]/*[3]" />
<TABLE border="0" cellspacing="0">
<TR bgcolor="#000080" style="color: White;" border="1">
<TD width="100" border="1">Task</TD>
<TD width="100" border="1">Activity</TD>
<TD width="100" border="1">Quote Item</TD>
<TD width="100" border="1">PriceCode</TD>
<TD width="50" border="1">Unit</TD>
<xsl:for-each select="BudgetLangXML">
<td >
<TABLE border="1" cellspacing="0" >
<TR bgcolor="#000080" style="color: White;">
<TD width="150" colspan="3"><xsl:value-of select="LANGS_Name" /> / <xsl:value-of select="LangName" /></TD>
</TR>
<TR bgcolor="#000080" style="color: White;">
<TD width="50" >Qty</TD>
<TD width="50" >Unit Price</TD>
<TD width="50" >Total</TD>
</TR>
</TABLE>
</td>
</xsl:for-each>
</TR>
<xsl:for-each select="BudgetItemXML[count(. | key('item-by-service', SERV_ServiceName)[1]) = 1]">
<TR>
<TD width="100"><xsl:value-of select="SERV_ServiceName" /></TD>
</TR>
<!--
<xsl:for-each select="BudgetItemXML[count(. | key('item-by-id', BIT_ItemID)[1]) = 1]">
<xsl:variable name="id_items" select="key('item-by-service', SERV_ServiceName)" />
<xsl:for-each select="$id_items[generate-id() =generate-id(key('item-by-service-id',concat(SERV_ServiceName, ' ',BIT_ItemID))[1])]">
-->
<xsl:variable name="service_items" select="key('item-by-service', SERV_ServiceName)" />
<xsl:for-each select="$service_items[generate-id() =generate-id(key('item-by-service-cat',concat(SERV_ServiceName, ' ', CAT_CategoryName))[1])]">
<TR>
<TD width="100" bgcolor="#E5E5E5"></TD>
<TD width="100"><xsl:value-of select="CAT_CategoryName" /></TD>
</TR>
<xsl:variable name="id_items" select="key('item-by-cat', CAT_CategoryName)" />
<xsl:for-each select="$id_items[generate-id() =generate-id(key('item-by-service-cat-id',concat(SERV_ServiceName, ' ', CAT_CategoryName,' ',BIT_ItemID))[1])]">
<TR>
<TD width="100" bgcolor="#E5E5E5"></TD>
<TD width="100" bgcolor="#E5E5E5"></TD>
<TD width="100"><xsl:value-of select="BIT_ItemName" /> </TD>
<TD width="100"><xsl:value-of select="PC_PriceCodeName" /></TD>
<TD width="50"><xsl:value-of select="UNI_Name" /> </TD>
<xsl:for-each select="$service_items[generate-id() =generate-id(key('item-by-service-cat',concat(SERV_ServiceName, ' ', CAT_CategoryName))[1])]">
<td>
<table cellspacing="0">
<td width="50" align="center"><xsl:value-of select="BIT_ItemNbSell" /></td>
<td width="50" align="center"><xsl:value-of select="PLD_Price" /></td>
<td width="50" align="center"><xsl:value-of select="Total" /></td>
</table>
</td>
</xsl:for-each>
</TR>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</TABLE>
</body>
</html>
</xsl:template>
</xsl:stylesheet>