Subject: RE: grouping headers
From: "Sullivan, Dan" <dsullivan@xxxxxxxxxxx>
Date: Fri, 24 Aug 2001 05:55:58 -0700
|
watch for line wraps.
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="html"/>
<xsl:template match="person" mode="content">
<tr><td> <xsl:value-of select="name"/></td></tr>
</xsl:template>
<xsl:template match="person">
<tr><td>
<b> <xsl:value-of select="city"/></b></td></tr>
<xsl:apply-templates select="/people/person[city = current()/city]"
mode="content"/>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="/people">
<html>
<body bgcolor="#FFFFFF">
<xsl:element name="table">
<xsl:attribute name="rules">all</xsl:attribute>
<xsl:attribute name="border">1</xsl:attribute>
<xsl:apply-templates
select="person[preceding-sibling::person[city]!=city]">
<xsl:sort select="city"/>
</xsl:apply-templates>
</xsl:element>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Dan
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|