Hi Mukul,
Thanks again for providing a fix to my problem.
Many thanks,
Mike
-----Original Message-----
From: Mukul Gandhi [mailto:mukul_gandhi(_at_)yahoo(_dot_)com]
Sent: 09 May 2005 10:30
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] displaying unique entries in a list
I modified the stylesheet as follows.. Its working.
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" />
<xsl:template match="/xml">
<html>
<body>
<h2>Test example of List output</h2>
<hr/>
<!--########## Begin Main Document ##########-->
<xsl:apply-templates select="List" />
</body>
</html>
</xsl:template>
<!--######## Template for Department Main table data
######-->
<xsl:template match="List">
<table border="1" width="100%">
<xsl:apply-templates select="Entry/Department"/>
</table>
</xsl:template>
<!--### Displays first page departments only ###-->
<xsl:template match="Entry/Department">
<xsl:if test="not(. = preceding::Department)">
<tr>
<td>
<span style="color:#000000">
<a href=""><xsl:value-of select="." /></a>
</span>
</td>
</tr>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Regards,
Mukul
--- "Hallas,M" <M(_dot_)Hallas(_at_)lse(_dot_)ac(_dot_)uk> wrote:
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
--~------------------------------------------------------------------
XSL-List info and archive:
http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to:
http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
Yahoo! Mail
Stay connected, organized, and protected. Take the tour:
http://tour.mail.yahoo.com/mailtour.html
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--