[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: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 29 Mar 2006 22:48:05 +0100
RE:  Filtering out duplicates in current-group()
> 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".

Well, your inner current-group() holds two copies of "Strangers in the
Night" and if you apply-templates to both of them, you're going to get both
of them output. The whole point of grouping them is that you process them as
a group, not individually. For example you might do

<p><xsl:apply-templates select="current-group()[1]/Title"/></p>
<p><xsl:apply-templates select="current-group()/*[not(self::Title)]"/></p>

Michael Kay
http://www.saxonica.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.