Subject: RE: [xsl] Distinct items? From: eric@xxxxxxxxxxxx (Eric Vitiello) Date: Tue, 27 Mar 2001 12:23:51 -0500 |
OK, I just realized another step I'd like to do. My XML is: <projects> <item> <year>1998</year> <title>This is the first item</title> </item> <item> <year>2000</year> <title>This is the second item</title> </item> <item> <year>1999</year> <title>This is the third item</title> </item> <item> <year>2000</year> <title>This is the fourth item</title> </item> <item> <year>1998</year> <title>This is the fifth item</title> </item> </projects> with the following XSLT: <xsl:for-each select='//item[not(year = preceding-sibling::item/year)]'> <xsl:sort select="projects/item/year" data-type="number" order="descending"/> <xsl:sort select="projects/item/month" data-type="number" order="descending"/> <xsl:sort select="projects/item/day" data-type="number" order="descending"/> <xsl:value-of select="year"/> </xsl:for-each> I get: 1998 1999 2000 I would like then to be able to list the data such as: 1998 * This is the first item * This is the fifth item 1999 * This is the third item 2000 * This is the second item * This is the fourth item Got code for that? I'm just starting with XSLT, and the syntax of selects, etc keeps throwing me off. --Eric > Hello > You can use this: > select='//item[not(year = preceding-sibling::item/year)]'> > > I hope that helps > > Edmund > > -----Original Message----- > From: eric@xxxxxxxxxxxx [mailto:eric@xxxxxxxxxxxx] > > I would like to retrieve a list of items such as: > > 1998 1999 2000 > > from the following XML: > > <projects> > <item> > <year>1998</year> > </item> > <item> > <year>1998</year> > </item> > <item> > <year>1999</year> > </item> > <item> > <year>2000</year> > </item> > <item> > <year>2000</year> > </item> > </projects> > > > > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Distinct items?, Eric Vitiello | Thread | RE: [xsl] Distinct items?, Eric Vitiello |
RE: [xsl] Distinct items?, Eric Vitiello | Date | [xsl] create new elements as output, Bruce Rosborough |
Month |