Subject: Re: [xsl] Get the duplicates in a list From: "John Lumley john@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Fri, 3 Jan 2025 14:33:48 -0000 |
On 03/01/2025 10:52, Roger L Costello costello@xxxxxxxxx wrote > $fieldnames is a list of strings, e.g., > > ('TYPE', 'USAGE_CD', 'DIR', 'WGS_LAT', 'TYPE', 'WGS_LONG', 'TURN_DIR', 'DIR', 'TYPE') > > I want a list of the duplicates in $fieldnames: > > ('TYPE', 'DIR') <-- I don't want any duplicates in this list > > Is there a simple XPath expression to obtain the list of duplicates in $fieldnames? What about a simple filter? Not complex, but might be O(n^2) in worst case filter(distinct-values($fieldnames),function($s){count($fieldnames[. = $s]) gt 1}) -- *John Lumley* MA PhD CEng FIEE john@xxxxxxxxxxxx
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Get the duplicates in a l, Dimitre Novatchev dn | Thread | Re: [xsl] Get the duplicates in a l, Philip Fearon pgfear |
Re: [xsl] Get the duplicates in a l, Graydon graydon@xxxx | Date | Re: [xsl] Get the duplicates in a l, Bauman, Syd s.bauman |
Month |