<?xml version='1.0' encoding='utf-8'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:output method="html"/>
	<xsl:param name="PCTR_html_path" select="'http://localhost/'"/>
	<xsl:param name="PCTR_load_msg" select="''"/>
	<xsl:key name="fileid_key" match="attr[@name='FILE_ID']" use="."/>
	<xsl:template match="/">
	<html><head>
				<script language="javascript">var totalBody = 0.000000 
					var totalApplication = 0.000000    
					var totalElectrical = 0.000000    
					var totalPlumbing = 0.000000
					var totalChassis = 0.000000
					var totalCab = 0.000000
					var totalAerial = 0.000000   
					var totalTest = 0.000000
					var totalEngineering = 0.000000
										
					function addHrs(fHrsToAdd, GroupAddedTo)
					{
						switch (GroupAddedTo)
						{
							case 0:
									totalBody += fHrsToAdd
									break
							case1:
									totalApplication += fHrsToAdd
									break
							case 2:
									totalElectrical += fHrsToAdd
									break
							case 3:
									totalPlumbing += fHrsToAdd
									break
							case 4:
									totalChassis += fHrsToAdd
									break
							case 5:
									totalCab += fHrsToAdd
									break
							case 6:
									totalAerial += fHrsToAdd
									break
							case 7:
									totalTest += fHrsToAdd
									break
							case 8:
									totalEngineering += fHrsToAdd
									break
						}
					}</script>
			</head>
		<body>
			<p>
				<xsl:for-each select="PCTR/hierarchy/items/item/attrs/attr">
					<xsl:sort select="fileid_key"/><xsl:variable name="items" select="key('fileid_key',.)"/><xsl:variable name="curr_item" select="$items[1]/ancestor::item"/>
					<script>addHrs(
							<xsl:value-of select="$curr_item/attrs/attr[@name='hrs_body']"/>, 0)</script>
					<script>addHrs(
							<xsl:value-of select="$curr_item/attrs/attr[@name='hrs_applications']"/>, 1)</script>
					<script>addHrs(
							<xsl:value-of select="$curr_item/attrs/attr[@name='hrs_electrical']"/>, 2)</script>
					<script>addHrs(
							<xsl:value-of select="$curr_item/attrs/attr[@name='hrs_plumbing']"/>, 3)</script>
					<script>addHrs(
							<xsl:value-of select="$curr_item/attrs/attr[@name='hrs_chassis']"/>, 4)</script>
					<script>addHrs(
							<xsl:value-of select="$curr_item/attrs/attr[@name='hrs_cab']"/>, 5)</script>
					<script>addHrs(
							<xsl:value-of select="$curr_item/attrs/attr[@name='hrs_aerial']"/>, 6)</script>
					<script>addHrs(
							<xsl:value-of select="$curr_item/attrs/attr[@name='hrs_test']"/>, 7)</script>
					<script>addHrs(
							<xsl:value-of select="$curr_item/attrs/attr[@name='total_hrs_eng']"/>, 8)</script>
				</xsl:for-each>

						<table width="100%" border="1">
							<tbody>
								<tr align="left" valign="top">
									<th class="itemlistLabel">Total Body Hours</th>
								</tr>
								<xsl:for-each select="PCTR/hierarchy/items/item/attrs/attr">
								<xsl:value-of select="@name='hrs_body'"/>
									<xsl:variable name="group_hrs" select="PCTR/hierarchy/items/item/attrs/attr[@name='hrs_body']"/>
									<xsl:if test="$group_hrs > 0">
										<tr>
											<td>
												<xsl:value-of select="key('fileid_key',.)"/>
											</td>
										</tr>
									</xsl:if>
								</xsl:for-each>
							</tbody>
						</table>
				<script>if (totalBody &gt; 0) {document.writeln(totalBody)}</script>
				<script>if (totalApplication &gt; 0) {document.writeln(totalApplication)}</script>
				<script>if (totalApplication &gt; 0) {document.writeln(totalApplication)}</script>
				<script>if (totalElectrical &gt; 0) {document.writeln(totalElectrical)}</script>
				<script>if (totalPlumbing &gt; 0) {document.writeln(totalPlumbing)}</script>
				<script>if (totalChassis &gt; 0) {document.writeln(totalChassis)}</script>
				<script>if (totalCab &gt; 0) {document.writeln(totalCab)}</script>
				<script>if (totalAerial &gt; 0) {document.writeln(totalAerial)}</script>
				<script>if (totalTest &gt; 0) {document.writeln(totalTest)}</script>
				<script>if (totalEngineering &gt; 0) {document.writeln(totalEngineering)}</script>
				<table width="100%" border="1">
					<tbody>
						<tr vAlign="top" align="left">
							<th class="itemlistLabel">Total Body Hours</th>
							<th class="itemlistLabel">Total Applications Hours</th>
							<th class="itemlistLabel">Total Electrical Hours</th>
							<th class="itemlistLabel">Total Plumbing Hours</th>
							<th class="itemlistLabel">Total Chassis Hours</th>
							<th class="itemlistLabel"/>
						</tr>
						<tr vAlign="bottom" align="right">
							<td class="itemListType" width="15%">
								<script>document.writeln(totalBody);</script>
							</td>
							<td class="itemListType" width="15%">
								<script>document.writeln(totalApplication);</script>
							</td>
							<td class="itemListType" width="15%">
								<script>document.writeln(totalElectrical);</script>
							</td>
							<td class="itemListType" width="15%">
								<script>document.writeln(totalPlumbing);</script>
							</td>
							<td class="itemListType" width="15%">
								<script>document.writeln(totalChassis);</script>
							</td>
							<td class="itemListType" width="25%"/>
						</tr>
						<tr vAlign="top" align="left">
							<th class="itemlistLabel">Total Cab Hours</th>
							<th class="itemlistLabel">Total Aerial Hours</th>
							<th class="itemlistLabel">Total Test Hours</th>
							<th class="itemlistLabel"/>
							<th class="itemlistLabel"/>
							<th class="itemlistLabel">
								<b>Total Engineering Hours</b>
							</th>
						</tr>
						<tr vAlign="bottom" align="right">
							<td class="itemListType" width="15%">
								<script>document.writeln(totalCab);</script>
							</td>
							<td class="itemListType" width="15%">
								<script>document.writeln(totalAerial);</script>
							</td>
							<td class="itemListType" width="15%">
								<script>document.writeln(totalTest);</script>
							</td>
							<td class="itemListType" width="15%"/>
							<td class="itemListType" width="15%"/>
							<td class="itemListTypeAlternate" width="25%">
								<b>
									<script>document.writeln(totalEngineering);</script>
								</b>
							</td>
						</tr>
					</tbody>
				</table>
			</p>
		</body>
	</html>
</xsl:template>
	<xsl:template match="attr">
		<xsl:param name="key_in" select="."/>
	</xsl:template>
</xsl:stylesheet><!-- Stylus Studio meta-information - (c) 2004-2006. Progress Software Corporation. All rights reserved.
<metaInformation>
<scenarios ><scenario default="yes" name="GroupEngHrs" userelativepaths="yes" externalpreview="no" url="cr_enghrsover45.xml" htmlbaseurl="" outputurl="" processortype="internal" useresolver="yes" profilemode="0" profiledepth="" profilelength="" urlprofilexml="" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext="" validateoutput="no" validator="internal" customvalidator=""/></scenarios><MapperMetaTag><MapperInfo srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no" ><SourceSchema srcSchemaPath="cr_enghrsover45.xml" srcSchemaRoot="PCTR" AssociatedInstance="" loaderFunction="document" loaderFunctionUsesURI="no"/></MapperInfo><MapperBlockPosition><template match="/"><block path="html/body/p/xsl:for&#x2D;each" x="134" y="7"/><block path="html/body/p/xsl:for&#x2D;each/script/xsl:value&#x2D;of" x="132" y="34"/><block path="html/body/p/xsl:for&#x2D;each/script[1]/xsl:value&#x2D;of" x="132" y="66"/><block path="html/body/p/xsl:for&#x2D;each/script[2]/xsl:value&#x2D;of" x="131" y="99"/><block path="html/body/p/xsl:for&#x2D;each/script[3]/xsl:value&#x2D;of" x="131" y="130"/><block path="html/body/p/xsl:for&#x2D;each/script[4]/xsl:value&#x2D;of" x="128" y="161"/><block path="html/body/p/xsl:for&#x2D;each/script[5]/xsl:value&#x2D;of" x="129" y="182"/><block path="html/body/p/xsl:for&#x2D;each/script[6]/xsl:value&#x2D;of" x="131" y="207"/><block path="html/body/p/xsl:for&#x2D;each/script[7]/xsl:value&#x2D;of" x="130" y="235"/><block path="html/body/p/xsl:for&#x2D;each/script[8]/xsl:value&#x2D;of" x="127" y="265"/></template><template match="attr"></template></MapperBlockPosition><TemplateContext><template match="attr" mode="" srcContextPath="/PCTR/hierarchy/items/item/attrs/attr" srcContextFile="file:///k:/JonSonsteng/cr_enghrsover45.xml" targetContextPath="" targetContextFile=""/></TemplateContext><MapperFilter side="source"><Fragment url="" path="" action=""/></MapperFilter></MapperMetaTag>
</metaInformation>
-->