XSLT filter duplicates
This is an open discussion with 4 replies, filed under XSLT.
Search
You might use keys and the generate-id()
function, as described in this article. In the comments on this page there is also another interesting approach, writing the desired values to a variable:
<xsl:variable name="unique-list" select="//email[not(. = following::email)]" />
I haven't tested it, but it should work. Maybe some guru knows which method is faster?
Try something like
<xsl:variable name="unique-list" select="//email[not(.=following::email)]" /> <xsl:for-each select="$unique-list"> <xsl:value-of select="." /> </xsl:for-each>
I haven't tried this though.
//EDIT: michael-e was faster than me I guess :)
Some other similar posts:
Thanks all for help.
@nick
Hmm, my mistake. I searched the forum only for xslt duplicates
:)
Create an account or sign in to comment.
Hi.
Let's say I have an XML like this:
I need to list all emails without duplicates like this:
How can I filter out the duplicates?
Thank you.