I have three files: an xml file and two xsl stylesheets.

The main style sheet connects to a stylesheet that uses recursion to calculate the total cost of an order. However, the template is not working properly: all I get is a value of $0.00.

Please have a look at my files and thanks in advance for any suggestion.

Here is the recursive template:

Code:
<?xml version="1.0" encoding="UTF-8" ?>


<xsl:stylesheet version='1.0' xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template name="totalRevenue">
    <xsl:param name="list" />
    <xsl:param name="total" select="0" />
    <xsl:choose>
        <xsl:when test="$list">
        <xsl:variable name="first" select="$list[1]/itemQty * $list[1]/itemPrice" />
			<xsl:call-template name="totalRevenue">
				<xsl:with-param name="list" select="$list[position() > 1]" />
				<xsl:with-param name="total" 
					 select="$first + $total" />
			</xsl:call-template>
        </xsl:when>
        <xsl:otherwise>
            <xsl:value-of select="format-number($total, '$#,#00.00')" />
        </xsl:otherwise>
    </xsl:choose>
</xsl:template>

</xsl:stylesheet>
And here is the main style sheet:
Code:
<?xml version="1.0" encoding="UTF-8" ?>   <xsl:stylesheet version='1.0' xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 	<xsl:import href="automazeTotalCalc.xsl" /> 	 	<xsl:variable name="totalItemCost" select="apply" /> 	 	<xsl:variable name="shippingCost" select="format-number(//sCost,'#,##0.00')" /> 	 	<xsl:template match="/"> 	<html>     <head><title>Shipping Manifest</title></head> 	<!--<link href="items.css" rel="stylesheet" type="text/css" />-->     <body> 		<h2>Shipping Manifest</h2> 		<table> 			<tr><th>Delivery Information</th></tr> 			<tr> 				<th>Warehouse Name</th><td><xsl:value-of select="//wName" /></td> 			</tr> 			<tr> 				<th>Contact Name</th><td><xsl:value-of select="//wContact" /></td> 			</tr> 			<tr> 				<th>Order Date</th><td><xsl:value-of select="//orderDate" /></td> 			</tr> 			<tr> 				<th>Date Received</th><td><xsl:value-of select="//recvDate" /></td> 			</tr> 			<tr> 				<th>Received By</th><td><xsl:value-of select="//recvBy" /></td> 			</tr> 		</table>		 					 		<table> 			<tr> 				<th>Item ID</th> 				<th>Item Name</th> 				<th>Qty</th> 				<th>Price</th> 				<th>Total</th> 			</tr> 			<xsl:apply-templates select="//item"/> 			<tr><th>Total Item Cost</th> 				<td> 					<xsl:call-template name="totalRevenue"> 						<xsl:with-param name="list" select="/manifest/item" /> 					</xsl:call-template> 				</td> 			</tr> 			 			<tr><th>Shipping Cost</th><td><xsl:value-of select="$shippingCost" /><br/></td></tr> 			<tr><th>Manifest Total</th><td></td></tr>			 		</table>		 	</body>     </html>	 	</xsl:template>  	<xsl:template match="//item"> 		<tr> 			<td><xsl:number format="1"/></td> 			<td><xsl:value-of select="itemName" /></td> 			<td><xsl:value-of select="itemQty" /></td> 			<td><xsl:value-of select="itemPrice" /></td> 			<td><xsl:value-of select="format-number(itemPrice * itemQty,'#,##0.00')" /></td> 		</tr> 	</xsl:template> 	 </xsl:stylesheet>
And here is the xml file:
Code:
<?xml version="1.0" encoding="UTF-8" ?>  <?xml-stylesheet type="text/xsl" href="automaze.xsl" ?>  <delivery>    <wName>Reston</wName>    <wContact>John McAdams</wContact>    <orderDate>8/15/2005</orderDate>    <recvDate>8/21/2005</recvDate>    <recvBy>David Hanson</recvBy>    <sCost>385</sCost>    <manifest>       <item itemID="CM204">          <itemName>Camshaft (Box 20)</itemName>          <itemQty>10</itemQty>          <itemPrice>289.95</itemPrice>       </item>       <item itemID="CR201">          <itemName>Carburetor (Box 25)</itemName>          <itemQty>5</itemQty>          <itemPrice>159.95</itemPrice>       </item>       <item itemID="CRK310">          <itemName>Crankshaft (Box 10)</itemName>          <itemQty>3</itemQty>          <itemPrice>109.95</itemPrice>       </item>       <item itemID="DS503">          <itemName>Distributor (Box 15)</itemName>          <itemQty>5</itemQty>          <itemPrice>125.95</itemPrice>       </item>       <item itemID="EC501">          <itemName>Engine Computer (Box 1)</itemName>          <itemQty>5</itemQty>          <itemPrice>414.59</itemPrice>       </item>       <item itemID="OP460">          <itemName>Oil Pump (Box 20)</itemName>          <itemQty>3</itemQty>          <itemPrice>214.95</itemPrice>       </item>       <item itemID="SP300">          <itemName>Standard Spark Plugs (Box 100)</itemName>          <itemQty>10</itemQty>          <itemPrice>114.45</itemPrice>       </item>       <item itemID="SP310">          <itemName>Delux Spark Plugs (Box 100)</itemName>          <itemQty>10</itemQty>          <itemPrice>139.95</itemPrice>       </item>       <item itemID="TB261">          <itemName>Timing Belt (Box 40)</itemName>          <itemQty>5</itemQty>          <itemPrice>94.90</itemPrice>       </item>       <item itemID="TR301">          <itemName>Transmission (Box 1)</itemName>          <itemQty>5</itemQty>          <itemPrice>310.95</itemPrice>       </item>       <item itemID="BA105">          <itemName>Standard Batteries (Box 12)</itemName>          <itemQty>5</itemQty>          <itemPrice>495.40</itemPrice>       </item>       <item itemID="BA205">          <itemName>Security Batteries (Box 4)</itemName>          <itemQty>3</itemQty>          <itemPrice>289.95</itemPrice>       </item>       <item itemID="BA115">          <itemName>Delux Batteries (Box 12)</itemName>          <itemQty>5</itemQty>          <itemPrice>525.95</itemPrice>       </item>       <item itemID="SF305">          <itemName>Standard Air Filters (Box 16)</itemName>          <itemQty>5</itemQty>          <itemPrice>148.25</itemPrice>       </item>       <item itemID="FI372">          <itemName>Fuel Injection Kits (Box 1)</itemName>          <itemQty>15</itemQty>          <itemPrice>129.95</itemPrice>       </item>       <item itemID="BRK681">          <itemName>Brake Line Kit (Box 1)</itemName>          <itemQty>25</itemQty>          <itemPrice>29.95</itemPrice>       </item>       <item itemID="CF401">          <itemName>Cooling Fans (Box 20)</itemName>          <itemQty>5</itemQty>          <itemPrice>34.41</itemPrice>       </item>       <item itemID="ALT561">          <itemName>Chrome-plated Alternators (Box 5)</itemName>          <itemQty>3</itemQty>          <itemPrice>105.95</itemPrice>       </item>       <item itemID="ALT610">          <itemName>Alternator Case Kit (Box 1)</itemName>          <itemQty>5</itemQty>          <itemPrice>69.95</itemPrice>       </item>       <item itemID="CC310">          <itemName>Catalytic Converters (Box 5)</itemName>          <itemQty>3</itemQty>          <itemPrice>121.59</itemPrice>       </item>       <item itemID="CC315">          <itemName>Universal Catalytic Converters (Box 5)</itemName>          <itemQty>5</itemQty>          <itemPrice>68.95</itemPrice>       </item>    </manifest> </delivery>l