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

Re: grouping content

Subject: Re: grouping content
From: Dan Diebolt <dandiebolt@xxxxxxxxx>
Date: Thu, 5 Apr 2001 18:28:31 -0700 (PDT)
locationgroups
First of all, you need to close all of your Location tags:

 <Location Area="A" Value="23"/>
 
Play with the enclosed files. It is just a variant of an recent
grouping problem (they seem to appear daily now).

Regards,

Dan

**************************

File: LocationGroups.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet type="text/xsl" href="LocationGroups.xsl"?>
<root>
 <Location Area="A" Value="23"/>
 <Location Area="A" Value="24"/>
 <Location Area="A" Value="45"/>
 <Location Area="A" Value="88"/>
 <Location Area="B" Value="38"/>
 <Location Area="B" Value="18"/>
 <Location Area="C" Value="241"/>
 <Location Area="C" Value="213"/>
</root>

File: LocationGroups.xsl
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 <xsl:key name="LocationGroups" match="Location" use="@Area"/>
 <xsl:template match="/">
  <xsl:for-each select="root/Location[@Area and
generate-id(.)=generate-id(key('LocationGroups',@Area))]">
   <xsl:variable name="group" select="@Area"/>
   Location <xsl:value-of select="$group"/><br/>
   <xsl:for-each select="/root/Location[@Area=$group]">
    &#183;<xsl:value-of select="@Value"/><br/>
   </xsl:for-each>
  </xsl:for-each>
 </xsl:template>
</xsl:stylesheet>

<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 <xsl:key name="LocationGroups" match="Location" use="@Area"/>
 <xsl:template match="/">
  <xsl:for-each select="root/Location[@Area and
generate-id(.)=generate-id(key('LocationGroups',@Area))]">
   <xsl:variable name="group" select="@Area"/>
   Location <xsl:value-of select="$group"/><br/>
   <xsl:for-each select="/root/Location[@Area=$group]">
    ·<xsl:value-of select="@Value"/><br/>
   </xsl:for-each>
  </xsl:for-each>
 </xsl:template>
</xsl:stylesheet>


__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/

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


Current Thread
  • grouping content
    • Gavin Myers - Thu, 5 Apr 2001 17:01:57 -0400 (EDT)
      • <Possible follow-ups>
      • Dan Diebolt - Thu, 5 Apr 2001 21:33:59 -0400 (EDT) <=
      • Yang - Thu, 5 Apr 2001 22:08:58 -0400 (EDT)

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.