Re: [xsl] Get the duplicates in a list

Subject: Re: [xsl] Get the duplicates in a list
From: "Graydon graydon@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 3 Jan 2025 14:20:49 -0000
On Fri, Jan 03, 2025 at 02:01:33PM -0000, Roger L Costello costello@xxxxxxxxx scripsit:
> It is interesting that such a simple problem requires such complex code.

It is sometimes necessary to consider that one's construction of complex
might be in need of revision.

<xsl:for-each-group select="$values" group-by=".">
  <xsl:sequence select="current-group()[2]"/>
</xsl:for-each>

isn't obviously complex; I might even go for "elegant". It is very much
an XSLT approach to the problem.

(Dr. Kay's "for-each-pair" pure XPath solution increased my
understanding; always new stuff to learn.)

The other thing is that "simple problem" is a statement about
expectation; if all the solutions are complex, that could be because the
language design is deficient in some way, but it could also be because
the problem isn't simple.

-- Graydon


-- 
Graydon Saunders  | graydonish@xxxxxxxxxxxx
\xDE\xE6s ofer\xE9ode, \xF0isses sw\xE1 m\xE6g.
-- Deor  ("That passed, so may this.")

Current Thread