<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<!-- Output as an HTML file. -->
<xsl:output method="html"/>
<xsl:template match="/">
<!-- Create a table with headings, then search for
     children of the Metrics tag. Once processing
     is completed, sort the table by the ID field.
 -->
<TABLE BORDER="1">
    <TR>
        <TH>ID</TH>
        <TH>Source System</TH>
        <TH>Source IP</TH>
	<TH>Transfer Type</TH>
	<TH>Drop Box</TH>
	<TH>Metric Request</TH>
    </TR>
        <xsl:apply-templates select="Metrics/XXXMetrics">
            <xsl:sort select="id" order="ascending"/>
        </xsl:apply-templates>
</TABLE>
</xsl:template>

<xsl:template match="Metrics/XXXMetrics">
    <TR>
        <TD VALIGN="top">
            <xsl:value-of select="@id" />
        </TD>
        <TD VALIGN="top">
            <xsl:value-of select="@sourcesystem" />
        </TD>
        <TD VALIGN="top">
            <xsl:value-of select="@sourceip" />
        </TD>
    	  <TD VALIGN="top">
            <xsl:value-of select="@transfertype" />
        </TD>
        <TD VALIGN="top">
            <xsl:value-of select="@dropbox" />
        </TD>
        <TD VALIGN="top">
		<xsl:text>Start Time: </xsl:text>
            <xsl:value-of select="MetricRequest/@starttime" />
		<br/>
		<xsl:text>End Time: </xsl:text>
 		<xsl:value-of select="MetricRequest/@endtime" />
		<br/>
		<xsl:text>System: </xsl:text>
 		<xsl:value-of select="MetricRequest/@system" />
        </TD>
    </TR>
</xsl:template>
</xsl:stylesheet>