<?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:include href="Style1.xsl" />



<xsl:template match="/">	<!-- Set Formatting Characteristics -->
	<xsl:call-template name="Style1"/>

	<h1>Display of transactions in order of Hours, Minutes, Seconds, AMPM (HHMMSSAP)</h1>

	<span class="subhead">Start Dates</span>
	<table border="1">
		<tr>
		<th>Transaction Start Date</th>
		<th>Description</th>
		<th>Hours</th>
		<th>Minutes</th>
		<th>Seconds</th>
		<th>AM/PM</th>
		</tr>
		<xsl:for-each select="/transactions/transaction">
		<xsl:sort order="ascending" select="substring(@startdate, 12,2)" /> 
		<xsl:sort order="ascending" select="substring(@startdate, 15,2)" /> 	
		<xsl:sort order="ascending" select="substring(@startdate, 18,2)" /> 
		<xsl:sort order="ascending" select="substring(@startdate, 21,2)" /> 
		<tr>
		<td><xsl:value-of select="@startdate"/></td>
		<td><xsl:value-of select="@description"/></td>
		<td><xsl:value-of select="substring(@startdate, 12,2)"/></td>
		<td><xsl:value-of select="substring(@startdate, 15,2)"/></td>
		<td><xsl:value-of select="substring(@startdate, 18,2)"/></td>
		<td><xsl:value-of select="substring(@startdate, 21,2)"/></td>
		</tr>

		</xsl:for-each>
	</table>

	<br/><br/>

	<span class="subhead">End Dates</span>
	<table border="1">
		<tr>
		<th>Transaction End Date</th>
		<th>Description</th>
		<th>Hours</th>
		<th>Minutes</th>
		<th>Seconds</th>
		<th>AM/PM</th>
		</tr>
		<xsl:for-each select="/transactions/transaction">
		<xsl:sort order="ascending" select="substring(@enddate, 12,2)" /> 
		<xsl:sort order="ascending" select="substring(@enddate, 15,2)" /> 	
		<xsl:sort order="ascending" select="substring(@enddate, 18,2)" /> 
		<xsl:sort order="ascending" select="substring(@enddate, 21,2)" /> 
		<tr>
		<td><xsl:value-of select="@enddate"/></td>
		<td><xsl:value-of select="@description"/></td>
		<td><xsl:value-of select="substring(@enddate, 12,2)"/></td>
		<td><xsl:value-of select="substring(@enddate, 15,2)"/></td>
		<td><xsl:value-of select="substring(@enddate, 18,2)"/></td>
		<td><xsl:value-of select="substring(@enddate, 21,2)"/></td>
		</tr>
		</xsl:for-each>
	</table>
	<xsl:apply-templates/>
</xsl:template>

</xsl:stylesheet>
