<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/1999/xhtml">
<xsl:output method="xml" indent="yes" encoding="UTF-8"
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
omit-xml-declaration="yes" />
<xsl:strip-space elements="*"/>
<xsl:key name="accounts-by-region" match="/demo/salesman/account"
use="@region"/>
<xsl:template match="/demo">
<html>
<head><title>Accounts ordered by region</title></head>
<body>
<table border="1" valign="top">
<tr><th>Region</th><th>Account</th></tr>
<xsl:for-each select="salesman/account[count(. |
key('accounts-by-region',@region)[1]) = 1]">
<xsl:sort select="@region"/>
<xsl:for-each select="key('accounts-by-region',@region)">
<xsl:sort select="."/>
<tr>
<xsl:if test="position()=1">
<td rowspan="{last()}">
<xsl:value-of select="@region"/>
</td>
</xsl:if>
<td><xsl:value-of select="."/></td>
</tr>
</xsl:for-each>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
David
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--