|
Subject: Re: [xsl] Get the duplicates in a list From: "Michael Kay michaelkay90@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Fri, 3 Jan 2025 13:50:52 -0000 |
In pure XPath 3.1 you could also try:
let $s := sort($in)
return distinct-values(for-each-pair($s, tail($s), function($a, $b){$a[. =
$b]) )
It's pretty obscure but it's likely to be quite efficient.
Michael Kay
> On 3 Jan 2025, at 10:52, Roger L Costello costello@xxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> Hi Folks,
>
> $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?
>
> /Roger
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] Complexity, big-O notation [W, Roger L Costello cos | Thread | Re: [xsl] Get the duplicates in a l, Roger L Costello cos |
| Re: [xsl] Get the duplicates in a l, Martin Honnen martin | Date | Re: [xsl] Get the duplicates in a l, Roger L Costello cos |
| Month |