[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] displaying unique entries in a list
Dear all, Hope that you can help with this problem I have displaying a list of data. My XML looks like this: <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> My xslt example is below: <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <body> <h2>Test example of List output</h2> <hr/> <!--########## Begin Main Document ##########--> <xsl:apply-templates /> </body> </html> </xsl:template> <!--######## Template for Department Main table data ######--> <xsl:template match="List"> <table border="1" width="100%"> <xsl:apply-templates select="Department"/> </table> </xsl:template> <!--### Displays first page departments only ###--> <xsl:template match="Department"> <xsl:for-each select="/List/Entry/Department[not(. = preceding::Department)]"> <tr> <td> <span style="color:#000000"> <a href=""><xsl:value-of select="." /></a> </span> </td> </tr> </xsl:for-each> </xsl:template> </xsl:stylesheet> An earlier posted fix in the xlst allowed me to display just single unique entries in the html like this: Accounting and Finance Maths Economic History However I now get multiples of these unique values rather than one single list of the unique values. Am I calling the template root incorrectly in the xslt? Should I be using a loop of some sort to display the unique values only once? Many thanks, Mike
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|