[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

grouping content

Subject: grouping content
From: "Yang" <sfyang@xxxxxxxxxxxxx>
Date: Fri, 6 Apr 2001 09:57:41 +0800
grouping content
Hi,  Gavinm

Following is provided based two level grouping method for your group
problem.  Test using ie5 and msxml3.

  <?xml version="1.0" encoding="big5" ?>
- <xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output indent="yes" />
  <xsl:key name="Area" match="Location" use="@Area" />
  <xsl:key name="Value" match="Location" use="concat(@Area,' ',@Value)" />
  <xsl:variable name="source" select="/docs/Location" />
- <xsl:template match="/">
- <xsl:apply-templates
select="//Location[generate-id(.)=generate-id(key('Area',@Area)[1])]"
mode="first">
  <xsl:sort select="@Area" />
  </xsl:apply-templates>
  </xsl:template>
- <xsl:template match="Location" mode="first">
  <br />
  Location
  <xsl:value-of select="@Area" />
  <br />
- <xsl:apply-templates select="key('Area',@Area)[generate-id(.)
=generate-id(key('Value',concat(@Area,' ',@Value))[1])]" mode="second">
  <xsl:sort select="@Value" />
  </xsl:apply-templates>
  </xsl:template>
- <xsl:template match="Location" mode="second">

  <xsl:value-of select="key('Value',concat(@Area,' ',@Value))/@Value" />
  <br />
  </xsl:template>
  </xsl:stylesheet>

hope it will help,

Sun-fu Yang

sfyang@xxxxxxxxxxxxx



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.