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>
--~--