我在 xslt 的帮助下将 xml 数据转换为 html 页面。我想通过以下方式消除出现这样的重复数据。
xml数据
<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>
我的 xslt 代码
<?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>
我的输出
date description
May 11 Mother's Day
May 12 Birthday
May 12 Board Meeting
期望的输出。
date description
May 11
Mother's Day
May 12
Birthday
Board Meeting
请建议我修改 XSLT 代码。提前致谢 。