Problem
How to get list of unique text values from XML document, for example to build a kind of dictionary from these node values.

Solution
nodename is name of node to select from.
preceding axis get everything what is before start tag of selected node.
It is also possible to use following axis to get everything what follows current node, with this axis, XPath will return results in reversed order

Code snippets

//nodename[not(.=preceding::text())]/text()

or

//nodename[not(.= following::text())]/text()

0 comments:

Older Post Home