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

RE: Filtering out duplicates in current-group()

Subject: RE: Filtering out duplicates in current-group()
From: Don Smith <dtsmithisogen@xxxxxxxxx>
Date: Wed, 29 Mar 2006 11:21:09 -0800 (PST)
don smith
I tried this:

<xsl:for-each-group select="Song"
group-by="substring(Year, 1, 3)">
  <p>Decade: <xsl:value-of
select="current-grouping-key()"/>0's</p>
  <xsl:for-each-group select="current-group()"
group-by="Title">
    <p style="margin-left: 1pc;">
     <xsl:apply-templates
select="current-group()/Title"/>
    </p>
  </xsl:for-each-group>
</xsl:for-each-group>

but still get two "Strangers in the Night". I've also
tried every other permutation of this I can think of.
Same result.

--- Michael Kay <mike@xxxxxxxxxxxx> wrote:

> Just do another level of grouping:
> 
> <xsl:for-each-group select="current-group()"
> group-by="Title">
>   .. output details of this title ..
> 
> Michael Kay
> http://www.saxonica.com/ 
> 
> > -----Original Message-----
> > From: Smith, Donald
> [mailto:DSmith@xxxxxxxxxxxxxxxxxxx] 
> > Sent: 29 March 2006 17:32
> > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > Subject:  Filtering out duplicates in
> current-group()
> > 
> > Given this source:
> > 
> > <Playlist>
> >   <Song order="5" id="c95">
> >     <Title>Maneater</Title>
> >     <Artist>Hall and Oates</Artist>
> >     <Album>H20</Album>
> >     <Year>1982</Year>
> >   </Song>
> >   <Song order="13" id="c49">
> >     <Title>Strangers In The Night</Title>
> >     <Artist>Frank Sinatra</Artist>
> >     <Album>Reprise Collection Boxed Set</Album>
> >     <Year>1966</Year>
> >   </Song>
> >   <Song order="8" id="c22">
> >     <Title>Strangers In The Night</Title>
> >     <Artist>Frank Sinatra</Artist>
> >     <Album>Your Hit Parade - '60s
> Instrumentals</Album>
> >     <Year>1960</Year>
> >   </Song>
> > </Playlist>
> > 
> > And given the following templates from my
> stylesheet:
> > 
> > <xsl:template match="Playlist">
> >   <h1>Songs By Decade</h1>
> >   <xsl:for-each-group select="Song"
> group-by="substring(Year, 1, 3)">
> >     <p>Decade: <xsl:value-of
> select="current-grouping-key()"/>0's</p>
> >      <p style="margin-left: 1pc;">
> >              <xsl:apply-templates
> select="current-group()/Title" />
> >      </p>
> >   </xsl:for-each-group>
> > </xsl:template>
> > 
> > <xsl:template match="Title">
> >   <xsl:apply-templates select="." /><br/>
> > </xsl:template>
> > 
> > How do I filter the current group so that the same
> song doesn't occur
> > more than once for a decade (that is, so I don't
> get "Strangers In the
> > Night" more than once for the 60's)?
> > 
> > Thanks,
> > 
> > Don
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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.