<?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"/>

	<!-- Generate a Key of all Rows with the same provision value -->

	<xsl:key name="Provisions" match="Row" use="provision"/>

	<!-- Generate a Key for all Rows with the same class value -->

	<xsl:key name="Classes" match="Row" use="class"/>

	<xsl:template match="Rowset">
	<html>
		<body>
			<h2 align="center">
				<font color="#000080">DRMS LTD RATE FACTORS 
					<br/>
				</font>
			</h2>
			<h3 align="center">
				<xsl:value-of select="result/@gen_date"/>
			</h3>
			<hr width="100%"/><!-- Factors -->
			<table cellSpacing="0" cellPadding="0" border="1" style="font-size: 10pt;">
				<tbody>
					<tr>
						<th bgColor="#0000a0">
							<font color="#ffffff">Benefits</font>
						</th><!-- For each class, output a column header -->
						<xsl:for-each select="Row[generate-id() = generate-id(key('Classes',class))]"><!--                              <xsl:sort select="class/@sort"/> -->
							<th bgColor="#0000a0">
								<font color="#ffffff">Class 
									<xsl:value-of select="class"/>
								</font>
							</th>
						</xsl:for-each>
					</tr><!-- For each distinct Provision, output a row -->
					<xsl:for-each select="Row[generate-id() = generate-id(key('Provisions',provision))]">
						<xsl:sort select="provision"/><!-- Sort the distinct provision -->
						<tr><xsl:variable name="Provision" select="provision"/>
							<td bgColor="#c0c0c0">
								<strong>
									<xsl:value-of select="provision"/>
								</strong>
							</td><!-- For each row with this provision, output the value -->
							<xsl:for-each select="../Row[provision = $Provision]">
								<xsl:sort select="Class/@sort"/><!-- Sort by the class number -->
								<td>
									<xsl:value-of select="rate"/>
								</td>
							</xsl:for-each>
						</tr>
					</xsl:for-each>
				</tbody>
			</table>
			<br/>
			<br/>
		</body>
	</html>
</xsl:template>
</xsl:stylesheet><!-- Stylus Studio meta-information - (c) 2004-2005. Progress Software Corporation. All rights reserved.
<metaInformation>
<scenarios ><scenario default="yes" name="Scenario1" userelativepaths="yes" externalpreview="no" url="Factors.xml" htmlbaseurl="" outputurl="" processortype="internal" profilemode="0" profiledepth="" profilelength="" urlprofilexml="" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext=""/></scenarios><MapperMetaTag><MapperInfo srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no"/><MapperBlockPosition><template match="Rowset"><block path="html/body/h3/xsl:value&#x2D;of" x="217" y="144"/><block path="html/body/table/tbody/tr/xsl:for&#x2D;each" x="177" y="161"/><block path="html/body/table/tbody/tr/xsl:for&#x2D;each/th/font/xsl:value&#x2D;of" x="57" y="161"/><block path="html/body/table/tbody/xsl:for&#x2D;each" x="257" y="161"/><block path="html/body/table/tbody/xsl:for&#x2D;each/tr/td/strong/xsl:value&#x2D;of" x="17" y="161"/><block path="html/body/table/tbody/xsl:for&#x2D;each/tr/xsl:for&#x2D;each" x="97" y="161"/><block path="html/body/table/tbody/xsl:for&#x2D;each/tr/xsl:for&#x2D;each/td/xsl:value&#x2D;of" x="137" y="161"/></template></MapperBlockPosition></MapperMetaTag>
</metaInformation>
-->