How To Eliminate multi Entries in XSL--Please Help
Posted: Sat Jun 11, 2005 2:28 pm
Hi All ,
I am a newbie to XSL . I am not sure where I am going wrong ?
My XML Data is like this and it has multiple duplicate entries:
<Employees>
<Accountant>
<Employee name="varsha">
<Empdetails id="100" age="23"/>
<comment/>
<Empaddress addr="sdlklklk"/>
</Employee>
</Accountant>
</Employees>
The only thing that is unique is "id".I need to eliminate the duplicate entries based on this...
Here goes my XSL :
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<?xml-stylesheet type="text/xsl" href="xslt_example_param.xsl"?>
<xsl:output method="text" />
<xsl:template match="/Employees/Accountant">
<xsl:for-each select="Employee/Empdetails[not(@id= preceding-sibling::FirewallRule/@id)]">
<xsl:value-of select="@id"/><xsl:text>
</xsl:text>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
I couldn't find what is wrong with my XSL ...Can anyone please help me to solve this or any alternate solution.
Thanks,
Pratibha
I am a newbie to XSL . I am not sure where I am going wrong ?
My XML Data is like this and it has multiple duplicate entries:
<Employees>
<Accountant>
<Employee name="varsha">
<Empdetails id="100" age="23"/>
<comment/>
<Empaddress addr="sdlklklk"/>
</Employee>
</Accountant>
</Employees>
The only thing that is unique is "id".I need to eliminate the duplicate entries based on this...
Here goes my XSL :
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<?xml-stylesheet type="text/xsl" href="xslt_example_param.xsl"?>
<xsl:output method="text" />
<xsl:template match="/Employees/Accountant">
<xsl:for-each select="Employee/Empdetails[not(@id= preceding-sibling::FirewallRule/@id)]">
<xsl:value-of select="@id"/><xsl:text>
</xsl:text>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
I couldn't find what is wrong with my XSL ...Can anyone please help me to solve this or any alternate solution.
Thanks,
Pratibha