I\'m using XPATH 1.0 parsers alongside CLiXML in my JAVA project, I\'m trying to setup a CLiXML constraint rules file.
I would like to show an error if there are duplica
This cannot be done with a single XPath 1.0 expression (see this similar question I answered today).
Here is a single XPath 2.0 expression (in case you can use XPath 2.0):
/*/*[(for $n in name()
return count(/*/*[name()=$n])
)
>1
]
This selects all elements that are children of the top element of the XML document and that occur more than once.