This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

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@unisvr.net.tw



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]