What I want is to achieve the equivalent to SQL "select distinct"
statement with the instance results from a query.

I recall Rob Rawson talking in a presentation at the last BrainShare
about presenting a distinct list like this in ECMAScript/UserApp. (which
reminds me, despite providing my email address, I never was sent the
promised Designer project with all the code demoed!!)

I've done some searching and couldn't find anything that describes how
to do this in DirXML.

So I tried to roll my own. The following test code worked in my limited
testing. Can anyone advise if there is a better/smarter way to do this?

Note: I'm only interested in the actual unique values of a returned
attribute (in my case the L attribute).

<do-set-local-variable name="queryResult" scope="policy">
<arg-node-set>
<token-query>
<arg-match-attr name="CN">
<arg-value type="string">
<token-text xml:space="preserve">blah</token-text>
</arg-value>
</arg-match-attr>
<arg-string>
<token-text xml:space="preserve">L</token-text>
</arg-string>
</token-query>
</arg-node-set>
</do-set-local-variable>
<do-for-each>
<arg-node-set>
<token-xpath
expression='$queryResult//value[ancestor::*/@attr-name="L"][not( .=
.../../preceding-sibling::*//value[ancestor::*/@attr-name="L"]) ]/text()'/>
</arg-node-set>
<arg-actions>
<do-trace-message>
<arg-string>
<token-local-variable name="current-node"/>
</arg-string>
</do-trace-message>
</arg-actions>
</do-for-each>