Subject: RE: [xsl] selecting unique entries from a list From: "Hallas,M" <M.Hallas@xxxxxxxxx> Date: Thu, 5 May 2005 13:49:22 +0100 |
Hi Mukul, Works a treat! Many thanks. Mike -----Original Message----- From: Mukul Gandhi [mailto:mukul_gandhi@xxxxxxxxx] Sent: 05 May 2005 13:32 To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: [xsl] selecting unique entries from a list Please try this XSL.. <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="html" /> <xsl:template match="/xml"> <html> <head> <title/> </head> <body> <table> <xsl:for-each select="List/Entry/Department[not(. = preceding::Department)]"> <tr> <td><xsl:value-of select="." /></td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet> This is tested with IE 6 , and Saxon 6.5.3 . Regards, Mukul --- "Hallas,M" <M.Hallas@xxxxxxxxx> wrote: > Dear all, > > Hope you can help with this query. I am new to > XML/XSLT. > > I need to take the following XML and generate an > initial web page displaying only one instance of > each department name. > > <xml> > <List> > <Entry> > <Session>2004/5</Session> > <Department>Accounting and Finance</Department> > </Entry> > <Entry> > > <Session>2004/5</Session> > <Department>Accounting and Finance</Department> > </Entry> > <Entry> > <Session>2004/5</Session> > <Department>Maths</Department> > </Entry> > <Entry> > <Session>2004/5</Session> > <Department>Maths</Department> > </Entry> > <Entry> > <Session>2004/5</Session> > <Department>Economic History</Department> > </Entry> > </List> > </xml> > > so in the html only unique departments would be > displayed once: > > > Accounting and Finance > Maths > Economic History > > What's the best way to do this in xslt? > > I understand that I can filter on specific names > within the xslt and do conditional > tests but I do not want to have to change the xslt > each time if the departments in the xml change. > > Hope it makes sense. > > Regards, > > Mike > > __________________________________ Do you Yahoo!? Yahoo! Mail - Find what you need with new enhanced search. http://info.mail.yahoo.com/mail_250
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] selecting unique entries , Mukul Gandhi | Thread | RE: [xsl] XSL - Transforming 2 XSL , Andrew Welch |
RE: [xsl] XSL - Transforming 2 XSL , Andrew Welch | Date | Re: [xsl] XSL - Transforming 2 XSL , Colin Paul Adams |
Month |