XSLT and XPath selecting distinct nodes

It is a complicated task to select distinct nodes or to use grouping useing xslt. There are no simple syntax to write this type XPath query.

The work arround is quite difficult to remember, thats why i decided to duplicate internet content in my blog.

Let’s say, that the XML source is:

[code lang=”xml”]

[/code]Lets say, that the task is to select distinct nodes grouping by attribute1.The Xpath will look like this:

[code lang=”xml”]
//MyData[not(@attribute1=preceding-sibling::[email protected])][email protected]

3 Replies to “XSLT and XPath selecting distinct nodes”

  1. hi, this works fine without namespaces. can you please give a sample how to use this with a xml
    which has namespaces.


  2. Thanks!

    Simplicity is the key to brilliance.

    You’re bookmarked in my Delicious.

    Regards, Eric

Leave a Reply