Subject: Re: [xsl] Sorting/grouping question From: Bryan Schnabel <bryan.schnabel@xxxxxxxxxxxxx> Date: Wed, 29 May 2002 11:31:37 -0700 (PDT) |
Sure, <xsl:key> would work, I think. <xsl:output method="text"/> <xsl:key name="first4digits-are-year" match="date" use="substring(.,1,4)"/> <xsl:template match="/"> <xsl:for-each select="/list/date[generate-id()=generate-id(key('first4digits-are-year',substring(.,1,4))[1])]"> <xsl:sort order="descending" /> <xsl:text> </xsl:text> <xsl:value-of select="substring(.,1,4)" /> </xsl:for-each> </xsl:template> Bryan --- Dan Cederholm <dan@xxxxxxxxxxxx> wrote: > > I need to turn this XML: > > <list> > <date>200201</date> > <date>200202</date> > <date>200101</date> > <date>200102</date> > <date>200001</date> > <date>200002</date> > </list> > > Into .. > > 2002 > 2001 > 2000 > > Basically building a list of years (one instance of > each year represented in > the XML) > > Should I be using <xsl:key> for something like this? > > Thanks, > Dan > > -- > dan@xxxxxxxxxxxx > > > > XSL-List info and archive: > http://www.mulberrytech.com/xsl/xsl-list > __________________________________________________ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Sorting/grouping question, Dan Cederholm | Thread | [xsl] Grouping Data Problem, Jeff Killingsworth |
[xsl] Sum Problem, Kirwan, K. | Date | Re: [xsl] Xalan memory limit?!, Matthew Braun |
Month |