lxuniq — Remove repeated elements in an XML document


lxuniq [ -xmlns[:prefix]=uri ...] domain-query element-query key-query [ input-file ]


lxuniq removes repeated elements in an XML document. The domain-query is an XPath that identifies elements within which removal is done. Within each domain the element-query is used to select elements to be compared. For each element the key-query is evaluated to to produce a key, and if two or more successive elements have the same key (compared as strings), all but the first are removed.

The input-file argument may be a URI instead of a filename. If no input-file argument is given, standard input is used.

The domain-query is streamed. The subtree rooted at each matching element is read, and is available to the element-query and key-query.


binds a prefix (or the default namespace) to a URI for use in XPath queries.