This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: grouping headers
- To: <XSL-List at lists dot mulberrytech dot com>
- Subject: RE: [xsl] grouping headers
- From: "Sullivan, Dan" <dsullivan at develop dot com>
- Date: Fri, 24 Aug 2001 05:55:58 -0700
- Reply-To: xsl-list at lists dot mulberrytech dot com
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