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

Re: variable handling

Subject: Re: variable handling
From: "Anita Sood" <anita_sood_77@xxxxxxxxxxx>
Date: Thu, 03 Oct 2002 17:17:28 +0000
anita sood
Thanks for the lead J. I guess I need to check your code. Unfortunately some syntax errors it seems.
Thank you once again


Regards
Anita


From: "J.Pietschmann" <j3322ptm@xxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re:  variable handling
Date: Tue, 01 Oct 2002 21:48:03 +0200

Anita Sood wrote:
I dont know what should be the appropriate title for this problem of mine.
You appear to have a "grouping problem": You want to group
your members by team.
The usual solution is called Muenchean Grouping, described
in detail in the XSLT FAQ reachable from
 http://www.mulberrytech.com/xsl/xsl-list/
and Jeni Tennisons site:
 http://www.jenitennison.com/xslt/grouping/index.html

For your specific problem, define a key which identifies
the groups, in your case, the elements to match are the
rows, the group a row belongs to is identified by its
team child element:

<xsl:key name="row-by-team" match="row" use="team"/>

In some template, you select rows, but make sure to select
only the first row of each group by a special trick. This
way you actually got the groups, defined by it's first member,
and you only need to process the whole group, selected by the
key:
 <xsl:template match="TeamInfo">
  <teams>
    <xsl:for-each select="row[generate-id()
      =generate-id(key('row-by-team',team)[1])]">
      <team number="{team} name="{teamName}">
        <xsl:for-each select="key('row-by-team',team)">
           <member><xsl:value-of select="."/></member>
        </xsl:for-each>
      </team>
    </xsl:for-each>
  </teams>
 </xsl:template>
(untested)

HTH
J.Pietschmann



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




_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com


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.