<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:output method="html"/>
	<xsl:key name="invoiceid" match="/database/invoices/invoices_rec" use="invoiceNum"/>
	<xsl:template match="/database">
		<html>
			<body>
				<h2>All Customer Invoices</h2>
				<xsl:for-each select="invoices/invoices_rec[ generate-id(.) = generate-id( key('invoiceid', invoiceNum)[1])]">
					<xsl:sort select="invoiceNum" data-type="number" order="ascending"/>
					<p/>Ship to:
					<p/>
					<xsl:value-of select="contactName"/><br/>
					<xsl:value-of select="shipToAddress"/><br/>
					<xsl:value-of select="shipToCity"/><br/>
					<xsl:value-of select="shipToState"/><br/>
					<xsl:value-of select="shipToZip"/><br/>
					<p/><!-- display customer invoice details -->
					<p/>INVOICE NUMBER: <xsl:value-of select="invoiceNum"/>
					<p/>SALES DATE: <xsl:value-of select="salesDate"/><br/><br/>
					<table border="1">
						<tr bgcolor="#9acd32">
							<th>Product ID</th>
							<th>Product Name</th>
							<th>Product Description</th>
							<th>Quantity</th>
							<th>Unit Price</th>
							<th>Extended Price</th>
						</tr>
						<xsl:for-each select="key('invoiceid', invoiceNum)">
							<tr>
								<td><xsl:value-of select="ProductID"/></td>
								<td><xsl:value-of select="ProductName"/></td>
								<td><xsl:value-of select="ProductDescription"/></td>
								<td><xsl:value-of select="Quantity"/></td>
								<td><xsl:value-of select="UnitPrice"/></td>
								<td><xsl:value-of select="ExtendedPrice"/></td>
							</tr>
						</xsl:for-each>
					</table>
				</xsl:for-each>
				<br/>
				<br/>
			</body>
		</html>
	</xsl:template>
</xsl:stylesheet><!-- Stylus Studio meta-information - (c) 2004-2006. Progress Software Corporation. All rights reserved.
<metaInformation>
<scenarios ><scenario default="yes" name="Scenario1" userelativepaths="yes" externalpreview="no" url="orders.xml" htmlbaseurl="" outputurl="" processortype="saxon8" useresolver="yes" profilemode="0" profiledepth="" profilelength="" urlprofilexml="" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext="" validateoutput="no" validator="internal" customvalidator="" ><advancedProp name="sInitialMode" value=""/><advancedProp name="bXsltOneIsOkay" value="true"/><advancedProp name="bSchemaAware" value="true"/><advancedProp name="bXml11" value="false"/><advancedProp name="iValidation" value="0"/><advancedProp name="bExtensions" value="true"/><advancedProp name="iWhitespace" value="0"/><advancedProp name="sInitialTemplate" value=""/><advancedProp name="bTinyTree" value="true"/><advancedProp name="bWarnings" value="true"/><advancedProp name="bUseDTD" value="false"/></scenario></scenarios><MapperMetaTag><MapperInfo srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no"/><MapperBlockPosition></MapperBlockPosition><TemplateContext></TemplateContext><MapperFilter side="source"></MapperFilter></MapperMetaTag>
</metaInformation>
-->