comparing nodes in xml with xslt

Posted by Santhosh.Nallavelli under XML on 8/24/2012 | Points: 10 | Views : 1345 | Status : [Member] | Replies : 0
Hi All ,

I am transforming xml data to html page wiith the help of xslt . I want to eliminate duplicate data where appears like this in the following way .
xml data
---------
<calendar>
<event>
<date>May 11</date>
<description>Mother's Day</description>
</event>
<event>
<date>May 12</date>
<description>Birthday</description>
</event>
<event>
<date>May 12</date>
<description>Board Meeting</description>
</event>
</calendar>

My xslt code
-----------
<?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>Event Dates </h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>date</th>
<th>description</th>
</tr>
<xsl:for-each select="calendar/event">
<tr>
<td><xsl:value-of select="date"/></td>
<td><xsl:value-of select="description"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>

</xsl:stylesheet>
My output
-------------
date description
May 11 Mother's Day
May 12 Birthday
May 12 Board Meeting
Desired Output.
------------------
date description
May 11
Mother's Day

May 12
Birthday
Board Meeting

Please suggest me the XSLT code to modify .
Thanks in advance .




Responses

(No response found.)

Login to post response