[xsl] Re: XSL-List Digest V4 #275

Subject: [xsl] Re: XSL-List Digest V4 #275
From: David Chryst <dchryst@xxxxxxxxx>
Date: Wed, 17 Apr 2002 10:15:25 -0700 (PDT)
Ragulf,
You're close!  Within the <xsl:for-each
select="$unique-dates"> element, introduce an
xsl:sort!
I tested this xslt with MSXML3 and MSXML4.  

<xsl:template name="group-by-date">
  <xsl:variable name="unique-dates"
select="/NewsList/List/News[not(Date=preceding-sibling::News/Date)]/Date"/>
  <xsl:for-each select="$unique-dates">
    <xsl:sort select="substring(.,7,4)"
data-type="number" order="ascending"/>
    <xsl:sort select="substring(.,5,2)"
data-type="number" order="ascending"/>
    <xsl:sort select="substring(.,1,2)"
data-type="number" order="ascending"/>
    Date is: <xsl:value-of select="."/><br/>
    <xsl:for-each
select="/NewsList/List/News[Date=current()]">
      <H1><xsl:value-of select="P1"/></H1>
      <!-- Other such stuff here, but I would like to
put this functionality into another template -->
    </xsl:for-each>
  </xsl:for-each>
</xsl:template>


> I have a problem both sorting and grouping...
> I can sort and I can group (using following two
> templates), but I can't 
> manage to do both and I have been at it for 5 hours
> now, so now I appeal to 
> you for help.
> 
> 
> Problem with the second stylesheet is that while the
> result is grouped by 
> date, it is grouped by how the dates appear in
> document order, which I have 
> no controll over, and I want it by date descending
> like in the first 
> stylesheet.
> 
> If some of you can tell me how to do it, I will be
> very gratefull.
> 
> Sincerly
> Ragulf Pickaxe :)
> 
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/

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


Current Thread